Python SDK Reference
task_worker
prefect.task_worker
Functions
should_try_to_read_parameters
Determines whether a task run should read parameters from the result store.
create_status_server
Classes
StopTaskWorker
Raised when the task worker is stopped.
TaskWorker
This class is responsible for serving tasks that may be executed in the background by a task runner via the traditional engine machinery.
When start()
is called, the task worker will open a websocket connection to a
server-side queue of scheduled task runs. When a scheduled task run is found, the
scheduled task run is submitted to the engine for execution with a minimal EngineContext
so that the task run can be governed by orchestration rules.
Args:
-
: A list of tasks to serve. These tasks will be submitted to the engine when a scheduled task run is found.-
: The maximum number of tasks that can be run concurrently. Defaults to 10. PassNone
to remove the limit.
Methods:
client_id
started_at
started
limit
current_tasks
available_tasks
handle_sigterm
Shuts down the task worker when a SIGTERM is received.