Hello Prefect Team and Community, I have some pred...
# ask-community
h
Hello Prefect Team and Community, I have some predefined prefect-flows in Python Jinja template format. Every time my service receives a REST post, it retrieves the parameters and generates a.py file using the Jinja template provided. Is there a way to run and deploy the flow to the work pool automatically? I currently use subprocess, but I think it is not a good approach. Thank you for reading.
Copy code
deploy_process = await asyncio.create_subprocess_exec(
        "prefect",
        "deploy",
        "-n",
        f"{mlflow_name}",
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )

    run_process = await asyncio.create_subprocess_exec(
        "prefect",
        "deployment",
        "run",
        f"sklearn-flow/{mlflow_name}",
        stdout=asyncio.subprocess.PIPE,
        stderr=asyncio.subprocess.PIPE,
    )