mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-04 21:28:00 +08:00
Set master's task running status in runTask
to avoid the task group acquire failed, but the task status is in running (#11451) (#12011)
(cherry picked from commit 05589606a2
)
This commit is contained in:
parent
5df86d0b7e
commit
041e1fd3e6
@ -110,19 +110,21 @@ public class BlockingTaskProcessor extends BaseTaskProcessor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setTaskExecutionLogger();
|
this.setTaskExecutionLogger();
|
||||||
initTaskParameters();
|
logger.info("blocking task submit success");
|
||||||
logger.info("blocking task start");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean runTask() {
|
protected boolean runTask() {
|
||||||
|
logger.info("blocking task starting");
|
||||||
|
initTaskParameters();
|
||||||
if (conditionResult.equals(DependResult.WAITING)) {
|
if (conditionResult.equals(DependResult.WAITING)) {
|
||||||
setConditionResult();
|
setConditionResult();
|
||||||
endTask();
|
endTask();
|
||||||
} else {
|
} else {
|
||||||
endTask();
|
endTask();
|
||||||
}
|
}
|
||||||
|
logger.info("blocking task finished");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,19 +67,21 @@ public class ConditionTaskProcessor extends BaseTaskProcessor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setTaskExecutionLogger();
|
this.setTaskExecutionLogger();
|
||||||
initTaskParameters();
|
logger.info("condition task submit success");
|
||||||
logger.info("condition task start");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean runTask() {
|
public boolean runTask() {
|
||||||
|
initTaskParameters();
|
||||||
|
logger.info("condition task start");
|
||||||
if (conditionResult.equals(DependResult.WAITING)) {
|
if (conditionResult.equals(DependResult.WAITING)) {
|
||||||
setConditionResult();
|
setConditionResult();
|
||||||
endTask();
|
endTask();
|
||||||
} else {
|
} else {
|
||||||
endTask();
|
endTask();
|
||||||
}
|
}
|
||||||
|
logger.info("condition task finished");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,8 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.dolphinscheduler.server.master.runner.task;
|
package org.apache.dolphinscheduler.server.master.runner.task;
|
||||||
|
|
||||||
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SWITCH;
|
import com.google.auto.service.AutoService;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.dolphinscheduler.common.utils.JSONUtils;
|
import org.apache.dolphinscheduler.common.utils.JSONUtils;
|
||||||
import org.apache.dolphinscheduler.common.utils.NetUtils;
|
import org.apache.dolphinscheduler.common.utils.NetUtils;
|
||||||
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
||||||
@ -30,9 +31,6 @@ import org.apache.dolphinscheduler.plugin.task.api.parameters.SwitchParameters;
|
|||||||
import org.apache.dolphinscheduler.server.utils.LogUtils;
|
import org.apache.dolphinscheduler.server.utils.LogUtils;
|
||||||
import org.apache.dolphinscheduler.server.utils.SwitchTaskUtils;
|
import org.apache.dolphinscheduler.server.utils.SwitchTaskUtils;
|
||||||
|
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -41,7 +39,7 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SWITCH;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* switch task processor
|
* switch task processor
|
||||||
@ -64,7 +62,15 @@ public class SwitchTaskProcessor extends BaseTaskProcessor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.setTaskExecutionLogger();
|
this.setTaskExecutionLogger();
|
||||||
taskInstance.setLogPath(LogUtils.getTaskLogPath(taskInstance.getFirstSubmitTime(), processInstance.getProcessDefinitionCode(),
|
logger.info("switch task submit success");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean runTask() {
|
||||||
|
logger.info("switch task starting");
|
||||||
|
taskInstance.setLogPath(
|
||||||
|
LogUtils.getTaskLogPath(taskInstance.getFirstSubmitTime(), processInstance.getProcessDefinitionCode(),
|
||||||
processInstance.getProcessDefinitionVersion(),
|
processInstance.getProcessDefinitionVersion(),
|
||||||
taskInstance.getProcessInstanceId(),
|
taskInstance.getProcessInstanceId(),
|
||||||
taskInstance.getId()));
|
taskInstance.getId()));
|
||||||
@ -72,21 +78,12 @@ public class SwitchTaskProcessor extends BaseTaskProcessor {
|
|||||||
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
|
taskInstance.setState(ExecutionStatus.RUNNING_EXECUTION);
|
||||||
taskInstance.setStartTime(new Date());
|
taskInstance.setStartTime(new Date());
|
||||||
processService.updateTaskInstance(taskInstance);
|
processService.updateTaskInstance(taskInstance);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
if (!this.taskInstance().getState().typeIsFinished()) {
|
||||||
public boolean runTask() {
|
setSwitchResult();
|
||||||
try {
|
}
|
||||||
if (!this.taskInstance().getState().typeIsFinished() && setSwitchResult()) {
|
|
||||||
endTaskState();
|
endTaskState();
|
||||||
}
|
logger.info("switch task finished");
|
||||||
} catch (Exception e) {
|
|
||||||
logger.error("update work flow {} switch task {} state error:",
|
|
||||||
this.processInstance.getId(),
|
|
||||||
this.taskInstance.getId(),
|
|
||||||
e);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user