From 031f71b8764a1c66b65ba61fe8f271433e5615b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=B9=89=E8=B6=85?= Date: Sat, 11 Apr 2026 23:26:37 +0800 Subject: [PATCH 1/3] Clean up unused methods and classes --- .../engine/exceptions/TaskKillException.java | 4 -- .../engine/exceptions/TaskPauseException.java | 4 -- .../TaskReassignMasterHostException.java | 4 -- ...cutionGraphInitializeFailureException.java | 32 ------------- .../system/SystemEventBusFireWorker.java | 4 -- ...askExecutionRunnableLifecycleListener.java | 45 ------------------- .../runnable/AbstractTaskInstanceFactory.java | 6 --- .../statemachine/AbstractTaskStateAction.java | 4 -- ...WorkflowFinalizeLifecycleEventHandler.java | 11 ----- .../WorkflowSuccessLifecycleListener.java | 4 -- .../runnable/IWorkflowExecutionRunnable.java | 5 --- .../runnable/WorkflowExecutionRunnable.java | 8 ---- .../WorkflowExecutionRunnableFactory.java | 4 -- .../LogicTaskInitializeException.java | 4 -- .../exception/MasterTaskExecuteException.java | 5 +-- .../TaskExecuteRunnableCreateException.java | 30 ------------- .../exception/WorkflowCreateException.java | 29 ------------ .../master/rpc/WorkflowMetricServiceImpl.java | 37 --------------- .../server/master/utils/ExceptionUtils.java | 9 ---- .../master/utils/WorkflowInstanceUtils.java | 2 - 20 files changed, 1 insertion(+), 250 deletions(-) delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/WorkflowExecutionGraphInitializeFailureException.java delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionRunnableLifecycleListener.java delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/TaskExecuteRunnableCreateException.java delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/WorkflowCreateException.java delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/WorkflowMetricServiceImpl.java diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java index 01a7ee953a9e..4698e44bcd60 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java @@ -19,10 +19,6 @@ public class TaskKillException extends RuntimeException { - public TaskKillException(String message) { - super(message); - } - public TaskKillException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java index 5d61c11c3df9..f0eb1c098f7d 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java @@ -19,10 +19,6 @@ public class TaskPauseException extends RuntimeException { - public TaskPauseException(String message) { - super(message); - } - public TaskPauseException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java index 0e44e7af6478..fc6748490869 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java @@ -19,10 +19,6 @@ public class TaskReassignMasterHostException extends RuntimeException { - public TaskReassignMasterHostException(String message) { - super(message); - } - public TaskReassignMasterHostException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/WorkflowExecutionGraphInitializeFailureException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/WorkflowExecutionGraphInitializeFailureException.java deleted file mode 100644 index 98bfc2185b18..000000000000 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/WorkflowExecutionGraphInitializeFailureException.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.dolphinscheduler.server.master.engine.exceptions; - -import org.apache.dolphinscheduler.dao.entity.TaskInstance; - -public class WorkflowExecutionGraphInitializeFailureException extends RuntimeException { - - public WorkflowExecutionGraphInitializeFailureException(String message) { - super(message); - } - - public static WorkflowExecutionGraphInitializeFailureException bootstrapTaskStateNotValid(TaskInstance taskInstance) { - return new WorkflowExecutionGraphInitializeFailureException( - "The task: " + taskInstance.getName() + " state: " + taskInstance.getState() + " is not valid"); - } -} diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/system/SystemEventBusFireWorker.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/system/SystemEventBusFireWorker.java index 7a8cc6ef6712..7ebad89af652 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/system/SystemEventBusFireWorker.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/system/SystemEventBusFireWorker.java @@ -22,7 +22,6 @@ import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.server.master.engine.system.event.AbstractSystemEvent; import org.apache.dolphinscheduler.server.master.engine.system.event.ISystemEventHandler; -import org.apache.dolphinscheduler.server.master.failover.FailoverCoordinator; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.time.StopWatch; @@ -43,9 +42,6 @@ public class SystemEventBusFireWorker extends BaseDaemonThread implements AutoCl @Autowired private SystemEventBus systemEventBus; - @Autowired - private FailoverCoordinator failoverCoordinator; - @Autowired private List systemEventHandlers; diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionRunnableLifecycleListener.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionRunnableLifecycleListener.java deleted file mode 100644 index 295d26b64025..000000000000 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionRunnableLifecycleListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.dolphinscheduler.server.master.engine.task.listener; - -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskDispatchedLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskFailedLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskKilledLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskPausedLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskRunningLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskSuccessLifecycleEvent; - -/** - * Todo: this interface is used to listen to the lifecycle of the task execution runnable. - * We should use this to listen the state and trigger alert - */ -public interface ITaskExecutionRunnableLifecycleListener { - - void onDispatched(TaskDispatchedLifecycleEvent taskDispatchedEvent); - - void onRunning(TaskRunningLifecycleEvent event); - - void onPaused(TaskPausedLifecycleEvent event); - - void onFailed(TaskFailedLifecycleEvent event); - - void onKilled(TaskKilledLifecycleEvent event); - - void onSuccess(TaskSuccessLifecycleEvent event); - -} diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/runnable/AbstractTaskInstanceFactory.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/runnable/AbstractTaskInstanceFactory.java index 160d0d56af7b..50de683b75b8 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/runnable/AbstractTaskInstanceFactory.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/runnable/AbstractTaskInstanceFactory.java @@ -20,19 +20,13 @@ import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; -import org.apache.dolphinscheduler.dao.mapper.EnvironmentMapper; import org.apache.dolphinscheduler.dao.utils.EnvironmentUtils; import org.apache.dolphinscheduler.dao.utils.WorkerGroupUtils; -import org.springframework.beans.factory.annotation.Autowired; - public abstract class AbstractTaskInstanceFactory implements ITaskInstanceFactory { - @Autowired - protected EnvironmentMapper environmentMapper; - protected TaskInstance cloneTaskInstance(TaskInstance originTaskInstance) { final TaskInstance result = new TaskInstance(); result.setId(originTaskInstance.getId()); diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/AbstractTaskStateAction.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/AbstractTaskStateAction.java index 88281145c67c..c89e3f58a88d 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/AbstractTaskStateAction.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/statemachine/AbstractTaskStateAction.java @@ -30,7 +30,6 @@ import org.apache.dolphinscheduler.plugin.task.api.utils.VarPoolUtils; import org.apache.dolphinscheduler.server.master.engine.AbstractLifecycleEvent; import org.apache.dolphinscheduler.server.master.engine.ITaskGroupCoordinator; -import org.apache.dolphinscheduler.server.master.engine.IWorkflowRepository; import org.apache.dolphinscheduler.server.master.engine.graph.IWorkflowExecutionGraph; import org.apache.dolphinscheduler.server.master.engine.task.client.ITaskExecutorClient; import org.apache.dolphinscheduler.server.master.engine.task.lifecycle.event.TaskDispatchLifecycleEvent; @@ -66,9 +65,6 @@ public abstract class AbstractTaskStateAction implements ITaskStateAction { @Autowired protected TaskInstanceDao taskInstanceDao; - @Autowired - protected IWorkflowRepository workflowRepository; - @Autowired protected ITaskExecutorClient taskExecutorClient; diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java index a3ab68c873d8..f5c490d0ea1f 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java @@ -18,8 +18,6 @@ package org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.handler; import org.apache.dolphinscheduler.server.master.engine.ILifecycleEventType; -import org.apache.dolphinscheduler.server.master.engine.IWorkflowRepository; -import org.apache.dolphinscheduler.server.master.engine.WorkflowEventBusCoordinator; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.WorkflowLifecycleEventType; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowFinalizeLifecycleEvent; import org.apache.dolphinscheduler.server.master.engine.workflow.runnable.IWorkflowExecutionRunnable; @@ -27,8 +25,6 @@ import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; /** @@ -40,13 +36,6 @@ public class WorkflowFinalizeLifecycleEventHandler extends AbstractWorkflowLifecycleEventHandler { - @Lazy - @Autowired - private WorkflowEventBusCoordinator workflowEventBusCoordinator; - - @Autowired - private IWorkflowRepository workflowRepository; - @Override public void handle(final IWorkflowStateAction workflowStateAction, final IWorkflowExecutionRunnable workflowExecutionRunnable, diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java index 21a44e2db93c..d9de8a0a8d0b 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java @@ -22,7 +22,6 @@ import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; -import org.apache.dolphinscheduler.dao.repository.CommandDao; import org.apache.dolphinscheduler.extract.master.command.BackfillWorkflowCommandParam; import org.apache.dolphinscheduler.extract.master.command.ICommandParam; import org.apache.dolphinscheduler.extract.master.transportor.workflow.WorkflowBackfillTriggerRequest; @@ -48,9 +47,6 @@ public class WorkflowSuccessLifecycleListener implements IWorkflowLifecycleListe @Autowired private WorkflowBackfillTrigger workflowBackfillTrigger; - @Autowired - private CommandDao commandDao; - public void notifyWorkflowLifecycleEvent(final IWorkflowExecutionRunnable workflowExecutionRunnable, final AbstractWorkflowLifecycleLifecycleEvent lifecycleEvent) { final WorkflowInstance workflowInstance = workflowExecutionRunnable.getWorkflowInstance(); diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/IWorkflowExecutionRunnable.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/IWorkflowExecutionRunnable.java index c48d059592a6..b5682454ca01 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/IWorkflowExecutionRunnable.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/IWorkflowExecutionRunnable.java @@ -115,10 +115,5 @@ default IWorkflowExecutionGraph getWorkflowExecutionGraph() { */ List getWorkflowLifecycleListeners(); - /** - * Register a WorkflowInstanceLifecycleListener to the Workflow instance. - */ - void registerWorkflowInstanceLifecycleListener(IWorkflowLifecycleListener listener); - IWorkflowFailureStrategy getWorkflowFailureStrategy(); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnable.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnable.java index c819fecf8011..93b9a014ea40 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnable.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnable.java @@ -17,8 +17,6 @@ package org.apache.dolphinscheduler.server.master.engine.workflow.runnable; -import static com.google.common.base.Preconditions.checkArgument; - import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowPauseLifecycleEvent; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowStopLifecycleEvent; @@ -68,12 +66,6 @@ public List getWorkflowLifecycleListeners() { return workflowInstanceLifecycleListeners; } - @Override - public void registerWorkflowInstanceLifecycleListener(IWorkflowLifecycleListener listener) { - checkArgument(listener != null, "listener cannot be null"); - workflowInstanceLifecycleListeners.add(listener); - } - @Override public String toString() { final WorkflowInstance workflowInstance = workflowExecuteContext.getWorkflowInstance(); diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnableFactory.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnableFactory.java index 2f5b5841283a..da8225096862 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnableFactory.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/runnable/WorkflowExecutionRunnableFactory.java @@ -20,7 +20,6 @@ import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.repository.CommandDao; -import org.apache.dolphinscheduler.dao.repository.WorkflowInstanceDao; import org.apache.dolphinscheduler.server.master.engine.command.ICommandHandler; import org.apache.dolphinscheduler.server.master.engine.exceptions.CommandDuplicateHandleException; @@ -39,9 +38,6 @@ public class WorkflowExecutionRunnableFactory { @Autowired private List commandHandlers; - @Autowired - private WorkflowInstanceDao workflowInstanceDao; - @Autowired private CommandDao commandDao; diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java index d37a187f6199..d9f425f09d35 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java @@ -23,8 +23,4 @@ public LogicTaskInitializeException(String message) { super(message); } - public LogicTaskInitializeException(String message, Throwable cause) { - super(message, cause); - } - } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java index af1b0aa3db8e..5415042066a3 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java @@ -19,11 +19,8 @@ public class MasterTaskExecuteException extends MasterException { - public MasterTaskExecuteException(String message) { - super(message); - } - public MasterTaskExecuteException(String message, Throwable cause) { super(message, cause); } + } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/TaskExecuteRunnableCreateException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/TaskExecuteRunnableCreateException.java deleted file mode 100644 index c90c508ec8a5..000000000000 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/TaskExecuteRunnableCreateException.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.dolphinscheduler.server.master.exception; - -public class TaskExecuteRunnableCreateException extends MasterException { - - public TaskExecuteRunnableCreateException(String message) { - super(message); - } - - public TaskExecuteRunnableCreateException(String message, Throwable throwable) { - super(message, throwable); - } - -} diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/WorkflowCreateException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/WorkflowCreateException.java deleted file mode 100644 index a2f94984ede2..000000000000 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/WorkflowCreateException.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.dolphinscheduler.server.master.exception; - -public class WorkflowCreateException extends MasterException { - - public WorkflowCreateException(String message) { - super(message); - } - - public WorkflowCreateException(String message, Throwable throwable) { - super(message, throwable); - } -} diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/WorkflowMetricServiceImpl.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/WorkflowMetricServiceImpl.java deleted file mode 100644 index f5b0ce804717..000000000000 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/rpc/WorkflowMetricServiceImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.dolphinscheduler.server.master.rpc; - -import org.apache.dolphinscheduler.extract.master.IWorkflowMetricService; -import org.apache.dolphinscheduler.server.master.metrics.WorkflowInstanceMetrics; - -import lombok.extern.slf4j.Slf4j; - -import org.springframework.stereotype.Service; - -@Slf4j -@Service -public class WorkflowMetricServiceImpl implements IWorkflowMetricService { - - @Override - public void clearWorkflowMetrics(Long workflowDefinitionCode) { - log.info("Receive clearWorkflowMetrics request: {}", workflowDefinitionCode); - WorkflowInstanceMetrics.cleanUpWorkflowInstanceCountMetricsByDefinitionCode(workflowDefinitionCode); - } - -} diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/ExceptionUtils.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/ExceptionUtils.java index 5c1233f7dbf2..d9c977ffc9df 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/ExceptionUtils.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/ExceptionUtils.java @@ -18,8 +18,6 @@ package org.apache.dolphinscheduler.server.master.utils; import org.apache.dolphinscheduler.server.master.exception.TaskExecutionContextCreateException; -import org.apache.dolphinscheduler.server.master.exception.dispatch.NoAvailableWorkerException; -import org.apache.dolphinscheduler.server.master.exception.dispatch.WorkerGroupNotFoundException; import org.springframework.dao.DataAccessResourceFailureException; @@ -33,11 +31,4 @@ public static boolean isTaskExecutionContextCreateException(Throwable e) { return e instanceof TaskExecutionContextCreateException; } - public static boolean isWorkerGroupNotFoundException(Throwable e) { - return e instanceof WorkerGroupNotFoundException; - } - - public static boolean isNoAvailableWorkerException(Throwable e) { - return e instanceof NoAvailableWorkerException; - } } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/WorkflowInstanceUtils.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/WorkflowInstanceUtils.java index 4a5552aa2907..3ff727064fc6 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/WorkflowInstanceUtils.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/utils/WorkflowInstanceUtils.java @@ -21,7 +21,6 @@ import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; import org.apache.dolphinscheduler.server.master.engine.WorkflowEventBus; import org.apache.dolphinscheduler.server.master.engine.graph.IWorkflowExecutionGraph; -import org.apache.dolphinscheduler.server.master.engine.graph.IWorkflowGraph; import org.apache.dolphinscheduler.server.master.engine.task.runnable.ITaskExecutionRunnable; import org.apache.dolphinscheduler.server.master.engine.workflow.runnable.IWorkflowExecutionRunnable; import org.apache.dolphinscheduler.server.master.runner.IWorkflowExecuteContext; @@ -39,7 +38,6 @@ public class WorkflowInstanceUtils { public static String logWorkflowInstanceInDetails(IWorkflowExecutionRunnable workflowExecutionRunnable) { final IWorkflowExecuteContext workflowExecuteContext = workflowExecutionRunnable.getWorkflowExecuteContext(); final IWorkflowExecutionGraph workflowExecutionGraph = workflowExecuteContext.getWorkflowExecutionGraph(); - final IWorkflowGraph workflowGraph = workflowExecuteContext.getWorkflowGraph(); final WorkflowInstance workflowInstance = workflowExecuteContext.getWorkflowInstance(); final WorkflowEventBus workflowEventBus = workflowExecuteContext.getWorkflowEventBus(); From d8ba590699cec7c96d86f486f9f09e8f0687e26b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=B9=89=E8=B6=85?= Date: Wed, 15 Apr 2026 10:43:38 +0800 Subject: [PATCH 2/3] resolve conflicts --- .../task/listener/ITaskExecutionLifecycleListener.java | 0 .../handler/WorkflowFinalizeLifecycleEventHandler.java | 2 +- .../workflow/listener/WorkflowSuccessLifecycleListener.java | 5 +++-- 3 files changed, 4 insertions(+), 3 deletions(-) delete mode 100644 dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionLifecycleListener.java diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionLifecycleListener.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/task/listener/ITaskExecutionLifecycleListener.java deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java index cc213a309b44..381859acaa27 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/lifecycle/handler/WorkflowFinalizeLifecycleEventHandler.java @@ -18,9 +18,9 @@ package org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.handler; import org.apache.dolphinscheduler.server.master.engine.ILifecycleEventType; +import org.apache.dolphinscheduler.server.master.engine.workflow.execution.IWorkflowExecution; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.WorkflowLifecycleEventType; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowFinalizeLifecycleEvent; -import org.apache.dolphinscheduler.server.master.engine.workflow.runnable.IWorkflowExecutionRunnable; import org.apache.dolphinscheduler.server.master.engine.workflow.statemachine.IWorkflowStateAction; import lombok.extern.slf4j.Slf4j; diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java index 75bfd18428a3..498561545389 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/listener/WorkflowSuccessLifecycleListener.java @@ -47,9 +47,10 @@ public class WorkflowSuccessLifecycleListener implements IWorkflowLifecycleListe @Autowired private WorkflowBackfillTrigger workflowBackfillTrigger; - public void notifyWorkflowLifecycleEvent(final IWorkflowExecutionRunnable workflowExecutionRunnable, + @Override + public void notifyWorkflowLifecycleEvent(final IWorkflowExecution workflowExecution, final AbstractWorkflowLifecycleLifecycleEvent lifecycleEvent) { - final WorkflowInstance workflowInstance = workflowExecutionRunnable.getWorkflowInstance(); + final WorkflowInstance workflowInstance = workflowExecution.getWorkflowInstance(); if (Flag.YES == workflowInstance.getIsSubWorkflow()) { // The sub workflow does not need to generate the backfill command // Since the parent workflow will trigger the task to generate the sub workflow instance. From 7ad7730aee73c75aec496094eaccd851a7f9f21f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=B9=89=E8=B6=85?= Date: Wed, 15 Apr 2026 10:55:31 +0800 Subject: [PATCH 3/3] Revert some changes --- .../master/engine/exceptions/TaskKillException.java | 4 ++++ .../master/engine/exceptions/TaskPauseException.java | 4 ++++ .../exceptions/TaskReassignMasterHostException.java | 4 ++++ .../engine/workflow/execution/IWorkflowExecution.java | 5 +++++ .../engine/workflow/execution/WorkflowExecution.java | 8 ++++++++ .../master/exception/LogicTaskInitializeException.java | 4 ++++ .../master/exception/MasterTaskExecuteException.java | 4 ++++ 7 files changed, 33 insertions(+) diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java index 4698e44bcd60..01a7ee953a9e 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskKillException.java @@ -19,6 +19,10 @@ public class TaskKillException extends RuntimeException { + public TaskKillException(String message) { + super(message); + } + public TaskKillException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java index f0eb1c098f7d..5d61c11c3df9 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskPauseException.java @@ -19,6 +19,10 @@ public class TaskPauseException extends RuntimeException { + public TaskPauseException(String message) { + super(message); + } + public TaskPauseException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java index fc6748490869..0e44e7af6478 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/exceptions/TaskReassignMasterHostException.java @@ -19,6 +19,10 @@ public class TaskReassignMasterHostException extends RuntimeException { + public TaskReassignMasterHostException(String message) { + super(message); + } + public TaskReassignMasterHostException(String message, Throwable cause) { super(message, cause); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/IWorkflowExecution.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/IWorkflowExecution.java index 0e40d5bbfeea..2670c637538d 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/IWorkflowExecution.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/IWorkflowExecution.java @@ -115,5 +115,10 @@ default IWorkflowExecutionGraph getWorkflowExecutionGraph() { */ List getWorkflowLifecycleListeners(); + /** + * Register a WorkflowInstanceLifecycleListener to the Workflow instance. + */ + void registerWorkflowInstanceLifecycleListener(IWorkflowLifecycleListener listener); + IWorkflowFailureStrategy getWorkflowFailureStrategy(); } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/WorkflowExecution.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/WorkflowExecution.java index 5f596725a13d..e19f2a0fc681 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/WorkflowExecution.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/engine/workflow/execution/WorkflowExecution.java @@ -17,6 +17,8 @@ package org.apache.dolphinscheduler.server.master.engine.workflow.execution; +import static com.google.common.base.Preconditions.checkArgument; + import org.apache.dolphinscheduler.dao.entity.WorkflowInstance; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowPauseLifecycleEvent; import org.apache.dolphinscheduler.server.master.engine.workflow.lifecycle.event.WorkflowStopLifecycleEvent; @@ -66,6 +68,12 @@ public List getWorkflowLifecycleListeners() { return workflowInstanceLifecycleListeners; } + @Override + public void registerWorkflowInstanceLifecycleListener(IWorkflowLifecycleListener listener) { + checkArgument(listener != null, "listener cannot be null"); + workflowInstanceLifecycleListeners.add(listener); + } + @Override public String toString() { final WorkflowInstance workflowInstance = workflowExecuteContext.getWorkflowInstance(); diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java index d9f425f09d35..d37a187f6199 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/LogicTaskInitializeException.java @@ -23,4 +23,8 @@ public LogicTaskInitializeException(String message) { super(message); } + public LogicTaskInitializeException(String message, Throwable cause) { + super(message, cause); + } + } diff --git a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java index 5415042066a3..3ff52ee3c694 100644 --- a/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java +++ b/dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/exception/MasterTaskExecuteException.java @@ -19,6 +19,10 @@ public class MasterTaskExecuteException extends MasterException { + public MasterTaskExecuteException(String message) { + super(message); + } + public MasterTaskExecuteException(String message, Throwable cause) { super(message, cause); }