Use this skill when a Prefect flow contains conditional execution logic: tasks that only run based on the result of upstream tasks, if/else branches driven by task return values, allow_failure=True patterns, or conditional .submit() calls. Triggers: any Prefect flow with if/else branching on task outputs, any task called conditionally, any use of Prefect states to control downstream execution.
73%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/migrate-to-orchestra/skills/prefect-conditions-to-orchestra/SKILL.mdThis skill converts Prefect conditional execution patterns into Orchestra condition: expressions. It covers input-driven branches, runtime output-driven branches, allow_failure patterns, and always-run tasks.
| Prefect construct | Orchestra field | Notes |
|---|---|---|
| Default (no condition) | condition: null | Orchestra default |
| Input-driven branch | condition: "${{ inputs.flag == true }}" | Decision known at trigger time |
result = task.submit(); if result.result(): | upstream PYTHON task with set_outputs: true + downstream condition | Runtime decision via outputs |
allow_failure=True | treat_failure_as_warning: true on upstream task | Downstream continues regardless |
| Skip if no data | condition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['id'].OUTPUTS['key'] > 0 }}" | |
| Always run | condition: "${{ True }}" | Runs even if upstream failed |
.submit(wait_for=[other]) | depends_on: [other-task-id] | Dependency without data passing |
.map() over list | matrix: block on TaskGroupModel | See prefect-data-passing-to-orchestra |
version: v1
name: conditional-pipeline
pipeline:
stage-check:
tasks:
task-check-new-data:
integration: SNOWFLAKE
integration_job: SNOWFLAKE_RUN_QUERY
parameters:
statement: "SELECT COUNT(*) AS row_count FROM staging.new_records"
depends_on: []
condition: null
tags: []
depends_on: []
stage-process:
tasks:
task-process-records:
integration: PYTHON
integration_job: PYTHON_EXECUTE_SCRIPT
parameters:
command: python scripts/process_records.py
depends_on: []
condition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['task-check-new-data'].OUTPUTS['row_count'] > 0 }}"
tags: []
depends_on:
- stage-check
stage-skip:
tasks:
task-log-skip:
integration: PYTHON
integration_job: PYTHON_EXECUTE_SCRIPT
parameters:
command: python scripts/log_skip.py
depends_on: []
condition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['task-check-new-data'].OUTPUTS['row_count'] == 0 }}"
tags: []
depends_on:
- stage-checkcondition: "${{ inputs.param == value }}" directlycondition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['task-id'].OUTPUTS['key'] op value }}"allow_failure=True with treat_failure_as_warning: true on the upstream task.submit(wait_for=[...]) with depends_on: [...] on the downstream task/group.map() calls for prefect-data-passing-to-orchestra (matrix pattern)from prefect import flow, task
@task
def check_new_data() -> bool:
count = run_query("SELECT COUNT(*) FROM staging.new_records")
return count > 0
@task
def process_records():
...
@task
def log_skip():
...
@flow
def conditional_flow():
has_data = check_new_data.submit()
if has_data.result():
process_records.submit(wait_for=[has_data])
else:
log_skip.submit(wait_for=[has_data])version: v1
name: conditional-flow
pipeline:
stage-check:
tasks:
task-check-new-data:
integration: SNOWFLAKE
integration_job: SNOWFLAKE_RUN_QUERY
parameters:
statement: "SELECT COUNT(*) AS row_count FROM staging.new_records"
depends_on: []
condition: null
tags: []
depends_on: []
stage-process:
tasks:
task-process-records:
integration: PYTHON
integration_job: PYTHON_EXECUTE_SCRIPT
parameters:
command: python scripts/process_records.py
depends_on: []
condition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['task-check-new-data'].OUTPUTS['row_count'] > 0 }}"
tags: []
depends_on:
- stage-check
stage-skip:
tasks:
task-log-skip:
integration: PYTHON
integration_job: PYTHON_EXECUTE_SCRIPT
parameters:
command: python scripts/log_skip.py
depends_on: []
condition: "${{ ORCHESTRA.PIPELINE_RUN_TASKS['task-check-new-data'].OUTPUTS['row_count'] == 0 }}"
tags: []
depends_on:
- stage-checkOrchestraSDK and calls client.set_output() to expose values — see prefect-data-passing-to-orchestra for the client setup.submit(wait_for=[...]) is a dependency pattern, not a data-passing pattern — use depends_on:allow_failure=True → treat_failure_as_warning: true on the upstream task (downstream continues).map() over a list is a matrix pattern — see prefect-data-passing-to-orchestracondition is evaluated after depends_on is satisfied; a skipped task does not fail the pipeline${{ True }} as a condition means always run, even if an upstream task failedSee prefect-alerts-to-orchestra for all notification patterns.
orchestra-hq/orchestra-skills
a4079ea
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.