John Cenzano-Fong02/15/2023, 8:06 AM
so you can prevent a job schedule from executing if the last run of the same job failed. Is there an analog to this for Dagster? I'm seeing execution_fn and should_execute that leverage
but that context seems to only have information about the current run. Any best practice suggestions for this situation?
owen02/15/2023, 5:59 PM
property, which gives you access to the
(which hold information on past runs and all that good stuff). So within the body of your should_execute function, you can query for the last run of your job with something like
(you can do
last_run = list(context.instance.get_runs(filters=RunsFilter(job_name="my_job"), limit=1)) if last_run.status == DagsterRunStatus.FAILURE: ...
from dagster import RunsFilter, DagsterRunStatus
John Cenzano-Fong02/15/2023, 11:55 PM