Skip to content
Back to CHANGELOG

Optional Tasks

Optional Tasks

Subtasks can now be marked as optional when submitting them. Use optional=True for work such as preview generation or auxiliary data enrichment whose failure should not cancel the job. Required tasks keep their existing failure behavior.

Inside a task’s execute method, submit an optional step and make a final step depend on it. Here, CreatePreview and Finalize represent your own task classes:

python
preview = context.submit_subtask(
    CreatePreview(), optional=True, max_retries=3
)
context.submit_subtask(Finalize(), depends_on=[preview])

Tilebox retries the preview up to three times before marking it FAILED_OPTIONAL. Finalize still runs after that failure, so it must handle a missing preview rather than assume the optional step produced an output.

Optionality also applies to a task’s nested subtasks. A failure inside that optional subtree skips its remaining queued work (SKIPPED) without canceling the rest of the job. This contains failures within the optional branch while keeping them visible for investigation.

Type to search…