Principle:Apache Dolphinscheduler Physical Task Execution
| Knowledge Sources | |
|---|---|
| Domains | Task_Execution, Worker_Architecture |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
A lifecycle-managed task execution model where workers initialize, trigger, track, and finalize task plugins through a state machine with callback-based progress reporting to the master.
Description
The Physical Task Execution principle defines how worker nodes execute tasks dispatched from the master. The PhysicalTaskExecutor manages the complete lifecycle of a task on the worker: (1) initializeTaskPlugin creates the task plugin via factory, (2) doTriggerTaskPlugin calls the plugin's handle() method and reports lifecycle events, (3) doTrackTaskPluginStatus maps the plugin's exit status to a TaskExecutorState, (4) pause/kill delegate to the underlying plugin, and (5) finalizeTask cleans up resources.
Each lifecycle transition generates a lifecycle event that is reported back to the master via RPC, enabling the master to track task progress and trigger downstream tasks.
Usage
The PhysicalTaskExecutor is created by the worker when it receives a task dispatch request. It wraps the type-specific task plugin (Shell, SQL, Python, etc.) and manages its execution lifecycle.
Theoretical Basis
The execution model follows a State Machine Pattern with lifecycle callbacks:
// Task execution state machine
DISPATCHED -> RUNNING -> SUCCESS | FAILED | KILLED | PAUSED
// Lifecycle methods
initializeTaskPlugin() // DISPATCHED: create plugin instance
doTriggerTaskPlugin() // DISPATCHED -> RUNNING: execute plugin
doTrackTaskPluginStatus() // RUNNING -> terminal: check plugin result
pause() / kill() // RUNNING -> PAUSED/KILLED: control operations
finalizeTask() // terminal: cleanup resources
// Each transition fires a lifecycle event via RPC to master