Skip to content

Workflow

Decorator that turns a function into a Datatailr DAG workflow.

The decorated function should compose @task-decorated calls. Task dependencies are inferred automatically from the data flow between function calls.

All parameters supplied to this decorator set the default values for every task in the workflow. Individual tasks can override these via their own @task arguments.

Parameters:

  • name

    (str | None, default: None ) –

    Display name of the workflow. Defaults to the decorated function name, title-cased.

  • schedule

    (Schedule | None, default: None ) –

    An optional Schedule for recurring execution.

  • image

    (Image | None, default: None ) –

    Pre-configured container Image applied to all tasks.

  • run_as

    (str | User | None, default: None ) –

    User or username under which the workflow runs.

  • resources

    (Resources, default: Resources(memory='100m', cpu=1) ) –

    Default Resources (CPU / memory) for each task.

  • acl

    (ACL | None, default: None ) –

    Access control list for the workflow.

  • python_version

    (str, default: 'auto' ) –

    Python version for the container images.

  • python_requirements

    (str | List[str], default: '' ) –

    Python dependencies (see Image).

  • build_script_pre

    (str, default: '' ) –

    Dockerfile commands before pip install.

  • build_script_post

    (str, default: '' ) –

    Dockerfile commands after pip install.

  • env_vars

    (dict[str, str | int | float | bool], default: {} ) –

    Environment variables passed to every task container.

  • fail_after

    (timedelta | str | None, default: None ) –

    Maximum wall-clock duration before the workflow is marked as failed (e.g. timedelta(hours=2) or "2h").

  • expire_after

    (timedelta | str | None, default: None ) –

    Duration after which a completed workflow's resources are cleaned up.

  • budget

    (Budget | str | None, default: None ) –

    Optional spend budget for the workflow as Budget("name") or a name str. If not provided, will be set to the 'default' budget.

Returns:

  • Workflow ( Callable ) –

    A function that deploys the workflow to the Datatailr platform when called.

    Pass any of the following keyword arguments to control the deployment:

    • local_run=True: execute the workflow locally.
    • to_json=True: return the JSON representation of the workflow without deploying.
    • save_only=True: save the workflow definition without running it.
    • instant_run=True: run the workflow immediately without building a new image — use the default workstation image instead.

Raises:

  • ValueError

    If local_run=True and a schedule is set.