Hi there, hopefully a quick question about Prefect...
# prefect-community
Hi there, hopefully a quick question about Prefect 2 run context and specifically getting a dict of parameters.
Here is a simple flow showing what I'm trying to do... basically provide a status update about the flow to Slack, including various pieces of metadata including input parameters.
Copy code
async def show_parameters(foo=1, bar=2):
    flow_run_context = FlowRunContext.get()
    parameters = flow_run_context.flow_run.parameters
    await send_incoming_webhook_message.fn(
The parameters are definitely passed into the flow, but aren't available from the context. When I run a similar flow locally, I am able to get the parameters with this method. Is it something to do with the execution environment?
I believe this is likely related to result persistence and how that's configured, if it's not enabled or if it's not configured to store the results then we aren't persisting the results of a task within the state at least not in a way that it's retrievable from the api, this Includes parameters from my understanding, locally when you run a flow the results are persisted on your local machine and therefore still accessible. Not 100% sure on this but it's the first thing that comes to mind as to why there might be a difference for a local run versus a cloud run
💡 1
I see, that is interesting. I tried
and it didn't work. I'll dig into it a bit more but it's surprising to me that these would be related. Everything is happening inside a single kubernetes job, nothing is being distributed. It's not really worth messing around with persistance, this is a relatively small issue and I'm sure I can work around it.
Interesting wrinkle... if I invoke a flow run with non-default parameters, they do become available in the context and are included in the Slack message.