Browse Source

[fix-12687]when timeout_notify_strategy is null, modify timeout_notify_strategy (#12689)

* According to timeoutFlag, assign timeoutNotifyStrategy value

Co-authored-by: fanwanlong <fanwanlong@kezaihui.com>
3.2.0-release
jackfanwan 2 years ago committed by GitHub
parent
commit
641a2559ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
  2. 5
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java
  3. 39
      dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java

1
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java

@ -355,6 +355,7 @@ public enum Status {
PROJECT_PROCESS_NOT_MATCH(50054, "the project and the process is not match", "项目和工作流不匹配"), PROJECT_PROCESS_NOT_MATCH(50054, "the project and the process is not match", "项目和工作流不匹配"),
DELETE_EDGE_ERROR(50055, "delete edge error", "删除工作流任务连接线错误"), DELETE_EDGE_ERROR(50055, "delete edge error", "删除工作流任务连接线错误"),
NOT_SUPPORT_UPDATE_TASK_DEFINITION(50056, "task state does not support modification", "当前任务不支持修改"), NOT_SUPPORT_UPDATE_TASK_DEFINITION(50056, "task state does not support modification", "当前任务不支持修改"),
TASK_DEFINITION_NOT_MODIFY_ERROR(50057, "task [{0}] definition not modify error", "任务[{0}]定义未修改错误"),
BATCH_EXECUTE_PROCESS_INSTANCE_ERROR(50058, "change process instance status error: {0}", "修改工作实例状态错误: {0}"), BATCH_EXECUTE_PROCESS_INSTANCE_ERROR(50058, "change process instance status error: {0}", "修改工作实例状态错误: {0}"),
START_TASK_INSTANCE_ERROR(50059, "start task instance error", "运行任务流实例错误"), START_TASK_INSTANCE_ERROR(50059, "start task instance error", "运行任务流实例错误"),
DELETE_PROCESS_DEFINE_ERROR(50060, "delete process definition [{0}] error: {1}", "删除工作流定义[{0}]错误: {1}"), DELETE_PROCESS_DEFINE_ERROR(50060, "delete process definition [{0}] error: {1}", "删除工作流定义[{0}]错误: {1}"),

5
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskDefinitionServiceImpl.java

@ -46,6 +46,7 @@ import org.apache.dolphinscheduler.common.enums.ConditionType;
import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType; import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException;
import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
@ -716,8 +717,12 @@ public class TaskDefinitionServiceImpl extends BaseServiceImpl implements TaskDe
} }
TaskDefinitionLog taskDefinitionToUpdate = TaskDefinitionLog taskDefinitionToUpdate =
JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class); JSONUtils.parseObject(taskDefinitionJsonObj, TaskDefinitionLog.class);
if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) {
taskDefinition.setTimeoutNotifyStrategy(null);
}
if (taskDefinition.equals(taskDefinitionToUpdate)) { if (taskDefinition.equals(taskDefinitionToUpdate)) {
logger.warn("Task definition does not need update because no change, taskDefinitionCode:{}.", taskCode); logger.warn("Task definition does not need update because no change, taskDefinitionCode:{}.", taskCode);
putMsg(result, Status.TASK_DEFINITION_NOT_MODIFY_ERROR, String.valueOf(taskCode));
return null; return null;
} }
if (taskDefinitionToUpdate == null) { if (taskDefinitionToUpdate == null) {

39
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/vo/TaskDefinitionVo.java

@ -17,6 +17,7 @@
package org.apache.dolphinscheduler.api.vo; package org.apache.dolphinscheduler.api.vo;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
@ -24,6 +25,8 @@ import java.util.List;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils;
/** /**
* @author fanwanlong * @author fanwanlong
*/ */
@ -44,38 +47,10 @@ public class TaskDefinitionVo extends TaskDefinition {
public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) { public static TaskDefinitionVo fromTaskDefinition(TaskDefinition taskDefinition) {
TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo(); TaskDefinitionVo taskDefinitionVo = new TaskDefinitionVo();
taskDefinitionVo.setId(taskDefinition.getId()); BeanUtils.copyProperties(taskDefinition, taskDefinitionVo);
taskDefinitionVo.setCode(taskDefinition.getCode()); if (TimeoutFlag.CLOSE == taskDefinition.getTimeoutFlag()) {
taskDefinitionVo.setName(taskDefinition.getName()); taskDefinitionVo.setTimeoutNotifyStrategy(null);
taskDefinitionVo.setVersion(taskDefinition.getVersion()); }
taskDefinitionVo.setDescription(taskDefinition.getDescription());
taskDefinitionVo.setProjectCode(taskDefinition.getProjectCode());
taskDefinitionVo.setUserId(taskDefinition.getUserId());
taskDefinitionVo.setTaskType(taskDefinition.getTaskType());
taskDefinitionVo.setTaskParams(taskDefinition.getTaskParams());
taskDefinitionVo.setTaskParamList(taskDefinition.getTaskParamList());
taskDefinitionVo.setTaskParamMap(taskDefinition.getTaskParamMap());
taskDefinitionVo.setFlag(taskDefinition.getFlag());
taskDefinitionVo.setTaskPriority(taskDefinition.getTaskPriority());
taskDefinitionVo.setUserName(taskDefinition.getUserName());
taskDefinitionVo.setProjectName(taskDefinition.getProjectName());
taskDefinitionVo.setWorkerGroup(taskDefinition.getWorkerGroup());
taskDefinitionVo.setEnvironmentCode(taskDefinition.getEnvironmentCode());
taskDefinitionVo.setFailRetryTimes(taskDefinition.getFailRetryTimes());
taskDefinitionVo.setFailRetryInterval(taskDefinition.getFailRetryInterval());
taskDefinitionVo.setTimeoutFlag(taskDefinition.getTimeoutFlag());
taskDefinitionVo.setTimeoutNotifyStrategy(taskDefinition.getTimeoutNotifyStrategy());
taskDefinitionVo.setTimeout(taskDefinition.getTimeout());
taskDefinitionVo.setDelayTime(taskDefinition.getDelayTime());
taskDefinitionVo.setResourceIds(taskDefinition.getResourceIds());
taskDefinitionVo.setCreateTime(taskDefinition.getCreateTime());
taskDefinitionVo.setUpdateTime(taskDefinition.getUpdateTime());
taskDefinitionVo.setModifyBy(taskDefinition.getModifyBy());
taskDefinitionVo.setTaskGroupId(taskDefinition.getTaskGroupId());
taskDefinitionVo.setTaskGroupPriority(taskDefinition.getTaskGroupPriority());
taskDefinitionVo.setCpuQuota(taskDefinition.getCpuQuota());
taskDefinitionVo.setMemoryMax(taskDefinition.getMemoryMax());
taskDefinitionVo.setTaskExecuteType(taskDefinition.getTaskExecuteType());
return taskDefinitionVo; return taskDefinitionVo;
} }

Loading…
Cancel
Save