Defining a task
Place Python files undertasks/ and decorate functions with @task:
TaskContext and returns through ctx.result(...). A plain return value or None is also accepted and normalized to a successful result.
Dependencies
Tasks declare dependencies withdepends_on, accepting a single function, a tuple, or a list:
ctx.result_of(node_fn) reads the latest persisted result of an upstream node, returning a NodeResultEnvelope with payload, metadata, status, and ts fields. Results persist across runs. Use ctx.results_of(node_fn, limit=N) to read result history. Reading a missing or unsuccessful upstream raises unless you pass default=.
Tasks may depend on other tasks, assets, and loaders. They may not depend on SQL models or sources as graph dependencies, but they can read them at runtime with typed references - see SQL references.
Returning results
payloadis the value downstream nodes read withctx.result_of(...).metadatais structured JSON for catalogs and downstream reads.- Tasks cannot set
materialized- that is for assets.
Skipping
Returnctx.skip(...) to skip a task:
"soft"(default) skips only this task; dependents may still run if another upstream succeeded."hard"skips this task and blocks its dependents.
mode accepts either a plain string or the SkipMode enum:
Retries
@task accepts a retry policy for transient failures:
| Field | Default | Description |
|---|---|---|
max_attempts | 3 | Total attempts including the first |
retry_on | Exception | Exception class, tuple, or list to retry on |
initial_delay_seconds | 1.0 | Delay before the first retry |
backoff_multiplier | 2.0 | Exponential backoff multiplier |
max_delay_seconds | 30.0 | Cap on any single delay |
max_elapsed_seconds | None | Overall time bound for retries |
jitter | True | Randomize delays to avoid synchronized retries |
retry_on explicitly rather than relying on the broad default when you can. The original exception is preserved if all attempts fail.
Decorator parameters
| Parameter | Description |
|---|---|
name | Override the node name (defaults to the function name) |
depends_on | Upstream nodes (function, tuple, or list); model()/source() for read-only SQL refs |
tags | Labels for selection and grouping |
group | Display/catalog grouping |
description | Docs (defaults to docstring) |
meta | Freeform JSON metadata |
retry | A RetryPolicy |
Running tasks
sqb build. They are not validated by checks unless you also write a check that depends on them.
