flytekit.workflow(_workflow_function=None, failure_policy: Optional[flytekit.core.workflow.WorkflowFailurePolicy] = None, interruptible: Optional[bool] = False)[source]

This decorator declares a function to be a Flyte workflow. Workflows are declarative entities that construct a DAG of tasks using the data flow between tasks.

Unlike a task, the function body of a workflow is evaluated at serialization-time (aka compile-time). This is because while we can determine the entire structure of a task by looking at the function’s signature, workflows need to run through the function itself because the body of the function is what expresses the workflow structure. It’s also important to note that, local execution notwithstanding, it is not evaluated again when the workflow runs on Flyte. That is, workflows should not call non-Flyte entities since they are only run once (again, this is with respect to the platform, local runs notwithstanding).

Please see the Write a simple workflow for more usage examples.

  • _workflow_function – This argument is implicitly passed and represents the decorated function.

  • failure_policy – Use the options in flytekit.WorkflowFailurePolicy

  • interruptible – Whether or not tasks launched from this workflow are by default interruptible