diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java index 9b507500b9..e5cfd66f12 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/MasterServer.java @@ -31,6 +31,7 @@ import org.apache.dolphinscheduler.plugin.storage.api.StorageConfiguration; import org.apache.dolphinscheduler.plugin.task.api.TaskPluginManager; import org.apache.dolphinscheduler.registry.api.RegistryConfiguration; import org.apache.dolphinscheduler.scheduler.api.SchedulerApi; +import org.apache.dolphinscheduler.server.master.config.MasterConfig; import org.apache.dolphinscheduler.server.master.metrics.MasterServerMetrics; import org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient; import org.apache.dolphinscheduler.server.master.registry.MasterSlotManager; @@ -91,6 +92,9 @@ public class MasterServer implements IStoppable { @Autowired private TaskGroupCoordinator taskGroupCoordinator; + @Autowired + private MasterConfig masterConfig; + public static void main(String[] args) { MasterServerMetrics.registerUncachedException(DefaultUncaughtExceptionHandler::getUncaughtExceptionCount); @@ -122,7 +126,9 @@ public class MasterServer implements IStoppable { this.eventExecuteService.start(); this.failoverExecuteThread.start(); - this.schedulerApi.start(); + if (masterConfig.isSchedulerEnabled()) { + this.schedulerApi.start(); + } this.taskGroupCoordinator.start(); MasterServerMetrics.registerMasterCpuUsageGauge(() -> { diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterConfig.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterConfig.java index d9e6ab3b7d..98221b8b7f 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterConfig.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/config/MasterConfig.java @@ -83,6 +83,10 @@ public class MasterConfig implements Validator { * task submit retry interval. */ private Duration taskCommitInterval = Duration.ofSeconds(1); + /** + * if scheduler is enabled to schedule job on master + */ + private boolean schedulerEnabled = true; /** * state wheel check interval, if this value is bigger, may increase the delay of task/processInstance. */ diff --git a/dolphinscheduler-master/src/main/resources/application.yaml b/dolphinscheduler-master/src/main/resources/application.yaml index 17b1e41a71..cef38a7644 100644 --- a/dolphinscheduler-master/src/main/resources/application.yaml +++ b/dolphinscheduler-master/src/main/resources/application.yaml @@ -83,6 +83,8 @@ registry: master: listen-port: 5678 + # Whether to enable the master trigger scheduler. + scheduler-enabled: true # master prepare execute thread number to limit handle commands in parallel pre-exec-threads: 10 # master execute thread number to limit process instances in parallel