ruanwenjun commented on code in PR #11864:
URL: https://github.com/apache/dolphinscheduler/pull/11864#discussion_r966056315
##########
dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/event/TaskTimeoutStateEventHandler.java:
##########
@@ -34,29 +34,34 @@ public class TaskTimeoutStateEventHandler implements
StateEventHandler {
@Override
public boolean handleStateEvent(WorkflowExecuteRunnable
workflowExecuteRunnable,
- StateEvent stateEvent) throws
StateEventHandleError {
+ StateEvent stateEvent) throws StateEventHandleError {
TaskStateEvent taskStateEvent = (TaskStateEvent) stateEvent;
TaskMetrics.incTaskInstanceByState("timeout");
workflowExecuteRunnable.checkTaskInstanceByStateEvent(taskStateEvent);
TaskInstance taskInstance =
-
workflowExecuteRunnable.getTaskInstance(taskStateEvent.getTaskInstanceId()).orElseThrow(
- () -> new StateEventHandleError(String.format(
- "Cannot find the task instance from workflow
execute runnable, taskInstanceId: %s",
- taskStateEvent.getTaskInstanceId())));
+
workflowExecuteRunnable.getTaskInstance(taskStateEvent.getTaskInstanceId()).orElseThrow(
+ () -> new StateEventHandleError(String.format(
+ "Cannot find the task instance from workflow execute
runnable, taskInstanceId: %s",
+ taskStateEvent.getTaskInstanceId())));
if (TimeoutFlag.CLOSE ==
taskInstance.getTaskDefine().getTimeoutFlag()) {
return true;
}
- TaskTimeoutStrategy taskTimeoutStrategy =
taskInstance.getTaskDefine().getTimeoutNotifyStrategy();
- Map<Long, ITaskProcessor> activeTaskProcessMap =
workflowExecuteRunnable.getActiveTaskProcessMap();
- if (TaskTimeoutStrategy.FAILED == taskTimeoutStrategy
- || TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy) {
- ITaskProcessor taskProcessor =
activeTaskProcessMap.get(taskInstance.getTaskCode());
- taskProcessor.action(TaskAction.TIMEOUT);
+ TaskTimeoutStrategy taskTimeoutStrategy = taskInstance.getTaskDefine()
+ .getTimeoutNotifyStrategy();
+ Map<Long, ITaskProcessor> activeTaskProcessMap =
workflowExecuteRunnable
+ .getActiveTaskProcessMap();
+ if ((TaskTimeoutStrategy.FAILED == taskTimeoutStrategy
+ || TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy)) {
+ if (activeTaskProcessMap.containsKey(taskInstance.getTaskCode())) {
Review Comment:
In which case the `taskProcessor` will be null? if it's null we need to
throw error?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]