Hello again, moving forward on my quest to upgrade...
# prefect-community
Hello again, moving forward on my quest to upgrade to the newest prefect version and use the newly open-sourced ui… One question whose answer eludes me completely: when registering a flow, how can I set the default context for it? A bit of background: we have many flows with tasks that use context variables to share common parameters, for example, a URL to some external API. What I would like is to schedule the run of a flow with a particular value for this context variable, but I can’t find where I can set it. The closest thing I could find was setting different parameters (not context values) when setting the schedule with an IntervalClock. Another alternative could be to change my context variables to task parameters, but that would require a lot of changes.
Hey @David Ojeda — that’s a very good question and something I don’t think we actually support at the moment. For historical reasons, this is because we originally imagined
as a read-only source of information populated by the system, whereas
were for user input. Over time we introduced the ability to modify context on a per-run basis to supply things like secrets and executor configs by hand. I think we need to better clarify what context is used for and also how to interact with it. Unfortunately at this time the only provision for a “default” context is to use parameters.
Let us take this as an item for internal discussion and see what we can do to improve the experience of working with context; sorry it’s not as easy as it could be in 0.10.1!
Ok I understand. I don't want to start a large refactor to change our context to parameters so I'll hold on that. If I prefer to continue using contexts, once the flow is deployed, where does it make sense to define the context values? In the agent?
Yeah - you mean if you want to write a line to set it manually for every run?
I believe the flowrunner is going to request the context from the server
Yeah, I need to populate it with some values but I am not sure where to do it (I am still new to the new orchestration structure)