Kalyan katamreddi
07/21/2022, 6:07 AMSanidhya Singh
07/21/2022, 6:14 AMsolid_selection: *
tagjamie
07/21/2022, 1:23 PMKalyan katamreddi
07/22/2022, 11:08 AMjamie
07/22/2022, 2:19 PMjob_a
on a schedule that runs once a day, but then you manually do a run of job_a
you should be able to see every run on job_a
(ie all runs triggered from schedules and the manual run) in the Runs tab for the job in dagit (click on the job in the left sidebar and go to the Runs tab). Or if you go to the Status page (top nav on the right) you should see a list of every job and an overview of the status of the past few runs. you can click into the job from there are also get to the Runs tab.
Let me know if there's other behavior you'd like to see and I can help out!Kalyan katamreddi
07/22/2022, 2:34 PMjamie
07/22/2022, 2:38 PMrun_failure_sensor
will run for every job execution that fails (regardless of the job name and how it was triggered). You can narrow it down so that the run_failure_sensor
only triggers for a specific job. Using the example above, if you set up a run_failure_sensor
to monitor job_a
the sensor would run whenever job_a
fails (regardless of if the run was started by a schedule or by someone manually running it)Kalyan katamreddi
07/22/2022, 4:13 PMjamie
07/22/2022, 4:14 PMjob_a
fails from a scheduled run and another sensor that detects when job_a
fails from a manual run?jamie
07/22/2022, 4:15 PMjob_a
fails, you want to execute certain code if it's from a schedule, and other code if it's a manual run)Kalyan katamreddi
07/22/2022, 4:15 PMjamie
07/22/2022, 4:22 PM@run_failure_sensor
def my_failure_sensor(context):
pass
there is a lot of information within the context that might be useful to you.
I'm not sure if there is a specific attribute in the context that tells you who/what executed the job, but if there is, then you should be able to just look at that attribute and execute accordingly
If there isn't an attribute that tells you what you need to know, here's my alternative solution:
In the schedule that executes job_a
you can attach a specific tag to the run
# pseudocode
@schedule(job_a, cron_schedule="...")
def job_1_schedule():
return RunRequest(
run_key=None,
run_config={},
tags={"scheduled": "true"}
)
the important thing here is the tags
argument. This tag will only be set for the scheduled executions of job_a
(unless someone manually running job_a
adds this tag in the dagit launchpad).
Then in your failure sensor, you can get information about the run in from the context and find the tags that are on the run. My guess is it would be under context.pipeline_run
but i'm not 100% sure about thatKalyan katamreddi
07/22/2022, 4:24 PMKalyan katamreddi
07/22/2022, 4:33 PMKalyan katamreddi
07/22/2022, 5:13 PMjamie
07/22/2022, 5:19 PMcontext
object that an op receives is created at execution time by the dagster internals, so maybe the run tags are included in that. You could root around a bit in the context object (pdb is one of my favorite tools for this) and see if you can find them. Given our general approach to tags I wouldn't be surprised if run tags are not accessible in an op though