Antoine
03/31/2020, 9:32 AMsashank
03/31/2020, 1:22 PMshould_execute
function on the ScheduleDefinition
. It is passed a context which an instance of ScheduleExecutionContext
. On this we can access context.instance
which lets us query the run storage using the get_runs
methoddef should_execute(context):
run_filter = PipelineRunsFilter(pipeline_name="Pipeline A")
runs = context.instance.get_runs(run_filter, limit=1)
if not len(runs):
return False
latest_run = runs[0]
if latest_run.status == PipelineRunStatus.SUCCESS:
return True
return False
Antoine
03/31/2020, 1:24 PMreturn False
in `should_execute`is final, in that it would skip that pipeline execution entirely.sashank
03/31/2020, 1:29 PMshould_execute
, and between the backfilling_partition_selector
and should_execute
functions, you can define the logic to return appropriate partitions when they are ready to runFalse
for should execute if your requirements to run any daily partition for schedule B are not satisfied, but True
if at least one daily partition can be run. Then in backfilling_partition_selector
you should return that partition.Antoine
03/31/2020, 1:46 PMsashank
03/31/2020, 1:53 PM