Class for creating and managing a workflow.

Methods

Public methods


Method list_workflows()

Lists all the workflows in the account.

Usage

Workflow$list_workflows(max_items = 100, client = NULL, html = FALSE)

Arguments

max_items

(int, optional): The maximum number of items to be returned. (default: 100)

client

(SFN.Client, optional): sfn client to use for the query. If not provided, a default sfn client for Step Functions will be automatically created and used. (default: None)

html

(bool, optional): Renders the list as an HTML table (If running in an IRkernel environment). If the parameter is not provided, or set to FALSE, a R list is returned. (default: False)

Returns

list: The list of workflows. Refer to :meth:`.SFN.Client.list_state_machines()` for the response structure.


Method new()

Initialize Workflow Class

Usage

Workflow$new(
  name,
  definition,
  role,
  tags = list(),
  execution_input = NULL,
  timeout_seconds = NULL,
  comment = NULL,
  version = NULL,
  state_machine_arn = NULL,
  format_json = TRUE,
  client = NULL
)

Arguments

name

(str): The name of the workflow. A name must not contain:

  • whitespace

  • brackets ``< > [ ]``

  • wildcard characters ``? *``

  • special characters ``\" # % \ ^ | ~ ` $ & , ; : /``

  • control characters (``U+0000-001F``, ``U+007F-009F``)

definition

(State or Chain): The Amazon States Language https://states-language.net/spec.html definition of the workflow.

role

(str): The Amazon Resource Name (ARN) of the IAM role to use for creating, managing, and running the workflow.

tags

(list): Tags to be added when creating a workflow. Tags are key-value pairs that can be associated with Step Functions workflows and activities. (default: [])

execution_input

(ExecutionInput, optional): Placeholder collection that defines the placeholder variables for the workflow execution. This is also used to validate inputs provided when executing the workflow. (default: None)

timeout_seconds

(int, optional): The maximum number of seconds an execution of the workflow can run. If it runs longer than the specified time, the workflow run fails with a `States.Timeout` Error Name. (default: None)

comment

(str, optional): A human-readable description of the workflow. (default: None)

version

(str, optional): The version of the Amazon States Language used in the workflow. (default: None)

state_machine_arn

(str, optional): The Amazon Resource Name (ARN) of the workflow. (default: None)

format_json

(bool, optional): Boolean flag set to `True` if workflow definition and execution inputs should be prettified for this workflow. `False`, otherwise. (default: True)

client

(SFN.Client, optional): paws client to use for creating, managing, and running the workflow on Step Functions. If not provided, a default sfn client for Step Functions will be automatically created and used. (default: None)


Method attach()

Factory method to create an instance attached to an exisiting workflow in Step Functions.

Usage

Workflow$attach(state_machine_arn, client = NULL)

Arguments

state_machine_arn

(str): The Amazon Resource Name (ARN) of the existing workflow.

client

(SFN.Client, optional): sfn client to use for attaching the existing workflow in Step Functions to the Workflow object. If not provided, a default sfn client for Step Functions will be automatically created and used. (default: None)

Returns

Workflow: Workflow object attached to the existing workflow in Step Functions.


Method create()

Creates the workflow on Step Functions.

Usage

Workflow$create()

Returns

str: The Amazon Resource Name (ARN) of the workflow created. If the workflow already existed, the ARN of the existing workflow is returned.


Method update()

Updates an existing state machine by modifying its definition and/or role. Executions started immediately after calling this method may use the previous definition and role.

Usage

Workflow$update(definition = NULL, role = NULL)

Arguments

definition

(State or Chain, optional): The Amazon States Language https://states-language.net/spec.html definition to update the workflow with. (default: None)

role

(str, optional): The Amazon Resource Name (ARN) of the IAM role to use for creating, managing, and running the workflow. (default: None)

Returns

str: The state machine definition and/or role updated. If the update fails, None will be returned.


Method execute()

Starts a single execution of the workflow.

Usage

Workflow$execute(name = NULL, inputs = NULL)

Arguments

name

(str, optional): The name of the workflow execution. If one is not provided, a workflow execution name will be auto-generated. (default: None)

inputs

(str, list, optional): Input data for the workflow execution. (default: None)

Returns

stepfunctions.workflow.Execution: An execution instance of the workflow.


Method list_executions()

Lists the executions for the workflow.

Usage

Workflow$list_executions(max_items = 100, status_filter = NULL, html = FALSE)

Arguments

max_items

(int, optional): The maximum number of items to be returned. (default: 100)

status_filter

(ExecutionStatus, optional): If specified, only list the executions whose current status matches the given filter. (default: None)

html

(bool, optional): Renders the list as an HTML table (If running in an IRKernel environment). If the parameter is not provided, or set to FALSE, a R list is returned. (default: False)

Returns

list: List of workflow run instances.


Method delete()

Deletes the workflow, if it exists.

Usage

Workflow$delete()


Method render_graph()

Renders a visualization of the workflow graph.

Usage

Workflow$render_graph(portrait = FALSE)

Arguments

portrait

(bool, optional): Boolean flag set to `True` if the workflow graph should be rendered in portrait orientation. Set to `False`, if the graph should be rendered in landscape orientation. (default: False)


Method get_cloudformation_template()

Returns a CloudFormation template that contains only the StateMachine resource. To reuse the CloudFormation template in a different region, please make sure to update the region specific AWS resources (e.g: Lambda ARN, Training Image) in the StateMachine definition.

Usage

Workflow$get_cloudformation_template()


Method format()

class formatting

Usage

Workflow$format()


Method print()

print class

Usage

Workflow$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

Workflow$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.