Joe D
11/13/2023, 6:09 PMMarvin
11/13/2023, 6:10 PMNate
11/13/2023, 6:15 PMNate
11/13/2023, 6:15 PMNate
11/13/2023, 6:18 PMreturn Completed(message="skipping", name="SKIPPED")
and have your downstream code react to that as desiredJoe D
11/13/2023, 6:18 PMCompleted
from a task will skip the rest of its execution, but not the rest of the parent flows execution is that correct?Nate
11/13/2023, 6:18 PMJoe D
11/13/2023, 6:18 PMJoe D
11/13/2023, 6:19 PMNate
11/13/2023, 6:20 PMJoe D
11/13/2023, 6:20 PMNate
11/13/2023, 6:24 PMIn [1]: from prefect import flow, task
In [2]: from prefect.states import Completed
In [3]: @task
...: def flaky():
...: return Completed(message="not today", name="SKIPPED")
...:
In [4]: @flow
...: def parent():
...: state = flaky(return_state=True)
...: if state.name == "SKIPPED":
...: return "All done"
...:
In [5]: parent()
12:23:57.546 | INFO | prefect.engine - Created flow run 'abiding-hound' for flow 'parent'
12:23:58.214 | INFO | Flow run 'abiding-hound' - Created task run 'flaky-0' for task 'flaky'
12:23:58.216 | INFO | Flow run 'abiding-hound' - Executing 'flaky-0' immediately...
12:23:59.144 | INFO | Task run 'flaky-0' - Finished in state SKIPPED('not today', type=COMPLETED)
12:23:59.315 | INFO | Flow run 'abiding-hound' - Finished in state Completed()
Out[5]: 'All done'
Nate
11/13/2023, 6:25 PMJoe D
11/13/2023, 6:25 PMJoe D
11/13/2023, 6:26 PMNate
11/13/2023, 6:26 PMSKIPPED
is an arbitrary name for my own bookkeeping as the dev, it doesnt have the same inherent meaning as the skip signal from 1
yeah sure thing!