prefect.task_runners
TaskRunner
with
block to ensure
proper cleanup of resources.
Methods:
duplicate
map
task
: The task to submit.parameters
: The parameters to use when running the task.wait_for
: A list of futures that the task depends on.name
submit
submit
submit
ThreadPoolTaskRunner
cancel_all
duplicate
map
map
map
submit
submit
submit
task
: The task to submit.parameters
: The parameters to use when running the task.wait_for
: A list of futures that the task depends on.ProcessPoolTaskRunner
ProcessPoolExecutor
to run tasks in separate processes,
providing true parallelism for CPU-bound tasks and process isolation. Tasks
are executed with proper context propagation and error handling.
Examples:
Use a process pool task runner with a flow:
cancel_all
duplicate
map
map
map
submit
submit
submit
task
: The task to submit.parameters
: The parameters to use when running the task.wait_for
: A list of futures that the task depends on.dependencies
: A dictionary of dependencies for the task.PrefectTaskRunner
duplicate
map
map
map
submit
submit
submit
task
: The task to submit.parameters
: The parameters to use when running the task.wait_for
: A list of futures that the task depends on.