Mike Marinaccio

    Mike Marinaccio

    1 year ago
    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?
    Chris White

    Chris White

    1 year ago
    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.
    Mike Marinaccio

    Mike Marinaccio

    1 year ago
    Hi Chris - I appreciate the prompt response, and it’s helpful to know that you consider this access method an anti pattern.