How do you run a flow locally with a custom contex...
# ask-community
j
How do you run a flow locally with a custom context in Prefect v2?
1
k
Hi @Joshua Grant, this discourse article shows what you can access in context. What are you trying to accomplish with the custom context in v2? There might be a different solution rather than context to accomplish what you need.
j
Thanks @Kalise Richmond for the reply, in Prefect v1, we used context to store variables regarding the flow (ids for various things, e.g. encryption keys). . . things that we don't want sitting around in Parameters. What solution would you recommend?
k
Hey @Joshua Grant I would recommend using Blocks to store these things. Blocks are a new Prefect 2.x concept and you would be able to access those from multiple different flows.
j
@Kalise Richmond to confirm, in v2 context cannot be used to store variables and the recommended way to do pass variables we do not want exposed is via blocks?
k
Yes. Blocks will allow you to access these variables at run time. You can build custom blocks and also use the field SecretStr to hide the variables in the UI.