Cormac
12/22/2023, 12:04 PMprefect.deployments.run_deployment
, but each instance of this blocks until the triggered deployment completes. I want to trigger all deployments, then poll them until they all complete...Kevin Grismore
12/22/2023, 12:34 PMCormac
12/22/2023, 12:36 PMrun_deployment()
... is that a potential approach?Kevin Grismore
12/22/2023, 12:37 PMgather
?Cormac
12/22/2023, 12:37 PMKevin Grismore
12/22/2023, 12:41 PMrun_deployment
is an async function, so if you call it from an async context without `await`ing it, it'll return a coroutine. gather
can accept many coroutines as input, and when gather
is `await`ed, it'll block until it has collected up the results of all those coroutines.Kevin Grismore
12/22/2023, 12:46 PMrun_deployment
inside a task and call the task with .submit()
to submit it to the concurrent task runnerKevin Grismore
12/22/2023, 12:47 PMCormac
12/22/2023, 12:49 PMasyncio
is more powerful, but has learning curve
⢠concurrent task runner is quicker, but less feature-rich
Many thanks. This was exactly the pointers I was hoping for.
I'll have a look and experiment with these options.Cormac
12/22/2023, 2:47 PM@task(log_prints=True)
def trigger_flow_deployment(nde_noop_elt_job_uuid, run_parameters):
rc = pd1.run_deployment(
name=nde_noop_elt_job_uuid,
parameters=run_parameters
)
return rc
invoked with
@flow(log_prints=True, task_runner=ConcurrentTaskRunner())
def async_manage_noop_dag_multi_task(<various args>) -> None:
...
<various setup stuff>
...
for rec in run_list:
run_parameters = <param builder>
rc = trigger_flow_deployment(nde_noop_elt_job_uuid, run_parameters).submit()
...
<some post-op stuff>
However when running, I see a failure log
AttributeError: 'FlowRun' object has no attribute 'submit'
... what am i missing.... šKevin Grismore
12/22/2023, 2:53 PMrc = trigger_flow_deployment.submit(nde_noop_elt_job_uuid, run_parameters)
Cormac
12/22/2023, 2:53 PMKevin Grismore
12/22/2023, 2:54 PMKevin Grismore
12/22/2023, 2:57 PMrun_deployment
returns a FlowRun
which you'll need to get the result fromCormac
12/22/2023, 2:58 PMCormac
12/22/2023, 3:19 PMAndrew Brookins
01/04/2024, 8:27 PMrun_deployment
returns immediately if you set the timeout to zero. This allows you to use it to start a flow run and save the ID without waiting for the run to complete. E.g., run_deployment(ā¦, timeout=0)