Skip to content

How do I define dependencies between jobs? #16143

Answered by jamiedemaria
jamiedemaria asked this question in Q&A
Discussion options

You must be logged in to vote

You can use sensors, specifically run_status_sensors to accomplish this. Relevant documentation can be found here: https://docs.dagster.io/concepts/partitions-schedules-sensors/sensors#run-status-sensors

If you have two jobs, job_1 and job_2 and you want to run job_2 whenever job_1 has run and succeeded, you can write a run_status_sensor like this:

@run_status_sensor(
    run_status=DagsterRunStatus.SUCCESS,
    monitored_jobs=[job_1]
    request_job=job_2,
)
def run_job_2_sensor(context):
        return RunRequest(run_key=None, run_config=run_config)

Note that this kind of dependency is only an ordering dependency - it ensures that job_2 will be run every time job_1 succeeds. You won't b…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@tjmcdonough
Comment options

Answer selected by jamiedemaria
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
dependencies area: ops/graphs/jobs Related to Dagster ops, graphs and jobs area: sensor Related to Sensors
2 participants