__call__
), but they will not run concurrently.
.submit
.submit()
method.
ThreadPoolTaskRunner
, which runs tasks concurrently in a thread pool.
task_runner
argument to the @flow
decorator.
prefect[dask]
extraPrefectFuture
object back which you can use to track the task’s execution. Use the .result()
method to get the result of the task.
.wait()
method to wait for execution to complete.
wait()
utility.
PrefectFuture
objects between tasks or flows, the task or flow receiving the future will wait for the future to complete before starting execution..map
.map()
method.
.submit
, .map
uses the task runner configured on the parent flow. Changing the task runner will change where mapped tasks are executed.
unmapped
annotationunmapped
is not required):
unmapped
to tell .map
to treat it
as static:
PrefectFuture
operations.map
as in the above example, the result of the task is a list of futures.
You can wait for or retrieve the results from these futures with wait
or result
methods:
Output
wait_for=[]
parameter
when calling a task by specifying upstream task dependencies. This enables you to control task execution
order for tasks that do not share data dependencies.
wait()
utility along with the .state
attribute on futures:
wait()
function returns two sets of futures: done
and not_done
. Each future has a .state
attribute you can inspect to determine how the associated task run’s result (or exception) should be treated downstream.
asyncio
asyncio
from the Python standard library to run them concurrently.
Output