Hello, I'm evaluating using prefect 2.0 with a loc...
# prefect-community
d
Hello, I'm evaluating using prefect 2.0 with a local server. I think I'm missing a very basic concept about deployment. I want to set up a flow that is called many times a day, each time given a different data file as the parameter. I can do this quite easily locally by calling my flow's method with the file path as the parameter. But if I want to use the Orion server to manage these flow runs, I don't see how to launch a flow from an external application sending a different parameter value as the parameter value is tied to the deployment. It seems strange to have to create a deployment each time with this parameter (lots of extra work, and will quickly have thousands of deployments each used exactly once.)
k
Just so I understood you correctly, you want to run a flow with different parameters from an external application, but found it redundant to create a deployment for each parameter?
p
You can create a single deployment for the flow, then use the client to create flow runs from that deployment, and pass in your own paramters
d
Just so I understood you correctly, you want to run a flow with different parameters from an external application, but found it redundant to create a deployment for each parameter?
@Khuyen Tran yes, exactly right.
@Peyton Runyan Thanks. I started looking into that, issuing my own REST commands. For some reason I couldn't get the agent to pick up FlowRuns that I created that way (matching labels etc.) I didn't know about the python client, I'll try from there. Thanks!
Thanks, this worked great, using the python client. It seems that the parameter values in the deployment are merely a default, that can be overridden when running. If anyone in the future sees this, here was the client code that invoked:
Copy code
async def launch_prefect_flow():
    try:
        client = OrionClient(PREFECT_API_URL)
        await client.create_flow_run_from_deployment(
            "3d3974bd....",
            parameters={"file_path": "/test/test.txt"})
    except:
        logger.exception("Exception launching prefect flow")
🔥 1
p
I'm glad to hear!