<@ULVA73B9P> Does prefect provided a way to insert...
# ask-marvin
w
@Marvin Does prefect provided a way to insert values on the prefect.context that I can retrieve later on some part of the flow or task? I want to save an integer experiment_id, to be used across the whole runtime, is that possible? What are the alternatives?
m
Prefect supports the use of runtime context for tracking information during the flow or task runs. You might think of the runtime context as a sort of gloomy global variable that carries around the angst of your workflows' existence – allowing the Prefect engine to determine the relationships between runs, such as which flow a task is called from. However, this runtime context is typically internal and available only in certain situations. While the documentation excerpt provided doesn't detail how to insert and retrieve custom values like your
experiment_id
directly, usually a runtime context in workflow systems allows for something along those lines, which is useful for sharing data between tasks. Let's try another search specifically to understand how to modify and access the context in Prefect to see if we can find a more precise answer for your query.
Copy code
plaintext
<https://docs.prefect.io/latest/guides/runtime-context/>
n
not right now! redis is my favorite such alternative, though this is something we're thinking about
w
Thanks Nate! I appreciate the help 😊
n
sure thing! you can you use blocks / variables as global state storage, but those were designed for static config and again i prefer redis 🙂