botoflow.workflow_starting.
workflow_starter
(session, aws_region, domain, default_task_list)¶Use this context manager to start a new workflow execution
Example:
# start the workflow using botocore session and ExampleWorkflow class
# with a random workflow_id
with workflow_starter(session, "us-east-1", "SOMEDOMAIN", "DEFAULT_TASKLIST"):
instance = ExampleWorkflow.execute(arg1=1, arg2=2)
print(instance.workflow_execution.workflow_id)
# will print the workflow execution ID
wait_for_completion
(workflow_instance, poll_sleep_time, attempt_count=None)¶This convenience method will block until the workflow completes or attempt_count
is reached.
with workflow_starter(session, "us-east-1", "SOMEDOMAIN", "DEFAULT_TASKLIST") as starter:
instance = ExampleWorkflow.execute(arg1=1, arg2=2)
# check every two minutes if the workflow completed and since we have not set
# the attempt_count, we will poll for as long as the workflow is running
result = starter.wait_for_completion(instance, poll_sleep_time, 2*MINUTES)