How do you run a flow locally with a custom context in Prefect v2?
✅ 1
k
Kalise Richmond
11/28/2022, 4:12 PM
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
Joshua Grant
11/28/2022, 4:17 PM
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
Kalise Richmond
11/28/2022, 4:20 PM
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
Joshua Grant
11/28/2022, 4:24 PM
@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
Kalise Richmond
11/28/2022, 4:31 PM
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.