Joe
01/02/2025, 6:54 PMNate
01/02/2025, 7:23 PM@flow
def f(some_json: dict[str, Any], source_path: str, target_path: str): ...
and you want to know how to pass params to a new run of this deployed flow?Joe
01/02/2025, 7:46 PMNate
01/02/2025, 7:54 PMrun_deployment
from prefect.deployments import run_deployment
run_deployment("f/my-deployment", parameters=dict(some_json={...}, source="<s3://foo>", target="<s3://bar>"))
Nate
01/02/2025, 7:55 PMtimeout=0
in there if you don't want to wait for that flow run to finish
run_deployment
will return a flow_run
objectJoe
01/02/2025, 7:55 PM__name__ == "__main__"
section to account for the arguments? The examples I've seen all pass params from there.Nate
01/02/2025, 7:55 PMPOST /create_flow_run_from_deployment
and then poll for completion of the runNate
01/02/2025, 7:57 PMJoe
01/02/2025, 7:57 PMJoe
01/02/2025, 7:57 PMJoe
01/02/2025, 7:58 PMJoe
01/02/2025, 7:58 PMBecause the DaskTaskRunner uses multiprocessing, calls to flows in scripts must be guarded with if __name__ == "__main__": or you will encounter warnings and errors.
Nate
01/02/2025, 7:59 PMJoe
01/02/2025, 8:00 PMJoe
01/02/2025, 8:00 PMNate
01/02/2025, 8:01 PMJoe
01/02/2025, 8:02 PM