The Worker server. Receives task-dispatch RPCs from the master, spins up the right task plugin, runs the physical task, and ships lifecycle events back. Multiple workers scale horizontally; each registers with the registry and advertises its worker group.
WorkerServer — @SpringBootApplication, implements IStoppable.
org.apache.dolphinscheduler.server.worker
server.worker.executor— the bridge todolphinscheduler-task-executor.PhysicalTaskEngineDelegator,PhysicalTaskExecutorFactory,PhysicalTaskExecutorLifecycleEventReporter.server.worker.rpc—WorkerRpcServer+ operators implementingIPhysicalTaskExecutorOperator,IStreamingTaskInstanceOperator,ITaskExecutorQueryClient(all fromdolphinscheduler-extract-worker).server.worker.registry—WorkerRegistryClient: ephemeral registration, health status reporting, worker-group membership.server.worker.task— task-context utilities shared by all task plugins.server.worker.metrics— Worker Micrometer metrics.server.worker.config— worker config + load protection.
WorkerServerLoadProtection watches CPU / memory / task-count and rejects new dispatches above thresholds (driven by properties in application.yaml). Rejected dispatches bounce back to the master, which picks a different worker.
- Master sends a
DispatchTaskRequest→WorkerRpcServerreceives. PhysicalTaskExecutorFactorybuilds aPhysicalTaskExecutor(lives intask-executor) around the task plugin (fromtask-plugin).TaskExecutorContainerruns it; lifecycle events land on the in-process bus.PhysicalTaskExecutorLifecycleEventReporterpublishes events back to master over RPC.
- Tasks run in the worker JVM for most plugins (shell, SQL, Python, HTTP, …). Plugins that submit remotely (Spark, Flink, K8s, EMR) still need the worker to stay alive until the remote job completes — a worker restart mid-flight triggers the master's failover path.
- AWS S3 integration is direct (via
dolphinscheduler-storage-s3) for distributed-task artifact handling. Credentials followdolphinscheduler-aws-authenticationrules. dolphinscheduler-yarn-aopis on the worker's classpath: it weavesYarnClientImpl.submitApplicationto captureApplicationIds intoappInfo.log. If YARN-based task plugins (MR, Spark-on-YARN) lose their application ID, check AspectJ weaving is active.- Worker group names are not free-form in practice: master-side scheduling decisions key off them. Coordinate naming with master operators.
- Load protection thresholds live in
application.yaml, not indolphinscheduler-meter. Meter defines the interface; worker owns the numbers.
src/main/resources:
application.yaml— worker resource limits, executor thread pools, task-type enable list, load-protection thresholds.logback-spring.xml,banner.txt.
src/test/java — unit tests for registry, RPC, load protection, connection-state handling. End-to-end workflows are exercised by dolphinscheduler-e2e and the master's integration tests.
dolphinscheduler-task-executor— the lifecycle framework.dolphinscheduler-task-plugin— the actual task implementations (runtime classpath viadolphinscheduler-task-all).dolphinscheduler-extract-worker— RPCs this module implements.dolphinscheduler-extract-master/-extract-alert— RPCs this module calls.dolphinscheduler-yarn-aop— AspectJ weaving on the classpath.dolphinscheduler-registry-all,dolphinscheduler-storage-api,dolphinscheduler-datasource-api.