Constantino Schillebeeckx
04/15/2024, 6:49 PMfrom prefect import get_run_logger, task, flow
@task
def child_a():
logger = get_run_logger()
<http://logger.info|logger.info>("child A")
raise ValueError("simulated")
@task
def child_b():
logger = get_run_logger()
<http://logger.info|logger.info>("child B")
@task
def child_c():
logger = get_run_logger()
<http://logger.info|logger.info>("child C")
@flow(
name="test_flow_retry",
)
def hello_world():
a = child_a.submit()
child_b.submit(wait_for=[a])
child_c.submit()
Constantino Schillebeeckx
04/15/2024, 6:50 PMretry
in the UI). that's expected right? do I need to persist results for each of those tasks so that successful tasks (e.g. child_c
) are not executed again when the flow is retried?Kevin Grismore
04/15/2024, 6:51 PMConstantino Schillebeeckx
04/15/2024, 6:52 PMKevin Grismore
04/15/2024, 6:53 PMNone
and implicitConstantino Schillebeeckx
04/15/2024, 6:54 PMNone
)Kevin Grismore
04/15/2024, 6:54 PMKevin Grismore
04/15/2024, 6:55 PMKevin Grismore
04/15/2024, 7:01 PMConstantino Schillebeeckx
04/15/2024, 7:02 PMNone
? do they persist with True/False
?Kevin Grismore
04/15/2024, 7:02 PMIfis set topersist_result
, these values will never be stored.False
Kevin Grismore
04/15/2024, 7:02 PM@task(persist_result=True)
def child_c():
logger = get_run_logger()
<http://logger.info|logger.info>("child C")
Kevin Grismore
04/15/2024, 7:03 PMConstantino Schillebeeckx
04/15/2024, 7:03 PMpersist_result
defaults to None (not False)Constantino Schillebeeckx
04/15/2024, 7:03 PMConstantino Schillebeeckx
04/15/2024, 7:05 PMKevin Grismore
04/15/2024, 7:05 PMpersist_result
to True
for none and bool type resultsKevin Grismore
04/15/2024, 7:07 PMConstantino Schillebeeckx
04/15/2024, 7:12 PMpersist_result=None
, there is the setting PREFECT_RESULTS_PERSIST_BY_DEFAULT
(docs) which defaults to False - so perhaps that latter setting is ultimately dictating behavior?Kevin Grismore
04/15/2024, 7:28 PMpersist_result
is not set to True
or False
in the flow or task decoratorKevin Grismore
04/15/2024, 7:29 PMKevin Grismore
04/15/2024, 7:31 PMNone
at runtime. After that, where the result is persisted to depends on its type.Constantino Schillebeeckx
04/15/2024, 7:33 PMPREFECT_RESULTS_PERSIST_BY_DEFAULT=True
, and the flow that I originally shared behaves as I expected: retrying the flow after an initial run only reruns the previously failed child_a
Kevin Grismore
04/15/2024, 7:33 PMConstantino Schillebeeckx
04/15/2024, 7:34 PMpersist_result=True
is set on the tasks OR
• PREFECT_RESULTS_PERSIST_BY_DEFAULT=True
setting is setConstantino Schillebeeckx
04/15/2024, 7:35 PMKevin Grismore
04/15/2024, 7:35 PMYaron Levi
04/16/2024, 4:04 AM