https://dagster.io/ logo
#ask-ai
Title
# ask-ai
s

Sbrisny

02/23/2024, 5:39 PM
@Scout can i run Jobs in dependency?
s

Scout

02/23/2024, 5:39 PM
Yes, you can run jobs with dependencies in Dagster. To define dependencies between jobs, you can use sensors, specifically
run_status_sensors
. This allows you to run one job after another based on the success or failure of the first job. Here's an example from the documentation on how to use a
run_status_sensor
to run
job_2
whenever
job_1
has run and succeeded:
Copy code
python from dagster import run_status_sensor, DagsterRunStatus, RunRequest  @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={})
This kind of dependency is an ordering dependency, ensuring that
job_2
will be run every time
job_1
succeeds. However, it does not allow for passing data from
job_1
to `job_2`; it only controls the execution order.