Hey Everyone! Quick question about Parameters. I have some tasks in which I’ve decided to access certain Parameter values via
prefect.context.parameters
. Am I correct to say that I can always rely on the context params being set before any other task is run in an async / Dask environment?
c
Chris White
10/21/2020, 9:58 PM
Hi Mike, you can rely on the parameters being present within context after the flow runner has initialized the run (note that there are a few things that happen prior to this, including your environment spin up). This means that parameters will be populated for all state handlers / tasks.
Regardless of that, I highly recommend exposing task dependencies on Parameters as top-level explicit dependencies instead of implicitly relying on context.
m
Mike Marinaccio
10/21/2020, 10:12 PM
Hi Chris - I appreciate the prompt response, and it’s helpful to know that you consider this access method an anti pattern.