status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode()); if (processDefinition != null && projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode, processInstance.getProcessDefinitionCode()); putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId); return result; } Map<String, String> commandParam = JSONUtils.toMap(processInstance.getCommandParam()); String timezone = null; if (commandParam != null) { timezone = commandParam.get(Constants.SCHEDULE_TIMEZONE); } Map<String, String> timeParams = BusinessTimeUtils .getBusinessTime(processInstance.getCmdTypeIfComplement(), processInstance.getScheduleTime(), timezone); String userDefinedParams = processInstance.getGlobalParams(); List<Property> globalParams = new ArrayList<>(); String globalParamStr = ParameterUtils.convertParameterPlaceholders(JSONUtils.toJsonString(globalParams), timeParams); globalParams = JSONUtils.toList(globalParamStr, Property.class); for (Property property : globalParams) { timeParams.put(property.getProp(), property.getValue()); } if (userDefinedParams != null && userDefinedParams.length() > 0) { globalParams = JSONUtils.toList(userDefinedParams, Property.class); } Map<String, Map<String, Object>> localUserDefParams = getLocalParams(processInstance, timeParams); Map<String, Object> resultMap = new HashMap<>(); resultMap.put(GLOBAL_PARAMS, globalParams);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
resultMap.put(LOCAL_PARAMS, localUserDefParams); result.put(DATA_LIST, resultMap); putMsg(result, Status.SUCCESS); return result; } /** * get local params */ private Map<String, Map<String, Object>> getLocalParams(ProcessInstance processInstance, Map<String, String> timeParams) { Map<String, Map<String, Object>> localUserDefParams = new HashMap<>(); List<TaskInstance> taskInstanceList = taskInstanceMapper.findValidTaskListByProcessId(processInstance.getId(), Flag.YES, processInstance.getTestFlag()); for (TaskInstance taskInstance : taskInstanceList) { TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion( taskInstance.getTaskCode(), taskInstance.getTaskDefinitionVersion()); String localParams = JSONUtils.getNodeString(taskDefinitionLog.getTaskParams(), LOCAL_PARAMS); if (!StringUtils.isEmpty(localParams)) { localParams = ParameterUtils.convertParameterPlaceholders(localParams, timeParams); List<Property> localParamsList = JSONUtils.toList(localParams, Property.class); Map<String, Object> localParamsMap = new HashMap<>(); localParamsMap.put(TASK_TYPE, taskDefinitionLog.getTaskType()); localParamsMap.put(LOCAL_PARAMS_LIST, localParamsList); if (CollectionUtils.isNotEmpty(localParamsList)) { localUserDefParams.put(taskDefinitionLog.getName(), localParamsMap); } } } return localUserDefParams; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
/** * encapsulation gantt structure * * @param projectCode project code * @param processInstanceId process instance id * @return gantt tree data * @throws Exception exception when json parse */ @Override public Map<String, Object> viewGantt(long projectCode, Integer processInstanceId) throws Exception { Map<String, Object> result = new HashMap<>(); ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId); if (processInstance == null) { logger.error("Process instance does not exist, projectCode:{}, processInstanceId:{}.", projectCode, processInstanceId); putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId); return result; } ProcessDefinition processDefinition = processDefinitionLogMapper.queryByDefinitionCodeAndVersion( processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode, processInstance.getProcessDefinitionCode()); putMsg(result, PROCESS_INSTANCE_NOT_EXIST, processInstanceId); return result; } GanttDto ganttDto = new GanttDto(); DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition); List<String> nodeList = dag.topologicalSort(); ganttDto.setTaskNames(nodeList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
List<Task> taskList = new ArrayList<>(); if (!nodeList.isEmpty()) { List<Long> taskCodes = nodeList.stream().map(Long::parseLong).collect(Collectors.toList()); List<TaskInstance> taskInstances = taskInstanceMapper.queryByProcessInstanceIdsAndTaskCodes( Collections.singletonList(processInstanceId), taskCodes); for (String node : nodeList) { TaskInstance taskInstance = null; for (TaskInstance instance : taskInstances) { if (instance.getProcessInstanceId() == processInstanceId && instance.getTaskCode() == Long.parseLong(node)) { taskInstance = instance; break; } } if (taskInstance == null) { continue; } Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); Task task = new Task(); task.setTaskName(taskInstance.getName()); task.getStartDate().add(startTime.getTime()); task.getEndDate().add(endTime.getTime()); task.setIsoStart(startTime); task.setIsoEnd(endTime); task.setStatus(taskInstance.getState().getDesc().toUpperCase()); task.setExecutionDate(taskInstance.getStartTime()); task.setDuration(DateUtils.format2Readable(endTime.getTime() - startTime.getTime())); taskList.add(task); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
} ganttDto.setTasks(taskList); result.put(DATA_LIST, ganttDto); putMsg(result, Status.SUCCESS); return result; } /** * query process instance by processDefinitionCode and stateArray * * @param processDefinitionCode processDefinitionCode * @param states states array * @return process instance list */ @Override public List<ProcessInstance> queryByProcessDefineCodeAndStatus(Long processDefinitionCode, int[] states) { return processInstanceMapper.queryByProcessDefineCodeAndStatus(processDefinitionCode, states); } /** * query process instance by processDefinitionCode * * @param processDefinitionCode processDefinitionCode * @param size size * @return process instance list */ @Override public List<ProcessInstance> queryByProcessDefineCode(Long processDefinitionCode, int size) { return processInstanceMapper.queryByProcessDefineCode(processDefinitionCode, size); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
/* * 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.api.service; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.INSTANCE_UPDATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_INSTANCE; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.impl.LoggerServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProcessInstanceServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao; import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; import org.apache.dolphinscheduler.service.expand.CuringParamsService; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * process instance service test */ @RunWith(MockitoJUnitRunner.Silent.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
public class ProcessInstanceServiceTest { @InjectMocks ProcessInstanceServiceImpl processInstanceService; @Mock ProjectMapper projectMapper; @Mock ProjectServiceImpl projectService; @Mock ProcessService processService; @Mock
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
ProcessInstanceDao processInstanceDao; @Mock ProcessInstanceMapper processInstanceMapper; @Mock ProcessDefinitionLogMapper processDefinitionLogMapper; @Mock ProcessDefinitionMapper processDefineMapper; @Mock ProcessDefinitionService processDefinitionService; @Mock TaskInstanceMapper taskInstanceMapper; @Mock LoggerServiceImpl loggerService; @Mock UsersService usersService; @Mock TenantMapper tenantMapper; @Mock TaskDefinitionMapper taskDefinitionMapper; @Mock TaskPluginManager taskPluginManager; @Mock ScheduleMapper scheduleMapper; @Mock CuringParamsService curingGlobalParamsService; private String shellJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":123456789," + "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"},{\"name\":\"\",\"preTaskCode\":123456789," + "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"}]"; private String taskJson = "[{\"name\":\"shell1\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],"
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
+ "\"localParams\":[],\"rawScript\":\"echo 1\",\"conditionResult\":{\"successNode\":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}}," + "\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\"," + "\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"},{\"name\":\"shell2\",\"description\":\"\"," + "\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"conditionResult\":{\"successNode\"" + ":[\"\"],\"failedNode\":[\"\"]},\"dependence\":{}},\"flag\":\"NORMAL\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\"," + "\"failRetryTimes\":\"0\",\"failRetryInterval\":\"1\",\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"\",\"timeout\":null,\"delayTime\":\"0\"}]"; private String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":4254865123776,\"preTaskVersion\":1,\"postTaskCode\":4254862762304,\"postTaskVersion\":1,\"conditionType\":0," + "\"conditionParams\":{}},{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":4254865123776,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":{}}]"; private String taskDefinitionJson = "[{\"code\":4254862762304,\"name\":\"test1\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[]," + "\"localParams\":[],\"rawScript\":\"echo 1\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},\"switchResult\":{}},\"flag\":\"YES\"," + "\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":null,\"timeout\":0," + "\"environmentCode\":-1},{\"code\":4254865123776,\"name\":\"test2\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\",\"taskParams\":{\"resourceList\":[]," + "\"localParams\":[],\"rawScript\":\"echo 2\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},\"switchResult\":{}},\"flag\":\"YES\"," + "\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\",\"timeoutNotifyStrategy\":\"WARN\",\"timeout\":0," + "\"environmentCode\":-1}]"; @Test public void testQueryProcessInstanceList() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Result proejctAuthFailRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 46, "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", "test_user", WorkflowExecutionStatus.SUBMITTED_SUCCESS,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
"192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int) proejctAuthFailRes.getCode()); Date start = DateUtils.stringToDate("2020-01-01 00:00:00"); Date end = DateUtils.stringToDate("2020-01-02 00:00:00"); ProcessInstance processInstance = getProcessInstance(); List<ProcessInstance> processInstanceList = new ArrayList<>(); Page<ProcessInstance> pageReturn = new Page<>(1, 10); processInstanceList.add(processInstance); pageReturn.setRecords(processInstanceList); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(processDefineMapper.selectById(Mockito.anyInt())).thenReturn(getProcessDefinition()); when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), eq("192.168.xx.xx"), Mockito.any(), Mockito.any())).thenReturn(pageReturn); Result dataParameterRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "20200101 00:00:00", "20200102 00:00:00", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS, "192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR.getCode(), (int) dataParameterRes.getCode()); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(usersService.queryUser(loginUser.getId())).thenReturn(loginUser); when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(loginUser.getId()); when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()), eq(1L), eq(""), eq(-1), Mockito.any(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn); when(usersService.queryUser(processInstance.getExecutorId())).thenReturn(loginUser); Result successRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS, "192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) successRes.getCode()); when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()), eq(1L), eq(""), eq(-1), Mockito.any(), eq("192.168.xx.xx"), eq(null), eq(null))).thenReturn(pageReturn); successRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "", "", "", loginUser.getUserName(), WorkflowExecutionStatus.SUBMITTED_SUCCESS, "192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) successRes.getCode()); when(usersService.queryUser(loginUser.getId())).thenReturn(null); when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(-1); Result executorExistRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", "admin", WorkflowExecutionStatus.SUBMITTED_SUCCESS, "192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) executorExistRes.getCode()); when(processInstanceMapper.queryProcessInstanceListPaging(Mockito.any(Page.class), eq(project.getCode()), eq(1L), eq(""), eq(0), Mockito.any(), eq("192.168.xx.xx"), eq(start), eq(end))).thenReturn(pageReturn); Result executorEmptyRes = processInstanceService.queryProcessInstanceList(loginUser, projectCode, 1, "2020-01-01 00:00:00", "2020-01-02 00:00:00", "", "", WorkflowExecutionStatus.SUBMITTED_SUCCESS,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
"192.168.xx.xx", "", 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) executorEmptyRes.getCode()); } @Test public void testQueryTopNLongestRunningProcessInstance() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(5); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); int size = 10; String startTime = "2020-01-01 00:00:00"; String endTime = "2020-08-02 00:00:00"; Date start = DateUtils.stringToDate(startTime); Date end = DateUtils.stringToDate(endTime); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService .queryTopNLongestRunningProcessInstance(loginUser, projectCode, size, startTime, endTime); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); ProcessInstance processInstance = getProcessInstance(); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(usersService.queryUser(loginUser.getId())).thenReturn(loginUser); when(usersService.getUserIdByName(loginUser.getUserName())).thenReturn(loginUser.getId()); when(usersService.queryUser(processInstance.getExecutorId())).thenReturn(loginUser); Map<String, Object> successRes = processInstanceService.queryTopNLongestRunningProcessInstance(loginUser,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
projectCode, size, startTime, endTime); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testQueryProcessInstanceById() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); ProcessInstance processInstance = getProcessInstance(); putMsg(result, Status.SUCCESS, projectCode); ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setProjectCode(projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(processService.findProcessInstanceDetailById(processInstance.getId())) .thenReturn(Optional.of(processInstance)); when(processService.findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion())).thenReturn(processDefinition); Map<String, Object> successRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
Map<String, Object> workerNullRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, workerNullRes.get(Constants.STATUS)); WorkerGroup workerGroup = getWorkGroup(); Map<String, Object> workerExistRes = processInstanceService.queryProcessInstanceById(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, workerExistRes.get(Constants.STATUS)); } @Test public void testQueryTaskListByProcessId() throws IOException { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, 1); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); ProcessInstance processInstance = getProcessInstance(); processInstance.setState(WorkflowExecutionStatus.SUCCESS); TaskInstance taskInstance = new TaskInstance(); taskInstance.setId(0); taskInstance.setTaskType("SHELL"); List<TaskInstance> taskInstanceList = new ArrayList<>(); taskInstanceList.add(taskInstance); Result res = new Result();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
res.setCode(Status.SUCCESS.ordinal()); res.setData("xxx"); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(processService.findProcessInstanceDetailById(processInstance.getId())).thenReturn(Optional.of(processInstance)); when(processService.findValidTaskListByProcessId(processInstance.getId(), processInstance.getTestFlag())).thenReturn(taskInstanceList); when(loggerService.queryLog(taskInstance.getId(), 0, 4098)).thenReturn(res); Map<String, Object> successRes = processInstanceService.queryTaskListByProcessId(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testParseLogForDependentResult() throws IOException { String logString = "[INFO] 2019-03-19 17:11:08.475 org.apache.dolphinscheduler.server.worker.log.TaskLogger:[172]" + " - [taskAppId=TASK_223_10739_452334] dependent item complete :|| 223-ALL-day-last1Day,SUCCESS\n" + "[INFO] 2019-03-19 17:11:08.476 org.apache.dolphinscheduler.server.worker.runner.TaskScheduleThread:[172]" + " - task : 223_10739_452334 exit status code : 0\n" + "[root@node2 current]# "; Map<String, DependResult> resultMap = processInstanceService.parseLogForDependentResult(logString); Assert.assertEquals(1, resultMap.size()); } @Test public void testQuerySubProcessInstanceByTaskId() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(processService.findTaskInstanceById(1)).thenReturn(null); Map<String, Object> taskNullRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); Assert.assertEquals(Status.TASK_INSTANCE_NOT_EXISTS, taskNullRes.get(Constants.STATUS)); TaskInstance taskInstance = getTaskInstance(); taskInstance.setTaskType("HTTP"); taskInstance.setProcessInstanceId(1); putMsg(result, Status.SUCCESS, projectCode); when(processService.findTaskInstanceById(1)).thenReturn(taskInstance); TaskDefinition taskDefinition = new TaskDefinition(); taskDefinition.setProjectCode(projectCode); when(taskDefinitionMapper.queryByCode(taskInstance.getTaskCode())).thenReturn(taskDefinition); Map<String, Object> notSubprocessRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); Assert.assertEquals(Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, notSubprocessRes.get(Constants.STATUS)); TaskInstance subTask = getTaskInstance(); subTask.setTaskType("SUB_PROCESS"); subTask.setProcessInstanceId(1); putMsg(result, Status.SUCCESS, projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
when(processService.findTaskInstanceById(subTask.getId())).thenReturn(subTask); when(processService.findSubProcessInstance(subTask.getProcessInstanceId(), subTask.getId())).thenReturn(null); Map<String, Object> subprocessNotExistRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); Assert.assertEquals(Status.SUB_PROCESS_INSTANCE_NOT_EXIST, subprocessNotExistRes.get(Constants.STATUS)); ProcessInstance processInstance = getProcessInstance(); putMsg(result, Status.SUCCESS, projectCode); when(processService.findSubProcessInstance(taskInstance.getProcessInstanceId(), taskInstance.getId())) .thenReturn(processInstance); Map<String, Object> subprocessExistRes = processInstanceService.querySubProcessInstanceByTaskId(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, subprocessExistRes.get(Constants.STATUS)); } @Test public void testUpdateProcessInstance() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, ""); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); ProcessInstance processInstance = getProcessInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE)).thenReturn(result); when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty()); try { Map<String, Object> processInstanceNullRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, ""); Assert.fail(); } catch (ServiceException ex) { Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST.getCode(), ex.getCode()); } when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.ofNullable(processInstance)); processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION); putMsg(result, Status.SUCCESS, projectCode); Map<String, Object> processInstanceNotFinishRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, shellJson, taskJson, "2020-02-21 00:00:00", true, "", "", 0, ""); Assert.assertEquals(Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstanceNotFinishRes.get(Constants.STATUS)); processInstance.setState(WorkflowExecutionStatus.SUCCESS); processInstance.setTimeout(3000); processInstance.setCommandType(CommandType.STOP); processInstance.setProcessDefinitionCode(46L); processInstance.setProcessDefinitionVersion(1); ProcessDefinition processDefinition = getProcessDefinition(); processDefinition.setId(1); processDefinition.setUserId(1); processDefinition.setProjectCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
Tenant tenant = getTenant(); when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); when(tenantMapper.queryByTenantCode("root")).thenReturn(tenant); when(processService.getTenantForProcess(Mockito.anyInt(), Mockito.anyInt())).thenReturn(tenant); when(processInstanceDao.updateProcessInstance(processInstance)).thenReturn(1); when(processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.FALSE)).thenReturn(1); List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); when(processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs)).thenReturn(result); putMsg(result, Status.SUCCESS, projectCode); when(taskPluginManager.checkTaskParameters(Mockito.any())).thenReturn(true); Map<String, Object> processInstanceFinishRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, taskRelationJson, taskDefinitionJson, "2020-02-21 00:00:00", true, "", "", 0, "root"); Assert.assertEquals(Status.SUCCESS, processInstanceFinishRes.get(Constants.STATUS)); when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); putMsg(result, Status.SUCCESS, projectCode); when(processService.saveProcessDefine(loginUser, processDefinition, Boolean.FALSE, Boolean.FALSE)) .thenReturn(1); Map<String, Object> successRes = processInstanceService.updateProcessInstance(loginUser, projectCode, 1, taskRelationJson, taskDefinitionJson, "2020-02-21 00:00:00", Boolean.FALSE, "", "", 0, "root"); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testQueryParentInstanceBySubId() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); Map<String, Object> proejctAuthFailRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); Assert.assertEquals(Status.PROJECT_NOT_FOUND, proejctAuthFailRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE)).thenReturn(result); when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty()); try { Map<String, Object> processInstanceNullRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); } catch (ServiceException ex) { Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST.getCode(), ex.getCode()); } ProcessInstance processInstance = getProcessInstance(); processInstance.setIsSubProcess(Flag.NO); putMsg(result, Status.SUCCESS, projectCode); when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.ofNullable(processInstance)); Map<String, Object> notSubProcessRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE, notSubProcessRes.get(Constants.STATUS)); processInstance.setIsSubProcess(Flag.YES); putMsg(result, Status.SUCCESS, projectCode); when(processService.findParentProcessInstance(1)).thenReturn(null); Map<String, Object> subProcessNullRes =
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); Assert.assertEquals(Status.SUB_PROCESS_INSTANCE_NOT_EXIST, subProcessNullRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); when(processService.findParentProcessInstance(1)).thenReturn(processInstance); Map<String, Object> successRes = processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testDeleteProcessInstanceById() { long projectCode = 1L; User loginUser = getAdminUser(); Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); putMsg(result, Status.SUCCESS, projectCode); when(projectMapper.queryByCode(projectCode)).thenReturn(project); when(projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_DELETE)).thenReturn(result); when(processService.findProcessInstanceDetailById(1)).thenReturn(null); } @Test public void testViewVariables() { ProcessInstance processInstance = getProcessInstance(); processInstance.setCommandType(CommandType.SCHEDULER); processInstance.setScheduleTime(new Date()); processInstance.setGlobalParams(""); when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance); Map<String, Object> successRes = processInstanceService.viewVariables(1L, 1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testViewGantt() throws Exception { ProcessInstance processInstance = getProcessInstance(); TaskInstance taskInstance = getTaskInstance(); taskInstance.setState(TaskExecutionStatus.RUNNING_EXECUTION); taskInstance.setStartTime(new Date()); when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance); when(processDefinitionLogMapper.queryByDefinitionCodeAndVersion( processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion())).thenReturn(new ProcessDefinitionLog()); when(processInstanceMapper.queryDetailById(1)).thenReturn(processInstance); when(taskInstanceMapper.queryByInstanceIdAndName(Mockito.anyInt(), Mockito.any())).thenReturn(taskInstance); DAG<String, TaskNode, TaskNodeRelation> graph = new DAG<>(); for (int i = 1; i <= 7; ++i) { graph.addNode(i + "", new TaskNode()); } when(processService.genDagGraph(Mockito.any(ProcessDefinition.class))) .thenReturn(graph); Map<String, Object> successRes = processInstanceService.viewGantt(0L, 1); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } /** * get Mock Admin User * * @return admin user */ private User getAdminUser() { User loginUser = new User();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
loginUser.setId(-1); loginUser.setUserName("admin"); loginUser.setUserType(UserType.GENERAL_USER); return loginUser; } /** * get mock Project * * @param projectCode projectCode * @return Project */ private Project getProject(long projectCode) { Project project = new Project(); project.setCode(projectCode); project.setId(1); project.setName("project_test1"); project.setUserId(1); return project; } /** * get Mock process instance * * @return process instance */ private ProcessInstance getProcessInstance() { ProcessInstance processInstance = new ProcessInstance(); processInstance.setId(1); processInstance.setName("test_process_instance"); processInstance.setProcessDefinitionCode(46L); processInstance.setProcessDefinitionVersion(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
processInstance.setStartTime(new Date()); processInstance.setEndTime(new Date()); return processInstance; } /** * get mock processDefinition * * @return ProcessDefinition */ private ProcessDefinition getProcessDefinition() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setCode(46L); processDefinition.setVersion(1); processDefinition.setId(46); processDefinition.setName("test_pdf"); processDefinition.setProjectCode(2L); processDefinition.setTenantId(1); processDefinition.setDescription(""); return processDefinition; } private Tenant getTenant() { Tenant tenant = new Tenant(); tenant.setId(1); tenant.setTenantCode("root"); return tenant; } /** * get Mock worker group * * @return worker group
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java
*/ private WorkerGroup getWorkGroup() { WorkerGroup workerGroup = new WorkerGroup(); workerGroup.setName("test_workergroup"); return workerGroup; } /** * get Mock task instance * * @return task instance */ private TaskInstance getTaskInstance() { TaskInstance taskInstance = new TaskInstance(); taskInstance.setId(1); taskInstance.setName("test_task_instance"); taskInstance.setStartTime(new Date()); taskInstance.setEndTime(new Date()); taskInstance.setExecutorId(-1); return taskInstance; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
/* * 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.common.utils; import org.apache.dolphinscheduler.common.Constants;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
import org.apache.dolphinscheduler.common.thread.ThreadLocalContext; import org.apache.commons.lang3.StringUtils; import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZonedDateTime; import java.time.format.DateTimeFormatter; import java.util.Calendar; import java.util.Date; import java.util.TimeZone; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public final class DateUtils { static final long C0 = 1L; static final long C1 = C0 * 1000L; static final long C2 = C1 * 1000L; static final long C3 = C2 * 1000L; static final long C4 = C3 * 60L; static final long C5 = C4 * 60L; static final long C6 = C5 * 24L; private static final Logger logger = LoggerFactory.getLogger(DateUtils.class); private static final DateTimeFormatter YYYY_MM_DD_HH_MM_SS = DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS); private DateUtils() { throw new UnsupportedOperationException("Construct DateUtils"); } /** * date to local datetime
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* * @param date date * @return local datetime */ private static LocalDateTime date2LocalDateTime(Date date) { String timezone = ThreadLocalContext.getTimezoneThreadLocal().get(); ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault(); return date2LocalDateTime(date, zoneId); } /** * date to local datetime * * @param date date * @param zoneId zoneId * @return local datetime */ private static LocalDateTime date2LocalDateTime(Date date, ZoneId zoneId) { return LocalDateTime.ofInstant(date.toInstant(), zoneId); } /** * local datetime to date * * @param localDateTime local datetime * @return date */ private static Date localDateTime2Date(LocalDateTime localDateTime) { String timezone = ThreadLocalContext.getTimezoneThreadLocal().get(); ZoneId zoneId = StringUtils.isNotEmpty(timezone) ? ZoneId.of(timezone) : ZoneId.systemDefault(); return localDateTime2Date(localDateTime, zoneId); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
/** * local datetime to date * * @param localDateTime local datetime * @return date */ private static Date localDateTime2Date(LocalDateTime localDateTime, ZoneId zoneId) { Instant instant = localDateTime.atZone(zoneId).toInstant(); return Date.from(instant); } /** * get the date string in the specified format of the current time * * @param format date format * @return date string */ public static String getCurrentTime(String format) { return LocalDateTime.now().format(DateTimeFormatter.ofPattern(format)); } /** * get the formatted date string * * @param date date * @param format e.g. yyyy-MM-dd HH:mm:ss * @return date string */ public static String format(Date date, String format, String timezone) { return format(date, DateTimeFormatter.ofPattern(format), timezone); } public static String format(Date date, DateTimeFormatter dateTimeFormatter, String timezone) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
LocalDateTime localDateTime = StringUtils.isEmpty(timezone) ? date2LocalDateTime(date) : date2LocalDateTime(date, ZoneId.of(timezone)); return format(localDateTime, dateTimeFormatter); } /** * get the formatted date string * * @param localDateTime local data time * @param format yyyy-MM-dd HH:mm:ss * @return date string */ public static String format(LocalDateTime localDateTime, String format) { return format(localDateTime, DateTimeFormatter.ofPattern(format)); } public static String format(LocalDateTime localDateTime, DateTimeFormatter dateTimeFormatter) { return localDateTime.format(dateTimeFormatter); } /** * convert time to yyyy-MM-dd HH:mm:ss format * * @param date date * @return date string */ public static String dateToString(Date date) { return format(date, YYYY_MM_DD_HH_MM_SS, null); } /** * convert time to yyyy-MM-dd HH:mm:ss format * * @param date date
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* @param timezone timezone * @return date string */ public static String dateToString(Date date, String timezone) { return format(date, YYYY_MM_DD_HH_MM_SS, timezone); } /** * convert zone date time to yyyy-MM-dd HH:mm:ss format * * @param zonedDateTime zone date time * @return zone date time string */ public static String dateToString(ZonedDateTime zonedDateTime) { return YYYY_MM_DD_HH_MM_SS.format(zonedDateTime); } /** * convert zone date time to yyyy-MM-dd HH:mm:ss format * * @param zonedDateTime zone date time * @param timezone time zone * @return zone date time string */ public static String dateToString(ZonedDateTime zonedDateTime, String timezone) { return dateToString(zonedDateTime, ZoneId.of(timezone)); } /** * convert zone date time to yyyy-MM-dd HH:mm:ss format * * @param zonedDateTime zone date time * @param zoneId zone id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* @return zone date time string */ public static String dateToString(ZonedDateTime zonedDateTime, ZoneId zoneId) { return DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS).withZone(zoneId).format(zonedDateTime); } /** * convert string to date and time * * @param date date * @param format format * @param timezone timezone, if null, use system default timezone * @return date */ public static Date parse(String date, String format, String timezone) { return parse(date, DateTimeFormatter.ofPattern(format), timezone); } public static Date parse(String date, DateTimeFormatter dateTimeFormatter, String timezone) { try { LocalDateTime ldt = LocalDateTime.parse(date, dateTimeFormatter); if (StringUtils.isEmpty(timezone)) { return localDateTime2Date(ldt); } return localDateTime2Date(ldt, ZoneId.of(timezone)); } catch (Exception e) { logger.error("error while parse date:" + date, e); } return null; } public static ZonedDateTime parseZoneDateTime(@Nonnull String date, @Nonnull DateTimeFormatter dateTimeFormatter, @Nullable String timezone) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
ZonedDateTime zonedDateTime = ZonedDateTime.parse(date, dateTimeFormatter); if (StringUtils.isNotEmpty(timezone)) { return zonedDateTime.withZoneSameInstant(ZoneId.of(timezone)); } return zonedDateTime; } /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param date date string * @return yyyy-MM-dd HH:mm:ss format */ public static @Nullable Date stringToDate(String date) { return parse(date, YYYY_MM_DD_HH_MM_SS, null); } public static ZonedDateTime stringToZoneDateTime(@Nonnull String date) { Date d = stringToDate(date); if (d == null) { throw new IllegalArgumentException(String.format( "data: %s should be a validate data string - yyyy-MM-dd HH:mm:ss ", date)); } return ZonedDateTime.ofInstant(d.toInstant(), ZoneId.systemDefault()); } /** * convert date str to yyyy-MM-dd HH:mm:ss format * * @param date date string * @param timezone * @return yyyy-MM-dd HH:mm:ss format
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
*/ public static Date stringToDate(String date, String timezone) { return parse(date, YYYY_MM_DD_HH_MM_SS, timezone); } /** * get seconds between two dates * * @param d1 date1 * @param d2 date2 * @return differ seconds */ public static long differSec(Date d1, Date d2) { if (d1 == null || d2 == null) { return 0; } return (long) Math.ceil(differMs(d1, d2) / 1000.0); } /** * get ms between two dates * * @param d1 date1 * @param d2 date2 * @return differ ms */ public static long differMs(Date d1, Date d2) { return Math.abs(d1.getTime() - d2.getTime()); } /** * get the date of the specified date in the days before and after *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* @param date date * @param day day * @return the date of the specified date in the days before and after */ public static Date getSomeDay(Date date, int day) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, day); return calendar.getTime(); } /** * get the hour of day. * * @param date date * @return hour of day */ public static int getHourIndex(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.HOUR_OF_DAY); } /** * compare two dates * * @param future future date * @param old old date * @return true if future time greater than old time */ public static boolean compare(Date future, Date old) { return future.getTime() > old.getTime();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
} /** * format time to readable * * @param ms ms * @return format time */ public static String format2Readable(long ms) { long days = MILLISECONDS.toDays(ms); long hours = MILLISECONDS.toDurationHours(ms); long minutes = MILLISECONDS.toDurationMinutes(ms); long seconds = MILLISECONDS.toDurationSeconds(ms); return String.format("%02d %02d:%02d:%02d", days, hours, minutes, seconds); } /** * format time to duration, if end date is null, use current time as end time * * @param start start * @param end end * @return format time */ public static String format2Duration(Date start, Date end) { if (start == null) { return null; } if (end == null) { end = new Date(); } return format2Duration(differMs(start, end)); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
/** * format time to duration * * @param ms ms * @return format time */ public static String format2Duration(long ms) { long days = MILLISECONDS.toDays(ms); long hours = MILLISECONDS.toDurationHours(ms); long minutes = MILLISECONDS.toDurationMinutes(ms); long seconds = MILLISECONDS.toDurationSeconds(ms); if (days == 0 && hours == 0 && minutes == 0 && seconds == 0) { seconds = 1; } StringBuilder strBuilder = new StringBuilder(); strBuilder = days > 0 ? strBuilder.append(days).append("d").append(" ") : strBuilder; strBuilder = hours > 0 ? strBuilder.append(hours).append("h").append(" ") : strBuilder; strBuilder = minutes > 0 ? strBuilder.append(minutes).append("m").append(" ") : strBuilder; strBuilder = seconds > 0 ? strBuilder.append(seconds).append("s") : strBuilder; return strBuilder.toString(); } /** * get monday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date * @return get monday */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
public static Date getMonday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); return cal.getTime(); } /** * get sunday * <p> * note: Set the first day of the week to Monday, the default is Sunday * * @param date date * @return get sunday */ public static Date getSunday(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY); return cal.getTime(); } /** * get first day of month * * @param date date * @return first day of month */ public static Date getFirstDayOfMonth(Date date) { Calendar cal = Calendar.getInstance();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.setTime(date); cal.set(Calendar.DAY_OF_MONTH, 1); return cal.getTime(); } /** * get some hour of day * * @param date date * @param offsetHour hours * @return some hour of day */ public static Date getSomeHourOfDay(Date date, int offsetHour) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, cal.get(Calendar.HOUR_OF_DAY) + offsetHour); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * get last day of month * * @param date date * @return get last day of month */ public static Date getLastDayOfMonth(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.add(Calendar.MONTH, 1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.set(Calendar.DAY_OF_MONTH, 1); cal.add(Calendar.DAY_OF_MONTH, -1); return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay date * @return start day */ public static Date getStartOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of day */ public static Date getEndOfDay(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); } /** * return YYYY-MM-DD 00:00:00 * * @param inputDay day * @return start of hour */ public static Date getStartOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } /** * return YYYY-MM-DD 23:59:59 * * @param inputDay day * @return end of hour */ public static Date getEndOfHour(Date inputDay) { Calendar cal = Calendar.getInstance(); cal.setTime(inputDay); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
return cal.getTime(); } /** * get current date * * @return current date */ public static Date getCurrentDate() { return new Date(); } /** * get date * * @param date date * @param calendarField calendarField * @param amount amount * @return date */ public static Date add(final Date date, final int calendarField, final int amount) { if (date == null) { throw new IllegalArgumentException("The date must not be null"); } final Calendar c = Calendar.getInstance(); c.setTime(date); c.add(calendarField, amount); return c.getTime(); } /** * starting from the current time, get how many seconds are left before the target time. * targetTime = baseTime + intervalSeconds
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* * @param baseTime base time * @param intervalSeconds a period of time * @return the number of seconds */ public static long getRemainTime(Date baseTime, long intervalSeconds) { if (baseTime == null) { return 0; } long usedTime = (System.currentTimeMillis() - baseTime.getTime()) / 1000; return intervalSeconds - usedTime; } /** * get current time stamp : yyyyMMddHHmmssSSS * * @return date string */ public static String getCurrentTimeStamp() { return getCurrentTime(Constants.YYYYMMDDHHMMSSSSS); } /** * transform date to target timezone date * sourceTimeZoneId is system default timezone */ public static Date transformTimezoneDate(Date date, String targetTimezoneId) { return transformTimezoneDate(date, ZoneId.systemDefault().getId(), targetTimezoneId); } /** * transform date from source timezone date to target timezone date * <p>e.g.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
* <p> if input date is `Thu Apr 28 10:00:00 UTC 2022`, sourceTimezoneId is UTC * <p>targetTimezoneId is Asia/Shanghai * <p>this method will return `Thu Apr 28 02:00:00 UTC 2022` */ public static Date transformTimezoneDate(Date date, String sourceTimezoneId, String targetTimezoneId) { if (StringUtils.isEmpty(sourceTimezoneId) || StringUtils.isEmpty(targetTimezoneId)) { return date; } String dateToString = dateToString(date, sourceTimezoneId); LocalDateTime localDateTime = LocalDateTime.parse(dateToString, DateTimeFormatter.ofPattern(Constants.YYYY_MM_DD_HH_MM_SS)); ZonedDateTime zonedDateTime = ZonedDateTime.of(localDateTime, TimeZone.getTimeZone(targetTimezoneId).toZoneId()); return Date.from(zonedDateTime.toInstant()); } /** * get timezone by timezoneId */ public static TimeZone getTimezone(String timezoneId) { if (StringUtils.isEmpty(timezoneId)) { return null; } return TimeZone.getTimeZone(timezoneId); } /** * Time unit representing one thousandth of a second */ public static class MILLISECONDS { public static long toDays(long d) { return d / (C6 / C2);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DateUtils.java
} public static long toDurationSeconds(long d) { return (d % (C4 / C2)) / (C3 / C2); } public static long toDurationMinutes(long d) { return (d % (C5 / C2)) / (C4 / C2); } public static long toDurationHours(long d) { return (d % (C6 / C2)) / (C5 / C2); } } /** * transform timeStamp to local date * * @param timeStamp time stamp (milliseconds) * @return local date */ public static @Nullable Date timeStampToDate(long timeStamp) { return timeStamp <= 0L ? null : new Date(timeStamp); } /** * transform date to timeStamp * @param date date * @return time stamp (milliseconds) */ public static long dateToTimeStamp(Date date) { return date == null ? 0L : date.getTime(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
/* * 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.common.utils; import org.apache.dolphinscheduler.common.thread.ThreadLocalContext; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.ZoneId; import java.time.ZonedDateTime; import java.util.Date; import java.util.TimeZone; import javax.management.timer.Timer; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; public class DateUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
@Before public void before() { ThreadLocalContext.getTimezoneThreadLocal().remove(); } @After public void after() { ThreadLocalContext.getTimezoneThreadLocal().remove();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
} @Test public void format2Readable() throws ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String start = "2015-12-21 18:00:36"; Date startDate = sdf.parse(start); String end = "2015-12-23 03:23:44"; Date endDate = sdf.parse(end); String readableDate = DateUtils.format2Readable(endDate.getTime() - startDate.getTime()); Assert.assertEquals("01 09:23:08", readableDate); } @Test public void testWeek() { Date curr = DateUtils.stringToDate("2019-02-01 00:00:00"); Date monday1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Date sunday1 = DateUtils.stringToDate("2019-02-03 00:00:00"); Date monday = DateUtils.getMonday(curr); Date sunday = DateUtils.getSunday(monday); Assert.assertEquals(monday, monday1); Assert.assertEquals(sunday, sunday1); } @Test public void dateToString() { Date d1 = DateUtils.stringToDate("2019-01-28"); Assert.assertNull(d1); d1 = DateUtils.stringToDate("2019-01-28 00:00:00"); Assert.assertEquals(DateUtils.dateToString(d1), "2019-01-28 00:00:00"); } @Test public void getSomeDay() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
Date d1 = DateUtils.stringToDate("2019-01-31 00:00:00"); Date curr = DateUtils.getSomeDay(d1, 1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-01 00:00:00"); Assert.assertEquals(DateUtils.dateToString(DateUtils.getSomeDay(d1, -31)), "2018-12-31 00:00:00"); } @Test public void getFirstDayOfMonth() { Date d1 = DateUtils.stringToDate("2019-01-31 00:00:00"); Date curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 00:00:00"); d1 = DateUtils.stringToDate("2019-01-31 01:59:00"); curr = DateUtils.getFirstDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-01 01:59:00"); } @Test public void getSomeHourOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59"); Date curr = DateUtils.getSomeHourOfDay(d1, -1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 10:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 0); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 2); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 13:00:00"); curr = DateUtils.getSomeHourOfDay(d1, 24); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-01 11:00:00"); } @Test public void getLastDayOfMonth() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59"); Date curr = DateUtils.getLastDayOfMonth(d1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); d1 = DateUtils.stringToDate("2019-01-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); d1 = DateUtils.stringToDate("2019-02-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-02-28 11:59:59"); d1 = DateUtils.stringToDate("2020-02-02 11:59:59"); curr = DateUtils.getLastDayOfMonth(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2020-02-29 11:59:59"); } @Test public void getStartOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:59:59"); Date curr = DateUtils.getStartOfDay(d1); String expected = new SimpleDateFormat("yyyy-MM-dd").format(d1) + " 00:00:00"; Assert.assertEquals(DateUtils.dateToString(curr), expected); } @Test public void getEndOfDay() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getEndOfDay(d1); String expected = new SimpleDateFormat("yyyy-MM-dd").format(d1) + " 23:59:59"; Assert.assertEquals(DateUtils.dateToString(curr), expected); } @Test public void getStartOfHour() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getStartOfHour(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:00:00");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
} @Test public void getEndOfHour() { Date d1 = DateUtils.stringToDate("2019-01-31 11:00:59"); Date curr = DateUtils.getEndOfHour(d1); Assert.assertEquals(DateUtils.dateToString(curr), "2019-01-31 11:59:59"); } @Test public void getCurrentTimeStamp() { String timeStamp = DateUtils.getCurrentTimeStamp(); Assert.assertNotNull(timeStamp); } @Test public void testFormat2Duration() { Date start = DateUtils.stringToDate("2020-01-20 11:00:00"); Date end = DateUtils.stringToDate("2020-01-21 12:10:10"); String duration = DateUtils.format2Duration(start, end); Assert.assertEquals("1d 1h 10m 10s", duration); start = DateUtils.stringToDate("2020-01-20 11:00:00"); end = DateUtils.stringToDate("2020-01-20 12:10:10"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("1h 10m 10s", duration); start = DateUtils.stringToDate("2020-01-20 11:00:00"); end = DateUtils.stringToDate("2020-01-20 11:10:10"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("10m 10s", duration);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
start = DateUtils.stringToDate("2020-01-20 11:10:00"); end = DateUtils.stringToDate("2020-01-20 11:10:10"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("10s", duration); start = DateUtils.stringToDate("2020-01-20 11:10:00"); end = DateUtils.stringToDate("2020-01-21 11:10:10"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("1d 10s", duration); start = DateUtils.stringToDate("2020-01-20 11:10:00"); end = DateUtils.stringToDate("2020-01-20 16:10:10"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("5h 10s", duration); start = DateUtils.stringToDate("2020-01-20 11:10:00"); end = DateUtils.stringToDate("2020-01-20 11:10:00"); duration = DateUtils.format2Duration(start, end); Assert.assertEquals("1s", duration); start = DateUtils.stringToDate("2020-01-20 11:10:00"); duration = DateUtils.format2Duration(start, null); Assert.assertNotNull(duration); } @Test public void testTransformToTimezone() { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); Date date = new Date(); Date defaultTimeZoneDate = DateUtils.transformTimezoneDate(date, TimeZone.getDefault().getID()); Assert.assertEquals(DateUtils.dateToString(date), DateUtils.dateToString(defaultTimeZoneDate)); Date targetTimeZoneDate = DateUtils.transformTimezoneDate(date, TimeZone.getDefault().getID(), "Asia/Shanghai"); Assert.assertEquals(DateUtils.dateToString(date, TimeZone.getDefault().getID()), DateUtils.dateToString(targetTimeZoneDate, "Asia/Shanghai"));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
} @Test public void testGetTimezone() { Assert.assertNull(DateUtils.getTimezone(null)); Assert.assertEquals(TimeZone.getTimeZone("MST"), DateUtils.getTimezone("MST")); } @Test public void testTimezone() { String time = "2019-01-28 00:00:00"; ThreadLocalContext.timezoneThreadLocal.set("UTC"); Date utcDate = DateUtils.stringToDate(time); Assert.assertEquals(time, DateUtils.dateToString(utcDate)); ThreadLocalContext.timezoneThreadLocal.set("Asia/Shanghai"); Date shanghaiDate = DateUtils.stringToDate(time); Assert.assertEquals(time, DateUtils.dateToString(shanghaiDate)); Assert.assertEquals(Timer.ONE_HOUR * 8, utcDate.getTime() - shanghaiDate.getTime()); } @Test public void testDateToString() { ZoneId asiaSh = ZoneId.of("Asia/Shanghai"); ZoneId utc = ZoneId.of("UTC"); ZonedDateTime asiaShNow = ZonedDateTime.now(asiaSh); ZonedDateTime utcNow = asiaShNow.minusHours(8); String asiaShNowStr = DateUtils.dateToString(utcNow, asiaSh); String utcNowStr = DateUtils.dateToString(asiaShNow, utc); Assert.assertEquals(asiaShNowStr, utcNowStr); } @Test public void testDateToTimeStamp() throws ParseException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,669
[Bug] [WorkflowInstance] the value of duration in Workflow Instance table is wrong
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened When the workflow instance is in the process of executing, the result should be empty, regardless of whether the workflow instance was run for the first time or re-run. But when we re-run the workflow instance , the status show instance is running, but the ***duration*** is displayed as `(the task re-run start time) - (the last task end time)`, which is obviously wrong. Because the workflow instance page will keep query the data from api - ProcessInstanceController-queryProcessInstanceList, the source code just use **_Math.abs(startTime - endTime)_**. Please check the following code: `for (ProcessInstance processInstance : processInstances) { processInstance.setDuration( DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())); ... }` ### What you expected to happen When the workflow instanceis running, the duration should be null, ### How to reproduce Step 1. Create a workflow instance and run it. Step 2. After the workflow instance finished, then click "re-run" button, and check the duration when the state show executing. ### Anything else Need to determine in which workflow instance state this duration needs to be empty, i think just **_RUNNING_EXECUTION_** and **_SERIAL_WAIT_**. ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11669
https://github.com/apache/dolphinscheduler/pull/12264
0e1c8d81530ad530779469598f03410ceb9b067b
17cd644506872c1b8e3f9ddf657371580c35e4e6
2022-08-26T13:10:47Z
java
2022-10-13T01:50:31Z
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/DateUtilsTest.java
String timeString = "2022-09-29 21:00:00"; SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); Date date = sdf.parse(timeString); long timeStamp = DateUtils.dateToTimeStamp(date); Assert.assertEquals(1664456400000L, timeStamp); String tokyoTime = "2022-09-29 22:00:00"; sdf.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo")); date = sdf.parse(tokyoTime); timeStamp = DateUtils.dateToTimeStamp(date); Assert.assertEquals(1664456400000L, timeStamp); date = null; Assert.assertEquals(0L, DateUtils.dateToTimeStamp(date)); } @Test public void testTimeStampToDate() { long timeStamp = 1664456400000L; SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai")); String sd = sdf.format(new Date(timeStamp)); Assert.assertEquals("2022-09-29 21:00:00", sd); sdf.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo")); sd = sdf.format(new Date(timeStamp)); Assert.assertEquals("2022-09-29 22:00:00", sd); Date date = DateUtils.timeStampToDate(0L); Assert.assertNull(date); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,372
[Improvement][k8s] Update the deprecated k8s api
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Update the deprecated k8s api ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12372
https://github.com/apache/dolphinscheduler/pull/12373
2f37da0dbcbbd887a801c6e922551ce561a606cd
7b44612f283702f2a25a4d36ffdda015a812a321
2022-10-14T03:16:03Z
java
2022-10-14T08:18:35Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java
/* * 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. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,372
[Improvement][k8s] Update the deprecated k8s api
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Update the deprecated k8s api ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12372
https://github.com/apache/dolphinscheduler/pull/12373
2f37da0dbcbbd887a801c6e922551ce561a606cd
7b44612f283702f2a25a4d36ffdda015a812a321
2022-10-14T03:16:03Z
java
2022-10-14T08:18:35Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java
package org.apache.dolphinscheduler.plugin.task.api.utils; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.LOG_LINES; import org.apache.dolphinscheduler.plugin.task.api.TaskException; import java.util.List; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.fabric8.kubernetes.api.model.Pod; import io.fabric8.kubernetes.api.model.batch.v1.Job; import io.fabric8.kubernetes.api.model.batch.v1.JobList; import io.fabric8.kubernetes.client.Config; import io.fabric8.kubernetes.client.DefaultKubernetesClient; import io.fabric8.kubernetes.client.KubernetesClient; import io.fabric8.kubernetes.client.Watch; import io.fabric8.kubernetes.client.Watcher; public class K8sUtils { private static final Logger log = LoggerFactory.getLogger(K8sUtils.class); private KubernetesClient client; public void createJob(String namespace, Job job) { try { client.batch() .jobs() .inNamespace(namespace) .create(job); } catch (Exception e) { throw new TaskException("fail to create job", e); } } public void deleteJob(String jobName, String namespace) { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,372
[Improvement][k8s] Update the deprecated k8s api
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Update the deprecated k8s api ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12372
https://github.com/apache/dolphinscheduler/pull/12373
2f37da0dbcbbd887a801c6e922551ce561a606cd
7b44612f283702f2a25a4d36ffdda015a812a321
2022-10-14T03:16:03Z
java
2022-10-14T08:18:35Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java
client.batch() .jobs() .inNamespace(namespace) .withName(jobName) .delete(); } catch (Exception e) { throw new TaskException("fail to delete job", e); } } public Boolean jobExist(String jobName, String namespace) { Optional<Job> result; try { JobList jobList = client.batch().jobs().inNamespace(namespace).list(); List<Job> jobs = jobList.getItems(); result = jobs.stream() .filter(job -> job.getMetadata().getName().equals(jobName)) .findFirst(); return result.isPresent(); } catch (Exception e) { throw new TaskException("fail to check job: ", e); } } public Watch createBatchJobWatcher(String jobName, Watcher<Job> watcher) { try { return client.batch() .jobs().withName(jobName).watch(watcher); } catch (Exception e) { throw new TaskException("fail to register batch job watcher", e); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,372
[Improvement][k8s] Update the deprecated k8s api
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Update the deprecated k8s api ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12372
https://github.com/apache/dolphinscheduler/pull/12373
2f37da0dbcbbd887a801c6e922551ce561a606cd
7b44612f283702f2a25a4d36ffdda015a812a321
2022-10-14T03:16:03Z
java
2022-10-14T08:18:35Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/utils/K8sUtils.java
public String getPodLog(String jobName, String namespace) { try { List<Pod> podList = client.pods().inNamespace(namespace).list().getItems(); String podName = null; for (Pod pod : podList) { podName = pod.getMetadata().getName(); if (jobName.equals(podName.substring(0, pod.getMetadata().getName().lastIndexOf("-")))) { break; } } return client.pods().inNamespace(namespace) .withName(podName) .tailingLines(LOG_LINES) .getLog(Boolean.TRUE); } catch (Exception e) { log.error("fail to getPodLog", e); log.error("response bodies : {}", e.getMessage()); } return null; } public void buildClient(String configYaml) { try { Config config = Config.fromKubeconfig(configYaml); client = new DefaultKubernetesClient(config); } catch (Exception e) { throw new TaskException("fail to build k8s ApiClient", e); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,355
[Feature][TASK-DATAX] add ```presto``` option under drop down box
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description _No response_ ### Use case i'll add ```presto``` option ,so people can choose ```presto```. ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12355
https://github.com/apache/dolphinscheduler/pull/12371
7aa8a77fb23252360dcc29721ddc56ed8aae8de8
b7bd8d780356e055998fd0047be7e2cfea85d59b
2022-10-13T07:44:53Z
java
2022-10-16T09:19:29Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
/* * 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.plugin.task.datax; import org.apache.dolphinscheduler.spi.enums.DbType; import com.alibaba.druid.sql.dialect.clickhouse.parser.ClickhouseStatementParser; import com.alibaba.druid.sql.dialect.hive.parser.HiveStatementParser; import com.alibaba.druid.sql.dialect.mysql.parser.MySqlStatementParser; import com.alibaba.druid.sql.dialect.oracle.parser.OracleStatementParser; import com.alibaba.druid.sql.dialect.postgresql.parser.PGSQLStatementParser; import com.alibaba.druid.sql.dialect.sqlserver.parser.SQLServerStatementParser; import com.alibaba.druid.sql.parser.SQLStatementParser; public class DataxUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,355
[Feature][TASK-DATAX] add ```presto``` option under drop down box
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description _No response_ ### Use case i'll add ```presto``` option ,so people can choose ```presto```. ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12355
https://github.com/apache/dolphinscheduler/pull/12371
7aa8a77fb23252360dcc29721ddc56ed8aae8de8
b7bd8d780356e055998fd0047be7e2cfea85d59b
2022-10-13T07:44:53Z
java
2022-10-16T09:19:29Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
public static final String DATAX_READER_PLUGIN_MYSQL = "mysqlreader"; public static final String DATAX_READER_PLUGIN_POSTGRESQL = "postgresqlreader"; public static final String DATAX_READER_PLUGIN_ORACLE = "oraclereader"; public static final String DATAX_READER_PLUGIN_SQLSERVER = "sqlserverreader"; public static final String DATAX_READER_PLUGIN_CLICKHOUSE = "clickhousereader"; public static final String DATAX_READER_PLUGIN_HIVE = "rdbmsreader"; public static final String DATAX_WRITER_PLUGIN_MYSQL = "mysqlwriter"; public static final String DATAX_WRITER_PLUGIN_POSTGRESQL = "postgresqlwriter"; public static final String DATAX_WRITER_PLUGIN_ORACLE = "oraclewriter"; public static final String DATAX_WRITER_PLUGIN_SQLSERVER = "sqlserverwriter"; public static final String DATAX_WRITER_PLUGIN_CLICKHOUSE = "clickhousewriter";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,355
[Feature][TASK-DATAX] add ```presto``` option under drop down box
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description _No response_ ### Use case i'll add ```presto``` option ,so people can choose ```presto```. ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12355
https://github.com/apache/dolphinscheduler/pull/12371
7aa8a77fb23252360dcc29721ddc56ed8aae8de8
b7bd8d780356e055998fd0047be7e2cfea85d59b
2022-10-13T07:44:53Z
java
2022-10-16T09:19:29Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
public static final String DATAX_WRITER_PLUGIN_HIVE = "rdbmswriter"; public static String getReaderPluginName(DbType dbType) { switch (dbType) { case MYSQL: return DATAX_READER_PLUGIN_MYSQL; case POSTGRESQL: return DATAX_READER_PLUGIN_POSTGRESQL; case ORACLE: return DATAX_READER_PLUGIN_ORACLE; case SQLSERVER: return DATAX_READER_PLUGIN_SQLSERVER; case CLICKHOUSE: return DATAX_READER_PLUGIN_CLICKHOUSE; case HIVE: return DATAX_READER_PLUGIN_HIVE; default: return null; } } public static String getWriterPluginName(DbType dbType) { switch (dbType) { case MYSQL: return DATAX_WRITER_PLUGIN_MYSQL; case POSTGRESQL: return DATAX_WRITER_PLUGIN_POSTGRESQL; case ORACLE: return DATAX_WRITER_PLUGIN_ORACLE; case SQLSERVER: return DATAX_WRITER_PLUGIN_SQLSERVER; case CLICKHOUSE:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,355
[Feature][TASK-DATAX] add ```presto``` option under drop down box
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description _No response_ ### Use case i'll add ```presto``` option ,so people can choose ```presto```. ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12355
https://github.com/apache/dolphinscheduler/pull/12371
7aa8a77fb23252360dcc29721ddc56ed8aae8de8
b7bd8d780356e055998fd0047be7e2cfea85d59b
2022-10-13T07:44:53Z
java
2022-10-16T09:19:29Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
return DATAX_WRITER_PLUGIN_CLICKHOUSE; case HIVE: return DATAX_WRITER_PLUGIN_HIVE; default: return null; } } public static SQLStatementParser getSqlStatementParser(DbType dbType, String sql) { switch (dbType) { case MYSQL: return new MySqlStatementParser(sql); case POSTGRESQL: return new PGSQLStatementParser(sql); case ORACLE: return new OracleStatementParser(sql); case SQLSERVER: return new SQLServerStatementParser(sql); case CLICKHOUSE: return new ClickhouseStatementParser(sql); case HIVE: return new HiveStatementParser(sql); default: return null; } } public static String[] convertKeywordsColumns(DbType dbType, String[] columns) { if (columns == null) { return null; } String[] toColumns = new String[columns.length];
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,355
[Feature][TASK-DATAX] add ```presto``` option under drop down box
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description _No response_ ### Use case i'll add ```presto``` option ,so people can choose ```presto```. ### Related issues _No response_ ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12355
https://github.com/apache/dolphinscheduler/pull/12371
7aa8a77fb23252360dcc29721ddc56ed8aae8de8
b7bd8d780356e055998fd0047be7e2cfea85d59b
2022-10-13T07:44:53Z
java
2022-10-16T09:19:29Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxUtils.java
for (int i = 0; i < columns.length; i++) { toColumns[i] = doConvertKeywordsColumn(dbType, columns[i]); } return toColumns; } public static String doConvertKeywordsColumn(DbType dbType, String column) { if (column == null) { return column; } column = column.trim(); column = column.replace("`", ""); column = column.replace("\"", ""); column = column.replace("'", ""); switch (dbType) { case MYSQL: return String.format("`%s`", column); case POSTGRESQL: return String.format("\"%s\"", column); case ORACLE: return String.format("\"%s\"", column); case SQLSERVER: return String.format("`%s`", column); case CLICKHOUSE: return String.format("`%s`", column); default: return column; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
/* * 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 *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
* 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.api.enums; import java.util.Locale; import java.util.Optional; import org.springframework.context.i18n.LocaleContextHolder; /** * status enum // todo #4855 One category one interval */ public enum Status { SUCCESS(0, "success", "成功"), INTERNAL_SERVER_ERROR_ARGS(10000, "Internal Server Error: {0}", "服务端异常: {0}"), REQUEST_PARAMS_NOT_VALID_ERROR(10001, "request parameter {0} is not valid", "请求参数[{0}]无效"), TASK_TIMEOUT_PARAMS_ERROR(10002, "task timeout parameter is not valid", "任务超时参数无效"), USER_NAME_EXIST(10003, "user name already exists", "用户名已存在"), USER_NAME_NULL(10004, "user name is null", "用户名不能为空"), HDFS_OPERATION_ERROR(10006, "hdfs operation error", "hdfs操作错误"), TASK_INSTANCE_NOT_FOUND(10008, "task instance not found", "任务实例不存在"), OS_TENANT_CODE_EXIST(10009, "os tenant code {0} already exists", "操作系统租户[{0}]已存在"), USER_NOT_EXIST(10010, "user {0} not exists", "用户[{0}]不存在"), ALERT_GROUP_NOT_EXIST(10011, "alarm group not found", "告警组不存在"), ALERT_GROUP_EXIST(10012, "alarm group already exists", "告警组名称已存在"), USER_NAME_PASSWD_ERROR(10013, "user name or password error", "用户名或密码错误"), LOGIN_SESSION_FAILED(10014, "create session failed!", "创建session失败"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
DATASOURCE_EXIST(10015, "data source name already exists", "数据源名称已存在"), DATASOURCE_CONNECT_FAILED(10016, "data source connection failed", "建立数据源连接失败"), TENANT_NOT_EXIST(10017, "tenant not exists", "租户不存在"), PROJECT_NOT_FOUND(10018, "project {0} not found ", "项目[{0}]不存在"), PROJECT_ALREADY_EXISTS(10019, "project {0} already exists", "项目名称[{0}]已存在"), TASK_INSTANCE_NOT_EXISTS(10020, "task instance {0} does not exist", "任务实例[{0}]不存在"), TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE(10021, "task instance {0} is not sub process instance", "任务实例[{0}]不是子流程实例"), SCHEDULE_CRON_NOT_EXISTS(10022, "scheduler crontab {0} does not exist", "调度配置定时表达式[{0}]不存在"), SCHEDULE_CRON_ONLINE_FORBID_UPDATE(10023, "online status does not allow update operations", "调度配置上线状态不允许修改"), SCHEDULE_CRON_CHECK_FAILED(10024, "scheduler crontab expression validation failure: {0}", "调度配置定时表达式验证失败: {0}"), MASTER_NOT_EXISTS(10025, "master does not exist", "无可用master节点"), SCHEDULE_STATUS_UNKNOWN(10026, "unknown status: {0}", "未知状态: {0}"), CREATE_ALERT_GROUP_ERROR(10027, "create alert group error", "创建告警组错误"), QUERY_ALL_ALERTGROUP_ERROR(10028, "query all alertgroup error", "查询告警组错误"), LIST_PAGING_ALERT_GROUP_ERROR(10029, "list paging alert group error", "分页查询告警组错误"), UPDATE_ALERT_GROUP_ERROR(10030, "update alert group error", "更新告警组错误"), DELETE_ALERT_GROUP_ERROR(10031, "delete alert group error", "删除告警组错误"), ALERT_GROUP_GRANT_USER_ERROR(10032, "alert group grant user error", "告警组授权用户错误"), CREATE_DATASOURCE_ERROR(10033, "create datasource error", "创建数据源错误"), UPDATE_DATASOURCE_ERROR(10034, "update datasource error", "更新数据源错误"), QUERY_DATASOURCE_ERROR(10035, "query datasource error", "查询数据源错误"), CONNECT_DATASOURCE_FAILURE(10036, "connect datasource failure", "建立数据源连接失败"), CONNECTION_TEST_FAILURE(10037, "connection test failure", "测试数据源连接失败"), DELETE_DATA_SOURCE_FAILURE(10038, "delete data source failure", "删除数据源失败"), VERIFY_DATASOURCE_NAME_FAILURE(10039, "verify datasource name failure", "验证数据源名称失败"), UNAUTHORIZED_DATASOURCE(10040, "unauthorized datasource", "未经授权的数据源"), AUTHORIZED_DATA_SOURCE(10041, "authorized data source", "授权数据源失败"), LOGIN_SUCCESS(10042, "login success", "登录成功"), USER_LOGIN_FAILURE(10043, "user login failure", "用户登录失败"), LIST_WORKERS_ERROR(10044, "list workers error", "查询worker列表错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
LIST_MASTERS_ERROR(10045, "list masters error", "查询master列表错误"), UPDATE_PROJECT_ERROR(10046, "update project error", "更新项目信息错误"), QUERY_PROJECT_DETAILS_BY_CODE_ERROR(10047, "query project details by code error", "查询项目详细信息错误"), CREATE_PROJECT_ERROR(10048, "create project error", "创建项目错误"), LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR(10049, "login user query project list paging error", "分页查询项目列表错误"), DELETE_PROJECT_ERROR(10050, "delete project error", "删除项目错误"), QUERY_UNAUTHORIZED_PROJECT_ERROR(10051, "query unauthorized project error", "查询未授权项目错误"), QUERY_AUTHORIZED_PROJECT(10052, "query authorized project", "查询授权项目错误"), QUERY_QUEUE_LIST_ERROR(10053, "query queue list error", "查询队列列表错误"), CREATE_RESOURCE_ERROR(10054, "create resource error", "创建资源错误"), UPDATE_RESOURCE_ERROR(10055, "update resource error", "更新资源错误"), QUERY_RESOURCES_LIST_ERROR(10056, "query resources list error", "查询资源列表错误"), QUERY_RESOURCES_LIST_PAGING(10057, "query resources list paging", "分页查询资源列表错误"), DELETE_RESOURCE_ERROR(10058, "delete resource error", "删除资源错误"), VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR(10059, "verify resource by name and type error", "资源名称或类型验证错误"), VIEW_RESOURCE_FILE_ON_LINE_ERROR(10060, "view resource file online error", "查看资源文件错误"), CREATE_RESOURCE_FILE_ON_LINE_ERROR(10061, "create resource file online error", "创建资源文件错误"), RESOURCE_FILE_IS_EMPTY(10062, "resource file is empty", "资源文件内容不能为空"), EDIT_RESOURCE_FILE_ON_LINE_ERROR(10063, "edit resource file online error", "更新资源文件错误"), DOWNLOAD_RESOURCE_FILE_ERROR(10064, "download resource file error", "下载资源文件错误"), CREATE_UDF_FUNCTION_ERROR(10065, "create udf function error", "创建UDF函数错误"), VIEW_UDF_FUNCTION_ERROR(10066, "view udf function error", "查询UDF函数错误"), UPDATE_UDF_FUNCTION_ERROR(10067, "update udf function error", "更新UDF函数错误"), QUERY_UDF_FUNCTION_LIST_PAGING_ERROR(10068, "query udf function list paging error", "分页查询UDF函数列表错误"), QUERY_DATASOURCE_BY_TYPE_ERROR(10069, "query datasource by type error", "查询数据源信息错误"), VERIFY_UDF_FUNCTION_NAME_ERROR(10070, "verify udf function name error", "UDF函数名称验证错误"), DELETE_UDF_FUNCTION_ERROR(10071, "delete udf function error", "删除UDF函数错误"), AUTHORIZED_FILE_RESOURCE_ERROR(10072, "authorized file resource error", "授权资源文件错误"), AUTHORIZE_RESOURCE_TREE(10073, "authorize resource tree display error", "授权资源目录树错误"), UNAUTHORIZED_UDF_FUNCTION_ERROR(10074, "unauthorized udf function error", "查询未授权UDF函数错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
AUTHORIZED_UDF_FUNCTION_ERROR(10075, "authorized udf function error", "授权UDF函数错误"), CREATE_SCHEDULE_ERROR(10076, "create schedule error", "创建调度配置错误"), UPDATE_SCHEDULE_ERROR(10077, "update schedule error", "更新调度配置错误"), PUBLISH_SCHEDULE_ONLINE_ERROR(10078, "publish schedule online error", "上线调度配置错误"), OFFLINE_SCHEDULE_ERROR(10079, "offline schedule error", "下线调度配置错误"), QUERY_SCHEDULE_LIST_PAGING_ERROR(10080, "query schedule list paging error", "分页查询调度配置列表错误"), QUERY_SCHEDULE_LIST_ERROR(10081, "query schedule list error", "查询调度配置列表错误"), QUERY_TASK_LIST_PAGING_ERROR(10082, "query task list paging error", "分页查询任务列表错误"), QUERY_TASK_RECORD_LIST_PAGING_ERROR(10083, "query task record list paging error", "分页查询任务记录错误"), CREATE_TENANT_ERROR(10084, "create tenant error", "创建租户错误"), QUERY_TENANT_LIST_PAGING_ERROR(10085, "query tenant list paging error", "分页查询租户列表错误"), QUERY_TENANT_LIST_ERROR(10086, "query tenant list error", "查询租户列表错误"), UPDATE_TENANT_ERROR(10087, "update tenant error", "更新租户错误"), DELETE_TENANT_BY_ID_ERROR(10088, "delete tenant by id error", "删除租户错误"), VERIFY_OS_TENANT_CODE_ERROR(10089, "verify os tenant code error", "操作系统租户验证错误"), CREATE_USER_ERROR(10090, "create user error", "创建用户错误"), QUERY_USER_LIST_PAGING_ERROR(10091, "query user list paging error", "分页查询用户列表错误"), UPDATE_USER_ERROR(10092, "update user error", "更新用户错误"), DELETE_USER_BY_ID_ERROR(10093, "delete user by id error", "删除用户错误"), GRANT_PROJECT_ERROR(10094, "grant project error", "授权项目错误"), GRANT_RESOURCE_ERROR(10095, "grant resource error", "授权资源错误"), GRANT_UDF_FUNCTION_ERROR(10096, "grant udf function error", "授权UDF函数错误"), GRANT_DATASOURCE_ERROR(10097, "grant datasource error", "授权数据源错误"), GET_USER_INFO_ERROR(10098, "get user info error", "获取用户信息错误"), USER_LIST_ERROR(10099, "user list error", "查询用户列表错误"), VERIFY_USERNAME_ERROR(10100, "verify username error", "用户名验证错误"), UNAUTHORIZED_USER_ERROR(10101, "unauthorized user error", "查询未授权用户错误"), AUTHORIZED_USER_ERROR(10102, "authorized user error", "查询授权用户错误"), QUERY_TASK_INSTANCE_LOG_ERROR(10103, "view task instance log error", "查询任务实例日志错误"), DOWNLOAD_TASK_INSTANCE_LOG_FILE_ERROR(10104, "download task instance log file error", "下载任务日志文件错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
CREATE_PROCESS_DEFINITION_ERROR(10105, "create process definition error", "创建工作流错误"), VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR(10106, "verify process definition name unique error", "工作流定义名称验证错误"), UPDATE_PROCESS_DEFINITION_ERROR(10107, "update process definition error", "更新工作流定义错误"), RELEASE_PROCESS_DEFINITION_ERROR(10108, "release process definition error", "上线工作流错误"), QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR(10109, "query detail of process definition error", "查询工作流详细信息错误"), QUERY_PROCESS_DEFINITION_LIST(10110, "query process definition list", "查询工作流列表错误"), ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR(10111, "encapsulation treeview structure error", "查询工作流树形图数据错误"), GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR(10112, "get tasks list by process definition id error", "查询工作流定义节点信息错误"), QUERY_PROCESS_INSTANCE_LIST_PAGING_ERROR(10113, "query process instance list paging error", "分页查询工作流实例列表错误"), QUERY_TASK_LIST_BY_PROCESS_INSTANCE_ID_ERROR(10114, "query task list by process instance id error", "查询任务实例列表错误"), UPDATE_PROCESS_INSTANCE_ERROR(10115, "update process instance error", "更新工作流实例错误"), QUERY_PROCESS_INSTANCE_BY_ID_ERROR(10116, "query process instance by id error", "查询工作流实例错误"), DELETE_PROCESS_INSTANCE_BY_ID_ERROR(10117, "delete process instance by id error", "删除工作流实例错误"), QUERY_SUB_PROCESS_INSTANCE_DETAIL_INFO_BY_TASK_ID_ERROR(10118, "query sub process instance detail info by task id error", "查询子流程任务实例错误"), QUERY_PARENT_PROCESS_INSTANCE_DETAIL_INFO_BY_SUB_PROCESS_INSTANCE_ID_ERROR(10119, "query parent process instance detail info by sub process instance id error", "查询子流程该工作流实例错误"), QUERY_PROCESS_INSTANCE_ALL_VARIABLES_ERROR(10120, "query process instance all variables error", "查询工作流自定义变量信息错误"), ENCAPSULATION_PROCESS_INSTANCE_GANTT_STRUCTURE_ERROR(10121, "encapsulation process instance gantt structure error", "查询工作流实例甘特图数据错误"), QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR(10122, "query process definition list paging error", "分页查询工作流定义列表错误"), SIGN_OUT_ERROR(10123, "sign out error", "退出错误"), OS_TENANT_CODE_HAS_ALREADY_EXISTS(10124, "os tenant code has already exists", "操作系统租户已存在"), IP_IS_EMPTY(10125, "ip is empty", "IP地址不能为空"), SCHEDULE_CRON_REALEASE_NEED_NOT_CHANGE(10126, "schedule release is already {0}", "调度配置上线错误[{0}]"), CREATE_QUEUE_ERROR(10127, "create queue error", "创建队列错误"), QUEUE_NOT_EXIST(10128, "queue {0} not exists", "队列ID[{0}]不存在"), QUEUE_VALUE_EXIST(10129, "queue value {0} already exists", "队列值[{0}]已存在"), QUEUE_NAME_EXIST(10130, "queue name {0} already exists", "队列名称[{0}]已存在"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
UPDATE_QUEUE_ERROR(10131, "update queue error", "更新队列信息错误"), NEED_NOT_UPDATE_QUEUE(10132, "no content changes, no updates are required", "数据未变更,不需要更新队列信息"), VERIFY_QUEUE_ERROR(10133, "verify queue error", "验证队列信息错误"), NAME_NULL(10134, "name must be not null", "名称不能为空"), NAME_EXIST(10135, "name {0} already exists", "名称[{0}]已存在"), SAVE_ERROR(10136, "save error", "保存错误"), DELETE_PROJECT_ERROR_DEFINES_NOT_NULL(10137, "please delete the process definitions in project first!", "请先删除全部工作流定义"), BATCH_DELETE_PROCESS_INSTANCE_BY_IDS_ERROR(10117, "batch delete process instance by ids {0} error", "批量删除工作流实例错误: {0}"), PREVIEW_SCHEDULE_ERROR(10139, "preview schedule error", "预览调度配置错误"), PARSE_TO_CRON_EXPRESSION_ERROR(10140, "parse cron to cron expression error", "解析调度表达式错误"), SCHEDULE_START_TIME_END_TIME_SAME(10141, "The start time must not be the same as the end", "开始时间不能和结束时间一样"), DELETE_TENANT_BY_ID_FAIL(10142, "delete tenant by id fail, for there are {0} process instances in executing using it", "删除租户失败,有[{0}]个运行中的工作流实例正在使用"), DELETE_TENANT_BY_ID_FAIL_DEFINES(10143, "delete tenant by id fail, for there are {0} process definitions using it", "删除租户失败,有[{0}]个工作流定义正在使用"), DELETE_TENANT_BY_ID_FAIL_USERS(10144, "delete tenant by id fail, for there are {0} users using it", "删除租户失败,有[{0}]个用户正在使用"), DELETE_WORKER_GROUP_BY_ID_FAIL(10145, "delete worker group by id fail, for there are {0} process instances in executing using it", "删除Worker分组失败,有[{0}]个运行中的工作流实例正在使用"), QUERY_WORKER_GROUP_FAIL(10146, "query worker group fail ", "查询worker分组失败"), DELETE_WORKER_GROUP_FAIL(10147, "delete worker group fail ", "删除worker分组失败"), USER_DISABLED(10148, "The current user is disabled", "当前用户已停用"), COPY_PROCESS_DEFINITION_ERROR(10149, "copy process definition from {0} to {1} error : {2}", "从{0}复制工作流到{1}错误 : {2}"), MOVE_PROCESS_DEFINITION_ERROR(10150, "move process definition from {0} to {1} error : {2}", "从{0}移动工作流到{1}错误 : {2}"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
SWITCH_PROCESS_DEFINITION_VERSION_ERROR(10151, "Switch process definition version error", "切换工作流版本出错"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR(10152, "Switch process definition version error: not exists process definition, [process definition id {0}]", "切换工作流版本出错:工作流不存在,[工作流id {0}]"), SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR(10153, "Switch process definition version error: not exists process definition version, [process definition id {0}] [version number {1}]", "切换工作流版本出错:工作流版本信息不存在,[工作流id {0}] [版本号 {1}]"), QUERY_PROCESS_DEFINITION_VERSIONS_ERROR(10154, "query process definition versions error", "查询工作流历史版本信息出错"), DELETE_PROCESS_DEFINITION_VERSION_ERROR(10156, "delete process definition version error", "删除工作流历史版本出错"), QUERY_USER_CREATED_PROJECT_ERROR(10157, "query user created project error error", "查询用户创建的项目错误"), PROCESS_DEFINITION_CODES_IS_EMPTY(10158, "process definition codes is empty", "工作流CODES不能为空"), BATCH_COPY_PROCESS_DEFINITION_ERROR(10159, "batch copy process definition error", "复制工作流错误"), BATCH_MOVE_PROCESS_DEFINITION_ERROR(10160, "batch move process definition error", "移动工作流错误"), QUERY_WORKFLOW_LINEAGE_ERROR(10161, "query workflow lineage error", "查询血缘失败"), QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR(10162, "query authorized and user created project error error", "查询授权的和用户创建的项目错误"), DELETE_PROCESS_DEFINITION_EXECUTING_FAIL(10163, "delete process definition by code fail, for there are {0} process instances in executing using it", "删除工作流定义失败,有[{0}]个运行中的工作流实例正在使用"), CHECK_OS_TENANT_CODE_ERROR(10164, "Tenant code invalid, should follow linux's users naming conventions", "非法的租户名,需要遵守 Linux 用户命名规范"), FORCE_TASK_SUCCESS_ERROR(10165, "force task success error", "强制成功任务实例错误"), TASK_INSTANCE_STATE_OPERATION_ERROR(10166, "the status of task instance {0} is {1},Cannot perform force success operation", "任务实例[{0}]的状态是[{1}],无法执行强制成功操作"), DATASOURCE_TYPE_NOT_EXIST(10167, "data source type not exist", "数据源类型不存在"), PROCESS_DEFINITION_NAME_EXIST(10168, "process definition name {0} already exists", "工作流定义名称[{0}]已存在"), DATASOURCE_DB_TYPE_ILLEGAL(10169, "datasource type illegal", "数据源类型参数不合法"), DATASOURCE_PORT_ILLEGAL(10170, "datasource port illegal", "数据源端口参数不合法"), DATASOURCE_OTHER_PARAMS_ILLEGAL(10171, "datasource other params illegal", "数据源其他参数不合法"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
DATASOURCE_NAME_ILLEGAL(10172, "datasource name illegal", "数据源名称不合法"), DATASOURCE_HOST_ILLEGAL(10173, "datasource host illegal", "数据源HOST不合法"), DELETE_WORKER_GROUP_NOT_EXIST(10174, "delete worker group not exist ", "删除worker分组不存在"), CREATE_WORKER_GROUP_FORBIDDEN_IN_DOCKER(10175, "create worker group forbidden in docker ", "创建worker分组在docker中禁止"), DELETE_WORKER_GROUP_FORBIDDEN_IN_DOCKER(10176, "delete worker group forbidden in docker ", "删除worker分组在docker中禁止"), WORKER_ADDRESS_INVALID(10177, "worker address {0} invalid", "worker地址[{0}]无效"), QUERY_WORKER_ADDRESS_LIST_FAIL(10178, "query worker address list fail ", "查询worker地址列表失败"), TRANSFORM_PROJECT_OWNERSHIP(10179, "Please transform project ownership [{0}]", "请先转移项目所有权[{0}]"), QUERY_ALERT_GROUP_ERROR(10180, "query alert group error", "查询告警组错误"), CURRENT_LOGIN_USER_TENANT_NOT_EXIST(10181, "the tenant of the currently login user is not specified", "未指定当前登录用户的租户"), REVOKE_PROJECT_ERROR(10182, "revoke project error", "撤销项目授权错误"), QUERY_AUTHORIZED_USER(10183, "query authorized user error", "查询拥有项目权限的用户错误"), PROJECT_NOT_EXIST(10190, "This project was not found. Please refresh page.", "该项目不存在,请刷新页面"), TASK_INSTANCE_HOST_IS_NULL(10191, "task instance host is null", "任务实例host为空"), QUERY_EXECUTING_WORKFLOW_ERROR(10192, "query executing workflow error", "查询运行的工作流实例错误"), DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL(10193, "delete process definition fail, cause used by other tasks: {0}", "删除工作流定时失败,被其他任务引用:{0}"), DELETE_TASK_USE_BY_OTHER_FAIL(10194, "delete task {0} fail, cause used by other tasks: {1}", "删除任务 {0} 失败,被其他任务引用:{1}"), TASK_WITH_DEPENDENT_ERROR(10195, "task used in other tasks", "删除被其他任务引用"), TASK_SAVEPOINT_ERROR(10196, "task savepoint error", "任务实例savepoint错误"), TASK_STOP_ERROR(10197, "task stop error", "任务实例停止错误"), LIST_TASK_TYPE_ERROR(10200, "list task type error", "查询任务类型列表错误"), DELETE_TASK_TYPE_ERROR(10200, "delete task type error", "删除任务类型错误"), ADD_TASK_TYPE_ERROR(10200, "add task type error", "添加任务类型错误"), CREATE_PROCESS_DEFINITION_LOG_ERROR(10201, "Create process definition log error", "创建 process definition log 对象失败"), PARSE_SCHEDULE_PARAM_ERROR(10202, "Parse schedule parameter error, {0}", "解析 schedule 参数错误, {0}"), SCHEDULE_NOT_EXISTS(10023, "schedule {0} does not exist", "调度 id {0} 不存在"), SCHEDULE_ALREADY_EXISTS(10024, "workflow {0} schedule {1} already exist, please update or delete it",
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
"工作流 {0} 的定时 {1} 已经存在,请更新或删除"), UDF_FUNCTION_NOT_EXIST(20001, "UDF function not found", "UDF函数不存在"), UDF_FUNCTION_EXISTS(20002, "UDF function already exists", "UDF函数已存在"), RESOURCE_NOT_EXIST(20004, "resource not exist", "资源不存在"), RESOURCE_EXIST(20005, "resource already exists", "资源已存在"), RESOURCE_SUFFIX_NOT_SUPPORT_VIEW(20006, "resource suffix do not support online viewing", "资源文件后缀不支持查看"), RESOURCE_SIZE_EXCEED_LIMIT(20007, "upload resource file size exceeds limit", "上传资源文件大小超过限制"), RESOURCE_SUFFIX_FORBID_CHANGE(20008, "resource suffix not allowed to be modified", "资源文件后缀不支持修改"), UDF_RESOURCE_SUFFIX_NOT_JAR(20009, "UDF resource suffix name must be jar", "UDF资源文件后缀名只支持[jar]"), HDFS_COPY_FAIL(20010, "hdfs copy {0} -> {1} fail", "hdfs复制失败:[{0}] -> [{1}]"), RESOURCE_FILE_EXIST(20011, "resource file {0} already exists in hdfs,please delete it or change name!", "资源文件[{0}]在hdfs中已存在,请删除或修改资源名"), RESOURCE_FILE_NOT_EXIST(20012, "resource file {0} not exists !", "资源文件[{0}]不存在"), UDF_RESOURCE_IS_BOUND(20013, "udf resource file is bound by UDF functions:{0}", "udf函数绑定了资源文件[{0}]"), RESOURCE_IS_USED(20014, "resource file is used by process definition", "资源文件被上线的流程定义使用了"), PARENT_RESOURCE_NOT_EXIST(20015, "parent resource not exist", "父资源文件不存在"), RESOURCE_NOT_EXIST_OR_NO_PERMISSION(20016, "resource not exist or no permission,please view the task node and remove error resource", "请检查任务节点并移除无权限或者已删除的资源"), RESOURCE_IS_AUTHORIZED(20017, "resource is authorized to user {0},suffix not allowed to be modified", "资源文件已授权其他用户[{0}],后缀不允许修改"), RESOURCE_HAS_FOLDER(20018, "There are files or folders in the current directory:{0}", "当前目录下有文件或文件夹[{0}]"), USER_NO_OPERATION_PERM(30001, "user has no operation privilege", "当前用户没有操作权限"), USER_NO_OPERATION_PROJECT_PERM(30002, "user {0} is not has project {1} permission", "当前用户[{0}]没有[{1}]项目的操作权限"), PROCESS_INSTANCE_NOT_EXIST(50001, "process instance {0} does not exist", "工作流实例[{0}]不存在"), PROCESS_INSTANCE_EXIST(50002, "process instance {0} already exists", "工作流实例[{0}]已存在"), PROCESS_DEFINE_NOT_EXIST(50003, "process definition {0} does not exist", "工作流定义[{0}]不存在"), PROCESS_DEFINE_NOT_RELEASE(50004, "process definition {0} process version {1} not online", "工作流定义[{0}] 工作流版本[{1}]不是上线状态"), SUB_PROCESS_DEFINE_NOT_RELEASE(50004, "exist sub process definition not online", "存在子工作流定义不是上线状态"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
PROCESS_INSTANCE_ALREADY_CHANGED(50005, "the status of process instance {0} is already {1}", "工作流实例[{0}]的状态已经是[{1}]"), PROCESS_INSTANCE_STATE_OPERATION_ERROR(50006, "the status of process instance {0} is {1},Cannot perform {2} operation", "工作流实例[{0}]的状态是[{1}],无法执行[{2}]操作"), SUB_PROCESS_INSTANCE_NOT_EXIST(50007, "the task belong to process instance does not exist", "子工作流实例不存在"), PROCESS_DEFINE_NOT_ALLOWED_EDIT(50008, "process definition {0} does not allow edit", "工作流定义[{0}]不允许修改"), PROCESS_INSTANCE_EXECUTING_COMMAND(50009, "process instance {0} is executing the command, please wait ...", "工作流实例[{0}]正在执行命令,请稍等..."), PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE(50010, "process instance {0} is not sub process instance", "工作流实例[{0}]不是子工作流实例"), TASK_INSTANCE_STATE_COUNT_ERROR(50011, "task instance state count error", "查询各状态任务实例数错误"), COUNT_PROCESS_INSTANCE_STATE_ERROR(50012, "count process instance state error", "查询各状态流程实例数错误"), COUNT_PROCESS_DEFINITION_USER_ERROR(50013, "count process definition user error", "查询各用户流程定义数错误"), START_PROCESS_INSTANCE_ERROR(50014, "start process instance error", "运行工作流实例错误"), BATCH_START_PROCESS_INSTANCE_ERROR(50014, "batch start process instance error: {0}", "批量运行工作流实例错误: {0}"), PROCESS_INSTANCE_ERROR(50014, "process instance delete error: {0}", "工作流实例删除[{0}]错误"), EXECUTE_PROCESS_INSTANCE_ERROR(50015, "execute process instance error", "操作工作流实例错误"), CHECK_PROCESS_DEFINITION_ERROR(50016, "check process definition error", "工作流定义错误"), QUERY_RECIPIENTS_AND_COPYERS_BY_PROCESS_DEFINITION_ERROR(50017, "query recipients and copyers by process definition error", "查询收件人和抄送人错误"), DATA_IS_NOT_VALID(50017, "data {0} not valid", "数据[{0}]无效"), DATA_IS_NULL(50018, "data {0} is null", "数据[{0}]不能为空"), PROCESS_NODE_HAS_CYCLE(50019, "process node has cycle", "流程节点间存在循环依赖"), PROCESS_NODE_S_PARAMETER_INVALID(50020, "process node {0} parameter invalid", "流程节点[{0}]参数无效"), PROCESS_DEFINE_STATE_ONLINE(50021, "process definition [{0}] is already online", "工作流定义[{0}]已上线"), DELETE_PROCESS_DEFINE_BY_CODE_ERROR(50022, "delete process definition by code error", "删除工作流定义错误"), SCHEDULE_STATE_ONLINE(50023, "the status of schedule {0} is already online", "调度配置[{0}]已上线"), DELETE_SCHEDULE_BY_ID_ERROR(50024, "delete schedule by id error", "删除调度配置错误"), BATCH_DELETE_PROCESS_DEFINE_ERROR(50025, "batch delete process definition error", "批量删除工作流定义错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR(50026, "batch delete process definition by codes error: {0}", "批量删除工作流定义错误: {0}"), DELETE_PROCESS_DEFINE_BY_CODES_ERROR(50026, "delete process definition by codes error: {0}", "删除工作流定义错误: {0}"), TENANT_NOT_SUITABLE(50027, "there is not any tenant suitable, please choose a tenant available.", "没有合适的租户,请选择可用的租户"), EXPORT_PROCESS_DEFINE_BY_ID_ERROR(50028, "export process definition by id error", "导出工作流定义错误"), BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR(50028, "batch export process definition by ids error", "批量导出工作流定义错误"), IMPORT_PROCESS_DEFINE_ERROR(50029, "import process definition error", "导入工作流定义错误"), TASK_DEFINE_NOT_EXIST(50030, "task definition [{0}] does not exist", "任务定义[{0}]不存在"), CREATE_PROCESS_TASK_RELATION_ERROR(50032, "create process task relation error", "创建工作流任务关系错误"), PROCESS_TASK_RELATION_NOT_EXIST(50033, "process task relation [{0}] does not exist", "工作流任务关系[{0}]不存在"), PROCESS_TASK_RELATION_EXIST(50034, "process task relation is already exist, processCode:[{0}]", "工作流任务关系已存在, processCode:[{0}]"), PROCESS_DAG_IS_EMPTY(50035, "process dag is empty", "工作流dag是空"), CHECK_PROCESS_TASK_RELATION_ERROR(50036, "check process task relation error", "工作流任务关系参数错误"), CREATE_TASK_DEFINITION_ERROR(50037, "create task definition error", "创建任务错误"), UPDATE_TASK_DEFINITION_ERROR(50038, "update task definition error", "更新任务定义错误"), QUERY_TASK_DEFINITION_VERSIONS_ERROR(50039, "query task definition versions error", "查询任务历史版本信息出错"), SWITCH_TASK_DEFINITION_VERSION_ERROR(50040, "Switch task definition version error", "切换任务版本出错"), DELETE_TASK_DEFINITION_VERSION_ERROR(50041, "delete task definition version error", "删除任务历史版本出错"), DELETE_TASK_DEFINE_BY_CODE_ERROR(50042, "delete task definition by code error", "删除任务定义错误"), QUERY_DETAIL_OF_TASK_DEFINITION_ERROR(50043, "query detail of task definition error", "查询任务详细信息错误"), QUERY_TASK_DEFINITION_LIST_PAGING_ERROR(50044, "query task definition list paging error", "分页查询任务定义列表错误"), TASK_DEFINITION_NAME_EXISTED(50045, "task definition name [{0}] already exists", "任务定义名称[{0}]已经存在"), RELEASE_TASK_DEFINITION_ERROR(50046, "release task definition error", "上线任务错误"), MOVE_PROCESS_TASK_RELATION_ERROR(50047, "move process task relation error", "移动任务到其他工作流错误"), DELETE_TASK_PROCESS_RELATION_ERROR(50048, "delete process task relation error", "删除工作流任务关系错误"), QUERY_TASK_PROCESS_RELATION_ERROR(50049, "query process task relation error", "查询工作流任务关系错误"), TASK_DEFINE_STATE_ONLINE(50050, "task definition [{0}] is already online", "任务定义[{0}]已上线"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
TASK_HAS_DOWNSTREAM(50051, "Task exists downstream [{0}] dependence", "任务存在下游[{0}]依赖"), TASK_HAS_UPSTREAM(50052, "Task [{0}] exists upstream dependence", "任务[{0}]存在上游依赖"), MAIN_TABLE_USING_VERSION(50053, "the version that the master table is using", "主表正在使用该版本"), PROJECT_PROCESS_NOT_MATCH(50054, "the project and the process is not match", "项目和工作流不匹配"), DELETE_EDGE_ERROR(50055, "delete edge error", "删除工作流任务连接线错误"), NOT_SUPPORT_UPDATE_TASK_DEFINITION(50056, "task state does not support modification", "当前任务不支持修改"), NOT_SUPPORT_COPY_TASK_TYPE(50057, "task type [{0}] does not support copy", "不支持复制的任务类型[{0}]"), BATCH_EXECUTE_PROCESS_INSTANCE_ERROR(50058, "change process instance status error: {0}", "修改工作实例状态错误: {0}"), START_TASK_INSTANCE_ERROR(50059, "start task instance error", "运行任务流实例错误"), DELETE_PROCESS_DEFINE_ERROR(50060, "delete process definition [{0}] error: {1}", "删除工作流定义[{0}]错误: {1}"), CREATE_TASK_DEFINITION_LOG_ERROR(50061, "create task definition log {0} error", "创建任务操作记录 {0} 错误"), DELETE_TASK_DEFINE_BY_CODE_MSG_ERROR(50062, "delete task definition {0} error", "删除任务定义 {0} 错误"), TASK_DEFINITION_NOT_CHANGE(50063, "task definition {0} do not change", "任务定义 {0} 没有变化"), TASK_DEFINITION_NOT_EXISTS(50064, "task definition {0} do not exists", "任务定义 {0} 不存在"), UPDATE_UPSTREAM_TASK_PROCESS_RELATION_ERROR(50065, "update task upstream relation error", "更新任务上游关系错误"), CREATE_PROCESS_TASK_RELATION_LOG_ERROR(50066, "create process task relation log {0}-{1} error", "创建任务关系日志 {0}-{1} 错误"), PROCESS_TASK_RELATION_NOT_EXPECT(50067, "process task relation number not expect, expect {0} but get {1}", "工作流任务关系数量不符合预期,预期 {0} 但是实际 {1}"), PROCESS_TASK_RELATION_BATCH_DELETE_ERROR(50068, "batch delete process task relation {0} error", "批量删除工作流任务关系 {0} 错误"), PROCESS_TASK_RELATION_BATCH_CREATE_ERROR(50069, "batch create process task relation {0} error", "批量创建工作流任务关系 {0} 错误"), HDFS_NOT_STARTUP(60001, "hdfs not startup", "hdfs未启用"), STORAGE_NOT_STARTUP(60002, "storage not startup", "存储未启用"), S3_CANNOT_RENAME(60003, "directory cannot be renamed", "S3无法重命名文件夹"), /** * for monitor */ QUERY_DATABASE_STATE_ERROR(70001, "query database state error", "查询数据库状态错误"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
CREATE_ACCESS_TOKEN_ERROR(70010, "create access token error", "创建访问token错误"), GENERATE_TOKEN_ERROR(70011, "generate token error", "生成token错误"), QUERY_ACCESSTOKEN_LIST_PAGING_ERROR(70012, "query access token list paging error", "分页查询访问token列表错误"), UPDATE_ACCESS_TOKEN_ERROR(70013, "update access token error", "更新访问token错误"), DELETE_ACCESS_TOKEN_ERROR(70014, "delete access token error", "删除访问token错误"), ACCESS_TOKEN_NOT_EXIST(70015, "access token not exist", "访问token不存在"), QUERY_ACCESSTOKEN_BY_USER_ERROR(70016, "query access token by user error", "查询访问指定用户的token错误"), COMMAND_STATE_COUNT_ERROR(80001, "task instance state count error", "查询各状态任务实例数错误"), NEGTIVE_SIZE_NUMBER_ERROR(80002, "query size number error", "查询size错误"), START_TIME_BIGGER_THAN_END_TIME_ERROR(80003, "start time bigger than end time error", "开始时间在结束时间之后错误"), QUEUE_COUNT_ERROR(90001, "queue count error", "查询队列数据错误"), KERBEROS_STARTUP_STATE(100001, "get kerberos startup state error", "获取kerberos启动状态错误"), // audit log QUERY_AUDIT_LOG_LIST_PAGING(10057, "query resources list paging", "分页查询资源列表错误"), // plugin PLUGIN_NOT_A_UI_COMPONENT(110001, "query plugin error, this plugin has no UI component", "查询插件错误,此插件无UI组件"), QUERY_PLUGINS_RESULT_IS_NULL(110002, "query alarm plugins result is empty, please check the startup status of the alarm component and confirm that the relevant alarm plugin is successfully registered", "查询告警插件为空, 请检查告警组件启动状态并确认相关告警插件已注册成功"), QUERY_PLUGINS_ERROR(110003, "query plugins error", "查询插件错误"), QUERY_PLUGIN_DETAIL_RESULT_IS_NULL(110004, "query plugin detail result is null", "查询插件详情结果为空"), UPDATE_ALERT_PLUGIN_INSTANCE_ERROR(110005, "update alert plugin instance error", "更新告警组和告警组插件实例错误"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR(110006, "delete alert plugin instance error", "删除告警组和告警组插件实例错误"), GET_ALERT_PLUGIN_INSTANCE_ERROR(110007, "get alert plugin instance error", "获取告警组和告警组插件实例错误"), CREATE_ALERT_PLUGIN_INSTANCE_ERROR(110008, "create alert plugin instance error", "创建告警组和告警组插件实例错误"), QUERY_ALL_ALERT_PLUGIN_INSTANCE_ERROR(110009, "query all alert plugin instance error", "查询所有告警实例失败"), PLUGIN_INSTANCE_ALREADY_EXIT(110010, "plugin instance already exit", "该告警插件实例已存在"), LIST_PAGING_ALERT_PLUGIN_INSTANCE_ERROR(110011, "query plugin instance page error", "分页查询告警实例失败"), DELETE_ALERT_PLUGIN_INSTANCE_ERROR_HAS_ALERT_GROUP_ASSOCIATED(110012, "failed to delete the alert instance, there is an alarm group associated with this alert instance",
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
"删除告警实例失败,存在与此告警实例关联的警报组"), PROCESS_DEFINITION_VERSION_IS_USED(110013, "this process definition version is used", "此工作流定义版本被使用"), CREATE_ENVIRONMENT_ERROR(120001, "create environment error", "创建环境失败"), ENVIRONMENT_NAME_EXISTS(120002, "this environment name [{0}] already exists", "环境名称[{0}]已经存在"), ENVIRONMENT_NAME_IS_NULL(120003, "this environment name shouldn't be empty.", "环境名称不能为空"), ENVIRONMENT_CONFIG_IS_NULL(120004, "this environment config shouldn't be empty.", "环境配置信息不能为空"), UPDATE_ENVIRONMENT_ERROR(120005, "update environment [{0}] info error", "更新环境[{0}]信息失败"), DELETE_ENVIRONMENT_ERROR(120006, "delete environment error", "删除环境信息失败"), DELETE_ENVIRONMENT_RELATED_TASK_EXISTS(120007, "this environment has been used in tasks,so you can't delete it.", "该环境已经被任务使用,所以不能删除该环境信息"), QUERY_ENVIRONMENT_BY_NAME_ERROR(1200008, "not found environment name [{0}] ", "查询环境名称[{0}]不存在"), QUERY_ENVIRONMENT_BY_CODE_ERROR(1200009, "not found environment code [{0}] ", "查询环境编码[{0}]不存在"), QUERY_ENVIRONMENT_ERROR(1200010, "login user query environment error", "分页查询环境列表错误"), VERIFY_ENVIRONMENT_ERROR(1200011, "verify environment error", "验证环境信息错误"), GET_RULE_FORM_CREATE_JSON_ERROR(1200012, "get rule form create json error", "获取规则 FROM-CREATE-JSON 错误"), QUERY_RULE_LIST_PAGING_ERROR(1200013, "query rule list paging error", "获取规则分页列表错误"), QUERY_RULE_LIST_ERROR(1200014, "query rule list error", "获取规则列表错误"), QUERY_RULE_INPUT_ENTRY_LIST_ERROR(1200015, "query rule list error", "获取规则列表错误"), QUERY_EXECUTE_RESULT_LIST_PAGING_ERROR(1200016, "query execute result list paging error", "获取数据质量任务结果分页错误"), GET_DATASOURCE_OPTIONS_ERROR(1200017, "get datasource options error", "获取数据源Options错误"), GET_DATASOURCE_TABLES_ERROR(1200018, "get datasource tables error", "获取数据源表列表错误"), GET_DATASOURCE_TABLE_COLUMNS_ERROR(1200019, "get datasource table columns error", "获取数据源表列名错误"), CREATE_CLUSTER_ERROR(120020, "create cluster error", "创建集群失败"), CLUSTER_NAME_EXISTS(120021, "this cluster name [{0}] already exists", "集群名称[{0}]已经存在"), CLUSTER_NAME_IS_NULL(120022, "this cluster name shouldn't be empty.", "集群名称不能为空"), CLUSTER_CONFIG_IS_NULL(120023, "this cluster config shouldn't be empty.", "集群配置信息不能为空"), UPDATE_CLUSTER_ERROR(120024, "update cluster [{0}] info error", "更新集群[{0}]信息失败"), DELETE_CLUSTER_ERROR(120025, "delete cluster error", "删除集群信息失败"), DELETE_CLUSTER_RELATED_TASK_EXISTS(120026, "this cluster has been used in tasks,so you can't delete it.", "该集群已经被任务使用,所以不能删除该集群信息"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
QUERY_CLUSTER_BY_NAME_ERROR(1200027, "not found cluster [{0}] ", "查询集群名称[{0}]信息不存在"), QUERY_CLUSTER_BY_CODE_ERROR(1200028, "not found cluster [{0}] ", "查询集群编码[{0}]不存在"), QUERY_CLUSTER_ERROR(1200029, "login user query cluster error", "分页查询集群列表错误"), VERIFY_CLUSTER_ERROR(1200030, "verify cluster error", "验证集群信息错误"), CLUSTER_PROCESS_DEFINITIONS_IS_INVALID(1200031, "cluster worker groups is invalid format", "集群关联的工作组参数解析错误"), UPDATE_CLUSTER_PROCESS_DEFINITION_RELATION_ERROR(1200032, "You can't modify the process definition, because the process definition [{0}] and this cluster [{1}] already be used in the task [{2}]", "您不能修改集群选项,因为该工作流组 [{0}] 和 该集群 [{1}] 已经被用在任务 [{2}] 中"), CLUSTER_NOT_EXISTS(120033, "this cluster can not found in db.", "集群配置数据库里查询不到为空"), DELETE_CLUSTER_RELATED_NAMESPACE_EXISTS(120034, "this cluster has been used in namespace,so you can't delete it.", "该集群已经被命名空间使用,所以不能删除该集群信息"), TASK_GROUP_NAME_EXSIT(130001, "this task group name is repeated in a project", "该任务组名称在一个项目中已经使用"), TASK_GROUP_SIZE_ERROR(130002, "task group size error", "任务组大小应该为大于1的整数"), TASK_GROUP_STATUS_ERROR(130003, "task group status error", "任务组已经被关闭"), TASK_GROUP_FULL(130004, "task group is full", "任务组已经满了"), TASK_GROUP_USED_SIZE_ERROR(130005, "the used size number of task group is dirty", "任务组使用的容量发生了变化"), TASK_GROUP_QUEUE_REL30006, "failed to release task group queue", "任务组资源释放时出现了错误"), TASK_GROUP_QUEUE_AWAKE_ERROR(130007, "awake ask failed", "任务组使唤醒等待任务时发生了错误"), CREATE_TASK_GROUP_ERROR(130008, "create task group error", "创建任务组错误"), UPDATE_TASK_GROUP_ERROR(130009, "update task group list error", "更新任务组错误"), QUERY_TASK_GROUP_LIST_ERROR(130010, "query task group list error", "查询任务组列表错误"), CLOSE_TASK_GROUP_ERROR(130011, "close task group error", "关闭任务组错误"), START_TASK_GROUP_ERROR(130012, "start task group error", "启动任务组错误"), QUERY_TASK_GROUP_QUEUE_LIST_ERROR(130013, "query task group queue list error", "查询任务组队列列表错误"), TASK_GROUP_CACHE_START_FAILED(130014, "cache start failed", "任务组相关的缓存启动失败"), ENVIRONMENT_WORKER_GROUPS_IS_INVALID(130015, "environment worker groups is invalid format", "环境关联的工作组参数解析错误"), UPDATE_ENVIRONMENT_WORKER_GROUP_RELATION_ERROR(130016, "You can't modify the worker group, because the worker group [{0}] and this environment [{1}] already be used in the task [{2}]", "您不能修改工作组选项,因为该工作组 [{0}] 和 该环境 [{1}] 已经被用在任务 [{2}] 中"), TASK_GROUP_QUEUE_ALREADY_START(130017, "task group queue already start", "节点已经获取任务组资源"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
TASK_GROUP_STATUS_CLOSED(130018, "The task group has been closed.", "任务组已经被关闭"), TASK_GROUP_STATUS_OPENED(130019, "The task group has been opened.", "任务组已经被开启"), NOT_ALLOW_TO_DISABLE_OWN_ACCOUNT(130020, "Not allow to disable your own account", "不能停用自己的账号"), NOT_ALLOW_TO_DELETE_DEFAULT_ALARM_GROUP(130030, "Not allow to delete the default alarm group ", "不能删除默认告警组"), TIME_ZONE_ILLEGAL(130031, "time zone [{0}] is illegal", "时区参数 [{0}] 不合法"), QUERY_K8S_NAMESPACE_LIST_PAGING_ERROR(1300001, "login user query k8s namespace list paging error", "分页查询k8s名称空间列表错误"), K8S_NAMESPACE_EXIST(1300002, "k8s namespace {0} already exists", "k8s命名空间[{0}]已存在"), CREATE_K8S_NAMESPACE_ERROR(1300003, "create k8s namespace error", "创建k8s命名空间错误"), UPDATE_K8S_NAMESPACE_ERROR(1300004, "update k8s namespace error", "更新k8s命名空间信息错误"), K8S_NAMESPACE_NOT_EXIST(1300005, "k8s namespace {0} not exists", "命名空间ID[{0}]不存在"), K8S_CLIENT_OPS_ERROR(1300006, "k8s error with exception {0}", "k8s操作报错[{0}]"), VERIFY_K8S_NAMESPACE_ERROR(1300007, "verify k8s and namespace error", "验证k8s命名空间信息错误"), DELETE_K8S_NAMESPACE_BY_ID_ERROR(1300008, "delete k8s namespace by id error", "删除命名空间错误"), VERIFY_PARAMETER_NAME_FAILED(1300009, "The file name verify failed", "文件命名校验失败"), STORE_OPERATE_CREATE_ERROR(1300010, "create the resource failed", "存储操作失败"), GRANT_K8S_NAMESPACE_ERROR(1300011, "grant namespace error", "授权资源错误"), QUERY_UNAUTHORIZED_NAMESPACE_ERROR(1300012, "query unauthorized namespace error", "查询未授权命名空间错误"), QUERY_AUTHORIZED_NAMESPACE_ERROR(1300013, "query authorized namespace error", "查询授权命名空间错误"), QUERY_CAN_USE_K8S_CLUSTER_ERROR(1300014, "login user query can used k8s cluster list error", "查询可用k8s集群错误"), RESOURCE_FULL_NAME_TOO_LONG_ERROR(1300015, "resource's fullname is too long error", "资源文件名过长"), TENANT_FULL_NAME_TOO_LONG_ERROR(1300016, "tenant's fullname is too long error", "租户名过长"), USER_PASSWORD_LENGTH_ERROR(1300017, "user's password length error", "用户密码长度错误"), QUERY_CAN_USE_K8S_NAMESPACE_ERROR(1300018, "login user query can used namespace list error", "查询可用命名空间错误"), NO_CURRENT_OPERATING_PERMISSION(1400001, "The current user does not have this permission.", "当前用户无此权限"), FUNCTION_DISABLED(1400002, "The current feature is disabled.", "当前功能已被禁用"), SCHEDULE_TIME_NUMBER(1400003, "The number of complement dates exceed 100.", "补数日期个数超过100"), DESCRIPTION_TOO_LONG_ERROR(1400004, "description is too long error", "描述过长"), ; private final int code;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/enums/Status.java
private final String enMsg; private final String zhMsg; Status(int code, String enMsg, String zhMsg) { this.code = code; this.enMsg = enMsg; this.zhMsg = zhMsg; } public int getCode() { return this.code; } public String getMsg() { if (Locale.SIMPLIFIED_CHINESE.getLanguage().equals(LocaleContextHolder.getLocale().getLanguage())) { return this.zhMsg; } else { return this.enMsg; } } /** * Retrieve Status enum entity by status code. */ public static Optional<Status> findStatusBy(int code) { for (Status status : Status.values()) { if (code == status.getCode()) { return Optional.of(status); } } return Optional.empty(); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/* * 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* 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.api.service.impl; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_LIST; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_BATCH_COPY; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_CREATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_EXPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_EXPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_IMPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_ONLINE_OFFLINE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; import static org.apache.dolphinscheduler.common.Constants.COPY_SUFFIX; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import static org.apache.dolphinscheduler.common.Constants.EMPTY_STRING; import static org.apache.dolphinscheduler.common.Constants.IMPORT_SUFFIX;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMPLEX_TASK_TYPES; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SQL; import org.apache.dolphinscheduler.api.dto.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.ScheduleParam; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.dto.workflow.WorkflowCreateRequest; import org.apache.dolphinscheduler.api.dto.workflow.WorkflowFilterRequest; import org.apache.dolphinscheduler.api.dto.workflow.WorkflowUpdateRequest; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.service.WorkFlowLineageService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ConditionType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.TaskMainInfo; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.dao.model.PageListingResult; import org.apache.dolphinscheduler.dao.repository.ProcessDefinitionDao; import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.service.model.TaskNode; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; /** * process definition service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String RELEASESTATE = "releaseState"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private UserMapper userMapper; @Autowired private ProcessDefinitionLogMapper processDefinitionLogMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessDefinitionDao processDefinitionDao; @Lazy @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private ProcessTaskRelationLogMapper processTaskRelationLogMapper; @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private TenantMapper tenantMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired private TaskPluginManager taskPluginManager; @Autowired private WorkFlowLineageService workFlowLineageService; /** * create process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ @Override @Transactional public Map<String, Object> createProcessDefinition(User loginUser,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
long projectCode, String name, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson, String otherParamsJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (checkDescriptionLength(description)) { logger.warn("Parameter description is too long."); throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR); } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.", definition.getName(), definition.getCode()); throw new ServiceException(Status.PROCESS_DEFINITION_NAME_EXIST, name); } List<TaskDefinitionLog> taskDefinitionLogs = generateTaskDefinitionList(taskDefinitionJson);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessTaskRelationLog> taskRelationList = generateTaskRelationList(taskRelationJson, taskDefinitionLogs); int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { logger.error("Tenant does not exist."); throw new ServiceException(Status.TENANT_NOT_EXIST); } tenantId = tenant.getId(); } long processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, loginUser.getId(), tenantId); processDefinition.setExecutionType(executionType); return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson); } private void createWorkflowValid(User user, ProcessDefinition processDefinition) { Project project = projectMapper.queryByCode(processDefinition.getProjectCode()); if (project == null) { throw new ServiceException(Status.PROJECT_NOT_FOUND, processDefinition.getProjectCode()); } projectService.checkProjectAndAuthThrowException(user, project, WORKFLOW_CREATE); if (checkDescriptionLength(processDefinition.getDescription())) { throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR); } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), processDefinition.getName());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (definition != null) { throw new ServiceException(Status.PROCESS_DEFINITION_NAME_EXIST, processDefinition.getName()); } this.getTenantId(processDefinition); } private int getTenantId(ProcessDefinition processDefinition) { int tenantId = -1; if (!Constants.DEFAULT.equals(processDefinition.getTenantCode())) { Tenant tenant = tenantMapper.queryByTenantCode(processDefinition.getTenantCode()); if (tenant == null) { throw new ServiceException(Status.TENANT_NOT_EXIST); } tenantId = tenant.getId(); } return tenantId; } private void syncObj2Log(User user, ProcessDefinition processDefinition) { ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition); processDefinitionLog.setOperator(user.getId()); int result = processDefinitionLogMapper.insert(processDefinitionLog); if (result <= 0) { throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_LOG_ERROR); } } /** * create single process definition * * @param loginUser login user * @param workflowCreateRequest the new workflow object will be created * @return New ProcessDefinition object created just now
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
*/ @Override @Transactional public ProcessDefinition createSingleProcessDefinition(User loginUser, WorkflowCreateRequest workflowCreateRequest) { ProcessDefinition processDefinition = workflowCreateRequest.convert2ProcessDefinition(); this.createWorkflowValid(loginUser, processDefinition); long processDefinitionCode; try { processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); } catch (CodeGenerateException e) { throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS); } processDefinition.setTenantId(this.getTenantId(processDefinition)); processDefinition.setCode(processDefinitionCode); processDefinition.setUserId(loginUser.getId()); int create = processDefinitionMapper.insert(processDefinition); if (create <= 0) { throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } this.syncObj2Log(loginUser, processDefinition); return processDefinition; } protected Map<String, Object> createDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { logger.error("Save task definition error."); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion == 0) { logger.error("Save process definition error, processCode:{}.", processDefinition.getCode()); throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } else logger.info("Save process definition complete, processCode:{}, processVersion:{}.", processDefinition.getCode(), insertVersion); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult != Constants.EXIT_CODE_SUCCESS) { logger.error("Save process task relations error, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR); } else logger.info("Save process task relations complete, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); saveOtherRelation(loginUser, processDefinition, result, otherParamsJson); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); return result; } private List<TaskDefinitionLog> generateTaskDefinitionList(String taskDefinitionJson) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
try { List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); if (CollectionUtils.isEmpty(taskDefinitionLogs)) { logger.error("Generate task definition list failed, the given taskDefinitionJson is invalided: {}", taskDefinitionJson); throw new ServiceException(Status.DATA_IS_NOT_VALID, taskDefinitionJson); } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinitionLog.getTaskType()) .taskParams(taskDefinitionLog.getTaskParams()) .dependence(taskDefinitionLog.getDependence()) .build())) { logger.error( "Generate task definition list failed, the given task definition parameter is invalided, taskName: {}, taskDefinition: {}", taskDefinitionLog.getName(), taskDefinitionLog); throw new ServiceException(Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); } } return taskDefinitionLogs; } catch (ServiceException ex) { throw ex; } catch (Exception e) { logger.error("Generate task definition list failed, meet an unknown exception", e); throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR); } } private List<ProcessTaskRelationLog> generateTaskRelationList(String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); if (CollectionUtils.isEmpty(taskRelationList)) { logger.error("Generate task relation list failed the taskRelation list is empty, taskRelationJson: {}", taskRelationJson); throw new ServiceException(Status.DATA_IS_NOT_VALID); } List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream() .map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class)) .collect(Collectors.toList()); List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, taskDefinitionLogs); if (taskNodeList.size() != taskRelationList.size()) { Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode) .collect(Collectors.toSet()); Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet()); Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); if (CollectionUtils.isNotEmpty(codes)) { String taskCodes = StringUtils.join(codes, Constants.COMMA); logger.error("Task definitions do not exist, taskCodes:{}.", taskCodes); throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCodes); } } if (graphHasCycle(taskNodeList)) { logger.error("Process DAG has cycle."); throw new ServiceException(Status.PROCESS_NODE_HAS_CYCLE); } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPostTaskCode() == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.error("The post_task_code or post_task_version of processTaskRelationLog can not be zero, " + "processTaskRelationLogId:{}.", processTaskRelationLog.getId()); throw new ServiceException(Status.CHECK_PROCESS_TASK_RELATION_ERROR); } } return taskRelationList; } catch (ServiceException ex) { throw ex; } catch (Exception e) { logger.error("Check task relation list error, meet an unknown exception, given taskRelationJson: {}", taskRelationJson, e); throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR); } } /** * query process definition list * * @param loginUser login user * @param projectCode project code * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,391
[Improvement][API] Workflow definitions that contain logical task nodes support the copy function
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Currently, the system does not support the replication function of workflow definition including `CONDITIONS`, `SWITCH`, `SUB_PROCESS`, `DEPENDENT` four task nodes. <img width="1472" alt="image" src="https://user-images.githubusercontent.com/37063904/196038586-7e802eeb-2063-468f-83ae-430201149712.png"> ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12391
https://github.com/apache/dolphinscheduler/pull/12392
b7bd8d780356e055998fd0047be7e2cfea85d59b
55004bebe032b7212892686d308adca2ac0e2723
2022-10-16T13:42:00Z
java
2022-10-17T02:28:58Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList); putMsg(result, Status.SUCCESS); return result; } /** * query process definition simple list * * @param loginUser login user * @param projectCode project code * @return definition simple list */ @Override public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); ArrayNode arrayNode = JSONUtils.createArrayNode(); for (ProcessDefinition processDefinition : processDefinitions) { ObjectNode processDefinitionNode = JSONUtils.createObjectNode(); processDefinitionNode.put("id", processDefinition.getId()); processDefinitionNode.put("code", processDefinition.getCode()); processDefinitionNode.put("name", processDefinition.getName()); processDefinitionNode.put("projectCode", processDefinition.getProjectCode());