Hi everyone, I have this function that deploys a f...
# ask-community
e
Hi everyone, I have this function that deploys a flow using Prefect API.
Copy code
def prefect_deploy(
    pipeline_name, env, deployment_name, work_pool_name, work_queue_name, version
):
    """Register a Kedro pipeline as a Prefect flow."""

    # Pipeline name to execute
    pipeline_name = pipeline_name or "__default__"

    # Use standard deployment configuration for local execution. If you require a different
    # infrastructure, check the API docs for Deployments at: <https://docs.prefect.io/latest/api-ref/prefect/deployments/>
    deployment = Deployment.build_from_flow(
        flow=my_flow,
        name=deployment_name,
        path=str(Path.cwd()),
        version=version,
        parameters={
            "pipeline_name": pipeline_name,
            "env": env,
        },
        infra_overrides={"env": {"PREFECT_LOGGING_LEVEL": "DEBUG"}},
        work_pool_name=work_pool_name,
        work_queue_name=work_queue_name
    )

    deployment.apply()

@flow()
def my_flow():
#Kedro API Codes
.
.
.

if __name__ == "__main__":
    prefect_deploy()
It is a kedro pipeline and using this command to deploy to prefect cloud
python register_prefect_flow.py --work_pool_name data_ingestion --work_queue_name kedro_pipeline
. But I'm encountering an error that says it cannot find the path.
Failed due to a(n) FileNotFoundError when attempting to load the flow from storage. The file or directory specified in the log does not exist.
I'm still learning, can someone help me how prefect cloud will access my flow. Thanks in advance