Hi there. I am working on a flow that depends on a...
# prefect-community
Hi there. I am working on a flow that depends on a
. These can come from two
or, if the parameters are not provided, the dates are computed after applying some logic to
. I'd like to use the computed start and end dates for templating the task result's location. If these dates are passed as task inputs, they are accesible (I can do this
) but I'd also like to use these variables in some downstream tasks that don't list them as inputs. Is there another way for a downstream task to access these? Since they don't always come from a Parameter, they are not available in
. I tried adding them to the context at run time with
prefect.context["start_date"] = start_dt
but modifying the context like this doesn't feel right. Any suggestions?
Hi @Pedro Machado - I think the cleanest way to handle this would be to create an upstream task that will conditionally return the datetime object of your choosing; you can then reference the result of this task everywhere you need it without worrying about differing values or modifying the run context, and provide maximum visibility into where those important values are coming from.
👍 2
Thanks, Nicholas. I'll keep the dependencies explicit.
👍 1