Workflow Entity¶
The Workflow entity is kept under the following import statement:
Attributes¶
Below we have the most common attributes used in the Workflow entity:
id: The unique identifier of the Workflow entity. Follows the formatwrkf_<value>.
Running a Workflow¶
Use run_and_wait() to run a workflow, wait for it to finish, and read the Ender's result in one call:
from everysk.sdk.entities import Workflow
workflow = Workflow(id='wrkf_P95OLO61oGM5NwFn3W4iMl7rs')
worker_execution = workflow.run_and_wait(parameters={'file': {'name': 'SimpleTextFile.txt'}}, timeout=300, poll_interval=2)
print(worker_execution.result)
run_and_wait raises WorkflowExecutionTimeout after timeout seconds and WorkflowExecutionFailed when run_status is not SUCCEEDED. Both live in everysk.core.exceptions.
To do the same thing in steps, run the workflow, wait for its execution, and read the result yourself:
from everysk.sdk.entities import Workflow, WorkflowExecution
workflow = Workflow(id='wrkf_P95OLO61oGM5NwFn3W4iMl7rs')
response = workflow.run(parameters={'file': {'name': 'SimpleTextFile.txt'}})
execution = WorkflowExecution(id=response['workflow_execution']['id']).wait_for_completion(timeout=300, poll_interval=2)
if execution.run_status == 'SUCCEEDED':
worker_execution = execution.get_result()
print(worker_execution.result)