Sarah Floris
03/07/2022, 2:42 PMKevin Kho
Sarah Floris
03/07/2022, 2:46 PMKevin Kho
Client.create_flow_run(...)
With CLI
prefect run --project project_name --name flow_name
will trigger a run on CloudSarah Floris
03/07/2022, 3:02 PMSarah Floris
03/09/2022, 9:07 PMSarah Floris
03/09/2022, 9:08 PMKevin Kho
if ___name___ == ___main___
to register right?Sarah Floris
03/09/2022, 9:11 PMregistered_flow_id = flow.register(project_name="Development")
client.create_flow_run(flow_id=registered_flow_id)
Sarah Floris
03/09/2022, 9:11 PMKevin Kho
flow.register(build=False)
by default I guess?Kevin Kho
create_flow_run
? cuz you can use the task instead which is more flexible:
create_flow_run.run(project_name=...,flow_name=...)
Sarah Floris
03/09/2022, 9:17 PMKevin Kho
Sarah Floris
03/09/2022, 9:17 PMSarah Floris
03/09/2022, 9:18 PMKevin Kho
create_flow_run
is the newer taskKevin Kho
wait=True
. wait=False returns an id and wait=True returns a state.
So it was decoupled into create_flow_run
and wait_for_flow_run
but yes any task can be invoked as plain Python anyway with the run methodSarah Floris
03/10/2022, 3:37 PMKevin Kho
flow.serialized_hash()
. So you can try running this twice:
prefect register -p some_flow.py
and on the second one, it will not register because no changes were made. This is because the CLI uses flow.serialized_hash()
as an idempotency key. So if you try to register with the same idempotency key, it will just return the id of the old runKevin Kho
Sarah Floris
03/10/2022, 3:44 PMKevin Kho