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,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
/**
* query process definition list by project code
*
* @param projectCode project code
* @return process definition list in the project
*/
@Override
public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) {
Map<String, Object> result = new HashMap<>();
List<DependentSimplifyDefinition> processDefinitions =
processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null);
result.put(Constants.DATA_LIST, processDefinitions);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by process definition code
*
* @param projectCode project code
* @param processDefinitionCode process definition code
* @return task definition list in the process definition
*/
@Override
public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode,
Long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
Set<Long> definitionCodesSet = new HashSet<>();
definitionCodesSet.add(processDefinitionCode);
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet);
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode(
processDefinitions.get(0).getCode(),
processDefinitions.get(0).getVersion());
List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations);
List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) {
DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition();
dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode());
dependentSimplifyDefinition.setName(taskDefinitionLog.getName());
dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion());
taskDefinitionList.add(dependentSimplifyDefinition);
}
result.put(Constants.DATA_LIST, taskDefinitionList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(User loginUser, long projectCode, long code, Integer limit) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_TREE_VIEW);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance
.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper
.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances()
.add(new Instance(processInstance.getId(), processInstance.getName(),
processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime,
processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (!ServerLifeCycleManager.isStopped()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode);
treeViewDto.setType(taskNode.getType());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(),
Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Long.parseLong(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(),
taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(),
taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>();
}
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse);
}
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode, WORKFLOW_BATCH_COPY);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) {
return result;
}
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* Will be deleted
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, Object> result =
checkParams(loginUser, projectCode, codes, targetProjectCode, TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode, String perm) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, perm);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, Object> targetResult =
projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode, perm);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result;
}
protected void doBatchOperateProcessDefinition(User loginUser,
long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes =
processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode =
definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(),
processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList =
processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) {
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType());
return;
}
try {
long taskCode = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
taskDefinitionLog.setProjectCode(targetProjectCode);
taskDefinitionLog.setVersion(0);
taskDefinitionLog.setName(taskDefinitionLog.getName());
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPreTaskCode() > 0) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (processTaskRelationLog.getPostTaskCode() > 0) {
processTaskRelationLog
.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
final long oldProcessDefinitionCode = processDefinition.getCode();
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(0);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(getNewName(processDefinition.getName(), COPY_SUFFIX));
final Date date = new Date();
processDefinition.setCreateTime(date);
processDefinition.setUpdateTime(date);
processDefinition.setReleaseState(ReleaseState.OFFLINE);
if (StringUtils.isNotBlank(processDefinition.getLocations())) {
ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations());
for (int i = 0; i < jsonNodes.size(); i++) {
ObjectNode node = (ObjectNode) jsonNodes.path(i);
node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong()));
jsonNodes.set(i, node);
}
processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(oldProcessDefinitionCode);
if (scheduleObj != null) {
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setCreateTime(date);
scheduleObj.setUpdateTime(date);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int insertResult = scheduleMapper.insert(scheduleObj);
if (insertResult != 1) {
putMsg(result, Status.CREATE_SCHEDULE_ERROR);
throw new ServiceException(Status.CREATE_SCHEDULE_ERROR);
}
}
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs,
otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null,
Lists.newArrayList(), otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* get new Task name or Process name when copy or import operate
* @param originalName Task or Process original name
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param suffix "_copy_" or "_import_"
* @return
*/
public String getNewName(String originalName, String suffix) {
StringBuilder newName = new StringBuilder();
String regex = String.format(".*%s\\d{17}$", suffix);
if (originalName.matches(regex)) {
return newName.append(originalName, 0, originalName.lastIndexOf(suffix))
.append(suffix)
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
return newName.append(originalName)
.append(suffix)
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_SWITCH_TO_THIS_VERSION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR,
processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check batch operate result
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize,
long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_LIST);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinitionLog> processDefinitionVersionsPaging =
processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param code process definition code
* @param version version number
* @return delete result code
*/
@Override
@Transactional
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code,
int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
if (processDefinition.getVersion() == version) {
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version);
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version);
if (deleteLog == 0 || deleteRelationLog == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
deleteOtherRelation(project, result, processDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
@Override
@Transactional
public Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if(checkDescriptionLength(description)){
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
ProcessDefinition processDefinition =
new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, "", timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
result = createEmptyDagDefine(loginUser, processDefinition);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isBlank(scheduleJson)) {
return result;
}
Map<String, Object> scheduleResult = createDagSchedule(loginUser, processDefinition, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> createEmptyDagDefine(User loginUser, ProcessDefinition processDefinition) {
Map<String, Object> result = new HashMap<>();
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
protected Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (scheduleObj == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
Date now = new Date();
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
if (DateUtils.differSec(scheduleObj.getStartTime(), scheduleObj.getEndTime()) == 0) {
logger.warn("The start time must not be the same as the end");
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) {
logger.error("{} verify failure", scheduleObj.getCrontab());
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleObj.getCrontab());
return result;
}
scheduleObj
.setWarningType(scheduleObj.getWarningType() == null ? WarningType.NONE : scheduleObj.getWarningType());
scheduleObj.setWarningGroupId(scheduleObj.getWarningGroupId() == 0 ? 1 : scheduleObj.getWarningGroupId());
scheduleObj.setFailureStrategy(
scheduleObj.getFailureStrategy() == null ? FailureStrategy.CONTINUE : scheduleObj.getFailureStrategy());
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setProcessInstancePriority(scheduleObj.getProcessInstancePriority() == null ? Priority.MEDIUM
: scheduleObj.getProcessInstancePriority());
scheduleObj.setWorkerGroup(scheduleObj.getWorkerGroup() == null ? "default" : scheduleObj.getWorkerGroup());
scheduleObj
.setEnvironmentCode(scheduleObj.getEnvironmentCode() == null ? -1 : scheduleObj.getEnvironmentCode());
scheduleMapper.insert(scheduleObj);
putMsg(result, Status.SUCCESS);
result.put("scheduleId", scheduleObj.getId());
return result;
}
/**
* update process definition basic info
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param otherParamsJson otherParamsJson handle other params
* @param executionType executionType
* @return update result code
*/
@Override
@Transactional
public Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if(checkDescriptionLength(description)){
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy =
JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
processDefinition.set(projectCode, name, description, globalParams, "", timeout, tenantId);
processDefinition.setExecutionType(executionType);
List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper
.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
result = updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy,
Lists.newArrayList(), otherParamsJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (StringUtils.isBlank(scheduleJson)) {
return result;
}
Map<String, Object> scheduleResult = updateDagSchedule(loginUser, projectCode, code, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule schedule = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (schedule == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
FailureStrategy failureStrategy =
schedule.getFailureStrategy() == null ? FailureStrategy.CONTINUE : schedule.getFailureStrategy();
WarningType warningType = schedule.getWarningType() == null ? WarningType.NONE : schedule.getWarningType();
Priority processInstancePriority =
schedule.getProcessInstancePriority() == null ? Priority.MEDIUM : schedule.getProcessInstancePriority();
int warningGroupId = schedule.getWarningGroupId() == 0 ? 1 : schedule.getWarningGroupId();
String workerGroup = schedule.getWorkerGroup() == null ? "default" : schedule.getWorkerGroup();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
long environmentCode = schedule.getEnvironmentCode() == null ? -1 : schedule.getEnvironmentCode();
ScheduleParam param = new ScheduleParam();
param.setStartTime(schedule.getStartTime());
param.setEndTime(schedule.getEndTime());
param.setCrontab(schedule.getCrontab());
param.setTimezoneId(schedule.getTimezoneId());
return schedulerService.updateScheduleByProcessDefinitionCode(
loginUser,
projectCode,
processDefinitionCode,
JSONUtils.toJsonString(param),
warningType,
warningGroupId,
failureStrategy,
processInstancePriority,
workerGroup,
environmentCode);
}
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState
* @return update result code
*/
@Transactional
@Override
public Map<String, Object> releaseWorkflowAndSchedule(User loginUser, long projectCode, long code,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, "processDefinitionCode:" + code);
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList =
processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) {
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
if (updateProcess > 0) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}",
projectCode, scheduleObj.getId(), code);
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), scheduleObj.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* save other relation
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result,
String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
@Override
public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) {
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.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.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.dolphinscheduler.api.dto.gantt.GanttDto;
import org.apache.dolphinscheduler.api.dto.gantt.Task;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.*;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
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.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.placeholder.BusinessTimeUtils;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.plugin.task.api.enums.DependResult;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
import static org.apache.dolphinscheduler.common.Constants.*;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
/**
* process instance service impl
*/
@Service
public class ProcessInstanceServiceImpl extends BaseServiceImpl implements ProcessInstanceService {
public static final String TASK_TYPE = "taskType";
public static final String LOCAL_PARAMS_LIST = "localParamsList";
@Autowired
ProjectMapper projectMapper;
@Autowired
ProjectService projectService;
@Autowired
ProcessService processService;
@Autowired
ProcessInstanceMapper processInstanceMapper;
@Autowired
ProcessDefinitionMapper processDefineMapper;
@Autowired
ProcessDefinitionService processDefinitionService;
@Autowired
ExecutorService execService;
@Autowired
TaskInstanceMapper taskInstanceMapper;
@Autowired
LoggerService loggerService;
@Autowired
ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
TaskDefinitionLogMapper taskDefinitionLogMapper;
@Autowired
UsersService usersService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private TaskPluginManager taskPluginManager;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private CuringParamsService curingGlobalParamsService;
/**
* return top n SUCCESS process instance order by running time which started between startTime and endTime
*/
@Override
public Map<String, Object> queryTopNLongestRunningProcessInstance(User loginUser, long projectCode, int size,
String startTime, String endTime) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (0 > size) {
putMsg(result, Status.NEGTIVE_SIZE_NUMBER_ERROR, size);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
if (Objects.isNull(startTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.START_TIME);
return result;
}
Date start = DateUtils.stringToDate(startTime);
if (Objects.isNull(endTime)) {
putMsg(result, Status.DATA_IS_NULL, Constants.END_TIME);
return result;
}
Date end = DateUtils.stringToDate(endTime);
if (start == null || end == null) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, Constants.START_END_DATE);
return result;
}
if (start.getTime() > end.getTime()) {
putMsg(result, Status.START_TIME_BIGGER_THAN_END_TIME_ERROR, startTime, endTime);
return result;
}
List<ProcessInstance> processInstances = processInstanceMapper.queryTopNProcessInstance(size, start, end,
WorkflowExecutionStatus.SUCCESS, projectCode);
result.put(DATA_LIST, processInstances);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process instance by id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @return process instance detail
*/
@Override
public Map<String, Object> queryProcessInstanceById(User loginUser, long projectCode, Integer processId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId);
ProcessDefinition processDefinition =
processService.findProcessDefinition(processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processId);
} else {
processInstance.setLocations(processDefinition.getLocations());
processInstance.setDagData(processService.genDagData(processDefinition));
result.put(DATA_LIST, processInstance);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* paging query process instance list, filtering according to project, process definition, time range, keyword, process status
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @param processDefineCode process definition code
* @param pageNo page number
* @param pageSize page size
* @param searchVal search value
* @param stateType state type
* @param host host
* @param startDate start time
* @param endDate end time
* @param otherParamsJson otherParamsJson handle other params
* @return process instance list
*/
@Override
public Result queryProcessInstanceList(User loginUser, long projectCode, long processDefineCode, String startDate,
String endDate, String searchVal, String executorName,
WorkflowExecutionStatus stateType, String host, String otherParamsJson,
Integer pageNo, Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
Status resultEnum = (Status) checkResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
int[] statusArray = null;
if (stateType != null) {
statusArray = new int[]{stateType.getCode()};
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
Map<String, Object> checkAndParseDateResult = checkAndParseDateParameters(startDate, endDate);
resultEnum = (Status) checkAndParseDateResult.get(Constants.STATUS);
if (resultEnum != Status.SUCCESS) {
putMsg(result, resultEnum);
return result;
}
Date start = (Date) checkAndParseDateResult.get(Constants.START_TIME);
Date end = (Date) checkAndParseDateResult.get(Constants.END_TIME);
Page<ProcessInstance> page = new Page<>(pageNo, pageSize);
PageInfo<ProcessInstance> pageInfo = new PageInfo<>(pageNo, pageSize);
int executorId = usersService.getUserIdByName(executorName);
IPage<ProcessInstance> processInstanceList = processInstanceMapper.queryProcessInstanceListPaging(page,
project.getCode(), processDefineCode, searchVal, executorId, statusArray, host, start, end);
List<ProcessInstance> processInstances = processInstanceList.getRecords();
List<Integer> userIds = Collections.emptyList();
if (CollectionUtils.isNotEmpty(processInstances)) {
userIds = processInstances.stream().map(ProcessInstance::getExecutorId).collect(Collectors.toList());
}
List<User> users = usersService.queryUser(userIds);
Map<Integer, User> idToUserMap = Collections.emptyMap();
if (CollectionUtils.isNotEmpty(users)) {
idToUserMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
}
for (ProcessInstance processInstance : processInstances) {
processInstance.setDuration(
DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()));
User executor = idToUserMap.get(processInstance.getExecutorId());
if (null != executor) {
processInstance.setExecutorName(executor.getUserName());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
}
pageInfo.setTotal((int) processInstanceList.getTotal());
pageInfo.setTotalList(processInstances);
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query task list by process instance id
*
* @param loginUser login user
* @param projectCode project code
* @param processId process instance id
* @return task list for the process instance
* @throws IOException io exception
*/
@Override
public Map<String, Object> queryTaskListByProcessId(User loginUser, long projectCode,
Integer processId) throws IOException {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processId);
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processId);
return result;
}
List<TaskInstance> taskInstanceList = processService.findValidTaskListByProcessId(processId);
addDependResultForTaskList(taskInstanceList);
Map<String, Object> resultMap = new HashMap<>();
resultMap.put(PROCESS_INSTANCE_STATE, processInstance.getState().toString());
resultMap.put(TASK_LIST, taskInstanceList);
result.put(DATA_LIST, resultMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* add dependent result for dependent task
*/
private void addDependResultForTaskList(List<TaskInstance> taskInstanceList) throws IOException {
for (TaskInstance taskInstance : taskInstanceList) {
if (TASK_TYPE_DEPENDENT.equalsIgnoreCase(taskInstance.getTaskType())) {
Result<ResponseTaskLog> logResult = loggerService.queryLog(
taskInstance.getId(), Constants.LOG_QUERY_SKIP_LINE_NUMBER, Constants.LOG_QUERY_LIMIT);
if (logResult.getCode() == Status.SUCCESS.ordinal()) {
String log = logResult.getData().getMessage();
Map<String, DependResult> resultMap = parseLogForDependentResult(log);
taskInstance.setDependentResult(JSONUtils.toJsonString(resultMap));
}
}
}
}
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
public Map<String, DependResult> parseLogForDependentResult(String log) throws IOException {
Map<String, DependResult> resultMap = new HashMap<>();
if (StringUtils.isEmpty(log)) {
return resultMap;
}
BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(log.getBytes(
StandardCharsets.UTF_8)), StandardCharsets.UTF_8));
String line;
while ((line = br.readLine()) != null) {
if (line.contains(DEPENDENT_SPLIT)) {
String[] tmpStringArray = line.split(":\\|\\|");
if (tmpStringArray.length != 2) {
continue;
}
String dependResultString = tmpStringArray[1];
String[] dependStringArray = dependResultString.split(",");
if (dependStringArray.length != 2) {
continue;
}
String key = dependStringArray[0].trim();
DependResult dependResult = DependResult.valueOf(dependStringArray[1].trim());
resultMap.put(key, dependResult);
}
}
return resultMap;
}
/**
* query sub process instance detail info by task id
*
* @param loginUser login user
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
* @param projectCode project code
* @param taskId task id
* @return sub process instance detail
*/
@Override
public Map<String, Object> querySubProcessInstanceByTaskId(User loginUser, long projectCode, Integer taskId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
TaskInstance taskInstance = processService.findTaskInstanceById(taskId);
if (taskInstance == null) {
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskInstance.getTaskCode());
if (taskDefinition != null && projectCode != taskDefinition.getProjectCode()) {
putMsg(result, Status.TASK_INSTANCE_NOT_EXISTS, taskId);
return result;
}
if (!taskInstance.isSubProcess()) {
putMsg(result, Status.TASK_INSTANCE_NOT_SUB_WORKFLOW_INSTANCE, taskInstance.getName());
return result;
}
ProcessInstance subWorkflowInstance = processService.findSubProcessInstance(
taskInstance.getProcessInstanceId(), taskInstance.getId());
if (subWorkflowInstance == null) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST, taskId);
return result;
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.SUBPROCESS_INSTANCE_ID, subWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance
*
* @param loginUser login user
* @param projectCode project code
* @param taskRelationJson process task relation json
* @param taskDefinitionJson taskDefinitionJson
* @param processInstanceId process instance id
* @param scheduleTime schedule time
* @param syncDefine sync define
* @param globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @return update result code
*/
@Transactional
@Override
public Map<String, Object> updateProcessInstance(User loginUser, long projectCode, Integer processInstanceId,
String taskRelationJson,
String taskDefinitionJson, String scheduleTime, Boolean syncDefine,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
String globalParams,
String locations, int timeout, String tenantCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId);
if (processInstance == null) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
ProcessDefinition processDefinition0 =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition0 != null && projectCode != processDefinition0.getProjectCode()) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId);
return result;
}
if (!processInstance.getState().isFinished()) {
putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR,
processInstance.getName(), processInstance.getState().toString(), "update");
return result;
}
Map<String, String> commandParamMap = JSONUtils.toMap(processInstance.getCommandParam());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
String timezoneId = null;
if (commandParamMap == null || StringUtils.isBlank(commandParamMap.get(Constants.SCHEDULE_TIMEZONE))) {
timezoneId = loginUser.getTimeZone();
} else {
timezoneId = commandParamMap.get(Constants.SCHEDULE_TIMEZONE);
}
setProcessInstance(processInstance, tenantCode, scheduleTime, globalParams, timeout, timezoneId);
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
if (taskDefinitionLogs.isEmpty()) {
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType())
.taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
}
int saveTaskResult = processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs, syncDefine);
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR);
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
List<ProcessTaskRelationLog> taskRelationList =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
result = processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
processDefinition.set(projectCode, processDefinition.getName(), processDefinition.getDescription(),
globalParams, locations, timeout, tenantId);
processDefinition.setUpdateTime(new Date());
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, syncDefine, Boolean.FALSE);
if (insertVersion == 0) {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, syncDefine);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
processInstance.setProcessDefinitionVersion(insertVersion);
int update = processService.updateProcessInstance(processInstance);
if (update == 0) {
putMsg(result, Status.UPDATE_PROCESS_INSTANCE_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_INSTANCE_ERROR);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update process instance attributes
*/
private void setProcessInstance(ProcessInstance processInstance, String tenantCode, String scheduleTime,
String globalParams, int timeout, String timezone) {
Date schedule = processInstance.getScheduleTime();
if (scheduleTime != null) {
schedule = DateUtils.stringToDate(scheduleTime);
}
processInstance.setScheduleTime(schedule);
List<Property> globalParamList = JSONUtils.toList(globalParams, Property.class);
Map<String, String> globalParamMap =
globalParamList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue));
globalParams = curingGlobalParamsService.curingGlobalParams(processInstance.getId(), globalParamMap,
globalParamList, processInstance.getCmdTypeIfComplement(), schedule, timezone);
processInstance.setTimeout(timeout);
processInstance.setTenantCode(tenantCode);
processInstance.setGlobalParams(globalParams);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
/**
* query parent process instance detail info by sub process instance id
*
* @param loginUser login user
* @param projectCode project code
* @param subId sub process id
* @return parent instance detail
*/
@Override
public Map<String, Object> queryParentInstanceBySubId(User loginUser, long projectCode, Integer subId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_INSTANCE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance subInstance = processService.findProcessInstanceDetailById(subId);
if (subInstance == null) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, subId);
return result;
}
if (subInstance.getIsSubProcess() == Flag.NO) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_SUB_PROCESS_INSTANCE, subInstance.getName());
return result;
}
ProcessInstance parentWorkflowInstance = processService.findParentProcessInstance(subId);
if (parentWorkflowInstance == null) {
putMsg(result, Status.SUB_PROCESS_INSTANCE_NOT_EXIST);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
}
Map<String, Object> dataMap = new HashMap<>();
dataMap.put(Constants.PARENT_WORKFLOW_INSTANCE, parentWorkflowInstance.getId());
result.put(DATA_LIST, dataMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete process instance by id, at the same time,delete task instance and their mapping relation data
*
* @param loginUser login user
* @param projectCode project code
* @param processInstanceId process instance id
* @return delete result code
*/
@Override
@Transactional
public Map<String, Object> deleteProcessInstanceById(User loginUser, long projectCode, Integer processInstanceId) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, INSTANCE_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId);
if (null == processInstance) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, String.valueOf(processInstanceId));
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
if (!processInstance.getState().isFinished()) {
putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR,
processInstance.getName(), processInstance.getState().toString(), "delete");
return result;
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, String.valueOf(processInstanceId));
return result;
}
try {
processService.removeTaskLogFile(processInstanceId);
} catch (Exception ) {
}
int delete = processService.deleteWorkProcessInstanceById(processInstanceId);
processService.deleteAllSubWorkProcessByParentId(processInstanceId);
processService.deleteWorkProcessMapByParentId(processInstanceId);
processService.deleteWorkTaskInstanceByProcessInstanceId(processInstanceId);
if (delete > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_INSTANCE_BY_ID_ERROR);
}
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
/**
* view process instance variables
*
* @param projectCode project code
* @param processInstanceId process instance id
* @return variables data
*/
@Override
public Map<String, Object> viewVariables(long projectCode, Integer processInstanceId) {
Map<String, Object> result = new HashMap<>();
ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId);
if (processInstance == null) {
throw new RuntimeException("workflow instance is null");
}
ProcessDefinition processDefinition =
processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition != null && projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.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();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
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);
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);
for (TaskInstance taskInstance : taskInstanceList) {
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(
taskInstance.getTaskCode(), taskInstance.getTaskDefinitionVersion());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
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;
}
/**
* 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) {
throw new RuntimeException("workflow instance is null");
}
ProcessDefinition processDefinition = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessInstanceServiceImpl.java
|
processInstance.getProcessDefinitionCode(),
processInstance.getProcessDefinitionVersion());
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.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);
List<Task> taskList = new ArrayList<>();
for (String node : nodeList) {
TaskInstance taskInstance =
taskInstanceMapper.queryByInstanceIdAndCode(processInstanceId, Long.parseLong(node));
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().toString());
task.setExecutionDate(taskInstance.getStartTime());
task.setDuration(DateUtils.format2Readable(endTime.getTime() - startTime.getTime()));
taskList.add(task);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
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,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.java
|
* 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.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* task instance mapper interface
*/
public interface TaskInstanceMapper extends BaseMapper<TaskInstance> {
List<Integer> queryTaskByProcessIdAndState(@Param("processInstanceId") Integer processInstanceId,
@Param("state") Integer state);
List<TaskInstance> findValidTaskListByProcessId(@Param("processInstanceId") Integer processInstanceId,
@Param("flag") Flag flag);
List<TaskInstance> queryByHostAndStatus(@Param("host") String host,
@Param("states") int[] stateArray);
int setFailoverByHostAndStateArray(@Param("host") String host,
@Param("states") int[] stateArray,
@Param("destStatus") TaskExecutionStatus destStatus);
TaskInstance queryByInstanceIdAndName(@Param("processInstanceId") int processInstanceId,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.java
|
@Param("name") String name);
TaskInstance queryByInstanceIdAndCode(@Param("processInstanceId") int processInstanceId,
@Param("taskCode") Long taskCode);
Integer countTask(@Param("projectCodes") Long[] projectCodes,
@Param("taskIds") int[] taskIds);
/**
* Statistics task instance group by given project codes list by start time
* <p>
* We only need project codes to determine whether the task instance belongs to the user or not.
*
* @param startTime Statistics start time
* @param endTime Statistics end time
* @param projectCodes Project codes list to filter
* @return List of ExecuteStatusCount
*/
List<ExecuteStatusCount> countTaskInstanceStateByProjectCodes(@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("projectCodes") Long[] projectCodes);
/**
* Statistics task instance group by given project codes list by submit time
* <p>
* We only need project codes to determine whether the task instance belongs to the user or not.
*
* @param startTime Statistics start time
* @param endTime Statistics end time
* @param projectCodes Project codes list to filter
* @return List of ExecuteStatusCount
*/
List<ExecuteStatusCount> countTaskInstanceStateByProjectCodesAndStatesBySubmitTime(@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapper.java
|
@Param("projectCodes") Long[] projectCodes,
@Param("states") List<TaskExecutionStatus> states);
IPage<TaskInstance> queryTaskInstanceListPaging(IPage<TaskInstance> page,
@Param("projectCode") Long projectCode,
@Param("processInstanceId") Integer processInstanceId,
@Param("processInstanceName") String processInstanceName,
@Param("searchVal") String searchVal,
@Param("taskName") String taskName,
@Param("executorId") int executorId,
@Param("states") int[] statusArray,
@Param("host") String host,
@Param("taskExecuteType") TaskExecuteType taskExecuteType,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime
);
IPage<TaskInstance> queryStreamTaskInstanceListPaging(IPage<TaskInstance> page,
@Param("projectCode") Long projectCode,
@Param("processDefinitionName") String processDefinitionName,
@Param("searchVal") String searchVal,
@Param("taskName") String taskName,
@Param("executorId") int executorId,
@Param("states") int[] statusArray,
@Param("host") String host,
@Param("taskExecuteType") TaskExecuteType taskExecuteType,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime);
List<TaskInstance> loadAllInfosNoRelease(@Param("processInstanceId") int processInstanceId,
@Param("status") int status);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.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.dao.mapper;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus;
import org.apache.dolphinscheduler.dao.BaseDaoTest;
import org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
import java.util.Date;
import java.util.List;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
public class TaskInstanceMapperTest extends BaseDaoTest {
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProcessInstanceMapper processInstanceMapper;
@Before
public void before() {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setWarningGroupId(0);
processInstance.setCommandParam("");
processInstance.setProcessDefinitionCode(1L);
processInstanceMapper.insert(processInstance);
}
/**
* insert
*
* @return TaskInstance
*/
private TaskInstance insertTaskInstance(int processInstanceId) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
return insertTaskInstance(processInstanceId, "SHELL");
}
/**
* insert
*
* @return ProcessInstance
*/
private ProcessInstance insertProcessInstance() {
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(1);
processInstance.setName("taskName");
processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION);
processInstance.setStartTime(new Date());
processInstance.setEndTime(new Date());
processInstance.setProcessDefinitionCode(1L);
processInstanceMapper.insert(processInstance);
return processInstanceMapper.queryByProcessDefineCode(1L, 1).get(0);
}
/**
* construct a task instance and then insert
*/
private TaskInstance insertTaskInstance(int processInstanceId, String taskType) {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setFlag(Flag.YES);
taskInstance.setName("us task");
taskInstance.setState(TaskExecutionStatus.RUNNING_EXECUTION);
taskInstance.setStartTime(new Date());
taskInstance.setEndTime(new Date());
taskInstance.setProcessInstanceId(processInstanceId);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
taskInstance.setTaskType(taskType);
taskInstanceMapper.insert(taskInstance);
return taskInstance;
}
/**
* test update
*/
@Test
public void testUpdate() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance taskInstance = insertTaskInstance(processInstance.getId());
int update = taskInstanceMapper.updateById(taskInstance);
Assert.assertEquals(1, update);
taskInstanceMapper.deleteById(taskInstance.getId());
}
/**
* test delete
*/
@Test
public void testDelete() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance taskInstance = insertTaskInstance(processInstance.getId());
int delete = taskInstanceMapper.deleteById(taskInstance.getId());
Assert.assertEquals(1, delete);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
/**
* test query
*/
@Test
public void testQuery() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance taskInstance = insertTaskInstance(processInstance.getId());
List<TaskInstance> taskInstances = taskInstanceMapper.selectList(null);
taskInstanceMapper.deleteById(taskInstance.getId());
Assert.assertNotEquals(taskInstances.size(), 0);
}
/**
* test query task instance by process instance id and state
*/
@Test
public void testQueryTaskByProcessIdAndState() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
task.setProcessInstanceId(processInstance.getId());
taskInstanceMapper.updateById(task);
List<Integer> taskInstances = taskInstanceMapper.queryTaskByProcessIdAndState(
task.getProcessInstanceId(),
TaskExecutionStatus.RUNNING_EXECUTION.getCode());
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(taskInstances.size(), 0);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
}
/**
* test find valid task list by process instance id
*/
@Test
public void testFindValidTaskListByProcessId() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
TaskInstance task2 = insertTaskInstance(processInstance.getId());
task.setProcessInstanceId(processInstance.getId());
task2.setProcessInstanceId(processInstance.getId());
taskInstanceMapper.updateById(task);
taskInstanceMapper.updateById(task2);
List<TaskInstance> taskInstances = taskInstanceMapper.findValidTaskListByProcessId(
task.getProcessInstanceId(),
Flag.YES);
task2.setFlag(Flag.NO);
taskInstanceMapper.updateById(task2);
List<TaskInstance> taskInstances1 = taskInstanceMapper.findValidTaskListByProcessId(task.getProcessInstanceId(),
Flag.NO);
taskInstanceMapper.deleteById(task2.getId());
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(taskInstances.size(), 0);
Assert.assertNotEquals(taskInstances1.size(), 0);
}
/**
* test query by host and status
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
@Test
public void testQueryByHostAndStatus() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
task.setHost("111.111.11.11");
taskInstanceMapper.updateById(task);
List<TaskInstance> taskInstances = taskInstanceMapper.queryByHostAndStatus(
task.getHost(), new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()});
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(taskInstances.size(), 0);
}
/**
* test set failover by host and state array
*/
@Test
public void testSetFailoverByHostAndStateArray() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
task.setHost("111.111.11.11");
taskInstanceMapper.updateById(task);
int setResult = taskInstanceMapper.setFailoverByHostAndStateArray(
task.getHost(),
new int[]{TaskExecutionStatus.RUNNING_EXECUTION.getCode()},
TaskExecutionStatus.NEED_FAULT_TOLERANCE);
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(setResult, 0);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
}
/**
* test query by task instance id and name
*/
@Test
public void testQueryByInstanceIdAndName() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
task.setHost("111.111.11.11");
taskInstanceMapper.updateById(task);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(
task.getProcessInstanceId(),
task.getName());
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(taskInstance, null);
}
/**
* test query by task instance id and code
*/
@Test
public void testQueryByInstanceIdAndCode() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
task.setHost("111.111.11.11");
taskInstanceMapper.updateById(task);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
task.getProcessInstanceId(),
task.getTaskCode());
taskInstanceMapper.deleteById(task.getId());
Assert.assertNotEquals(taskInstance, null);
}
/**
* test count task instance
*/
@Test
public void testCountTask() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
ProcessDefinition definition = new ProcessDefinition();
definition.setCode(1L);
definition.setProjectCode(1111L);
definition.setCreateTime(new Date());
definition.setUpdateTime(new Date());
processDefinitionMapper.insert(definition);
taskInstanceMapper.updateById(task);
int countTask = taskInstanceMapper.countTask(
new Long[0],
new int[0]);
int countTask2 = taskInstanceMapper.countTask(
new Long[]{definition.getProjectCode()},
new int[]{task.getId()});
taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.getId());
Assert.assertEquals(countTask, 0);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
Assert.assertEquals(countTask2, 0);
}
/**
* test count task instance state by user
*/
@Test
public void testCountTaskInstanceStateByUser() {
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
ProcessDefinition definition = new ProcessDefinition();
definition.setCode(1111L);
definition.setProjectCode(1111L);
definition.setCreateTime(new Date());
definition.setUpdateTime(new Date());
processDefinitionMapper.insert(definition);
taskInstanceMapper.updateById(task);
List<ExecuteStatusCount> count = taskInstanceMapper.countTaskInstanceStateByProjectCodes(
null, null,
new Long[]{definition.getProjectCode()});
processDefinitionMapper.deleteById(definition.getId());
taskInstanceMapper.deleteById(task.getId());
}
/**
* test page
*/
@Test
public void testQueryTaskInstanceListPaging() {
ProcessDefinition definition = new ProcessDefinition();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,523 |
[Improvement][TaskInstance] reduce database queries
|
### 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
reduce database queries
### 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/11523
|
https://github.com/apache/dolphinscheduler/pull/11522
|
3f2ca7bca3e612b2ce5d22324d22aa33fac04ea2
|
4893bef5a79fc022b74f8c273bd8079517726f35
| 2022-08-17T06:34:06Z |
java
| 2022-08-23T06:27:26Z |
dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/TaskInstanceMapperTest.java
|
definition.setCode(1L);
definition.setProjectCode(1111L);
definition.setCreateTime(new Date());
definition.setUpdateTime(new Date());
processDefinitionMapper.insert(definition);
ProcessInstance processInstance = insertProcessInstance();
TaskInstance task = insertTaskInstance(processInstance.getId());
Page<TaskInstance> page = new Page(1, 3);
IPage<TaskInstance> taskInstanceIPage = taskInstanceMapper.queryTaskInstanceListPaging(
page,
definition.getProjectCode(),
task.getProcessInstanceId(),
"",
"",
"",
0,
new int[0],
"",
TaskExecuteType.BATCH,
null, null
);
processInstanceMapper.deleteById(processInstance.getId());
taskInstanceMapper.deleteById(task.getId());
processDefinitionMapper.deleteById(definition.getId());
Assert.assertEquals(taskInstanceIPage.getTotal(), 0);
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.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.controller;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_COPY_PROCESS_DEFINITION_ERROR;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.BATCH_MOVE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.IMPORT_PROCESS_DEFINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROCESS_DEFINITION_VERSIONS_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.RELEASE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR;
import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.User;
import springfox.documentation.annotations.ApiIgnore;
import org.apache.commons.lang3.StringUtils;
import java.text.MessageFormat;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* process definition controller
*/
@Api(tags = "PROCESS_DEFINITION_TAG")
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@RestController
@RequestMapping("projects/{projectCode}/process-definition")
public class ProcessDefinitionController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionController.class);
@Autowired
private ProcessDefinitionService processDefinitionService;
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return create result code
*/
@ApiOperation(value = "createProcessDefinition", notes = "CREATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, dataTypeClass = String.class),
@ApiImplicitParam(name = "otherParamsJson", value = "OTHER_PARAMS_JSON", required = false, dataTypeClass = String.class)
})
@PostMapping()
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson,
@RequestParam(value = "otherParamsJson", required = false) String otherParamsJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType) {
Map<String, Object> result = processDefinitionService.createProcessDefinition(loginUser, projectCode, name,
description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
return returnDataList(result);
}
/**
* copy process definition
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
* @param codes process definition codes
* @param targetProjectCode target project code
* @return copy result code
*/
@ApiOperation(value = "batchCopyByCodes", notes = "COPY_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataTypeClass = String.class, example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataTypeClass = long.class, example = "123")
})
@PostMapping(value = "/batch-copy")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_COPY_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result copyProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "codes", required = true) String codes,
@RequestParam(value = "targetProjectCode", required = true) long targetProjectCode) {
return returnDataList(
processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, codes, targetProjectCode));
}
/**
* move process definition
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param targetProjectCode target project code
* @return move result code
*/
@ApiOperation(value = "batchMoveByCodes", notes = "MOVE_PROCESS_DEFINITION_NOTES")
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataTypeClass = String.class, example = "3,4"),
@ApiImplicitParam(name = "targetProjectCode", value = "TARGET_PROJECT_CODE", required = true, dataTypeClass = long.class, example = "123")
})
@PostMapping(value = "/batch-move")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_MOVE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result moveProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "codes", required = true) String codes,
@RequestParam(value = "targetProjectCode", required = true) long targetProjectCode) {
return returnDataList(
processDefinitionService.batchMoveProcessDefinition(loginUser, projectCode, codes, targetProjectCode));
}
/**
* verify process definition name unique
*
* @param loginUser login user
* @param projectCode project code
* @param name name
* @return true if process definition name not exists, otherwise false
*/
@ApiOperation(value = "verify-name", notes = "VERIFY_PROCESS_DEFINITION_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class)
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_PROCESS_DEFINITION_NAME_UNIQUE_ERROR)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result verifyProcessDefinitionName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name) {
Map<String, Object> result = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, name);
return returnDataList(result);
}
/**
* update process definition, with whole process definition object including task definition, task relation and location.
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param locations locations for nodes
* @param timeout timeout
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return update result code
*/
@ApiOperation(value = "update", notes = "UPDATE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "123456789"),
@ApiImplicitParam(name = "locations", value = "PROCESS_DEFINITION_LOCATIONS", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, dataTypeClass = String.class),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataTypeClass = ReleaseState.class),
@ApiImplicitParam(name = "otherParamsJson", value = "OTHER_PARAMS_JSON", required = false, dataTypeClass = String.class)
})
@PutMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "locations", required = false) String locations,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "taskRelationJson", required = true) String taskRelationJson,
@RequestParam(value = "taskDefinitionJson", required = true) String taskDefinitionJson,
@RequestParam(value = "otherParamsJson", required = false) String otherParamsJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType,
@RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) {
Map<String, Object> result = processDefinitionService.updateProcessDefinition(loginUser, projectCode, name,
code, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataList(result);
}
if (releaseState == ReleaseState.ONLINE) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
result = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, code, releaseState);
}
return returnDataList(result);
}
/**
* query process definition version paging list info
*
* @param loginUser login user info
* @param projectCode project code
* @param pageNo the process definition version list current page number
* @param pageSize the process definition version list page size
* @param code the process definition code
* @return the process definition version list
*/
@ApiOperation(value = "queryVersions", notes = "QUERY_PROCESS_DEFINITION_VERSIONS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataTypeClass = int.class, example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataTypeClass = int.class, example = "10"),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "1")
})
@GetMapping(value = "/{code}/versions")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_VERSIONS_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionVersions(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "pageNo") int pageNo,
@RequestParam(value = "pageSize") int pageSize,
@PathVariable(value = "code") long code) {
Result result = checkPageParams(pageNo, pageSize);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
if (!result.checkResult()) {
return result;
}
result = processDefinitionService.queryProcessDefinitionVersions(loginUser, projectCode, pageNo, pageSize,
code);
return result;
}
/**
* switch certain process definition version
*
* @param loginUser login user info
* @param projectCode project code
* @param code the process definition code
* @param version the version user want to switch
* @return switch version result code
*/
@ApiOperation(value = "switchVersion", notes = "SWITCH_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataTypeClass = int.class, example = "100")
})
@GetMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(SWITCH_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result switchProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
processDefinitionService.switchProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
* delete the certain process definition version by version and process definition code
*
* @param loginUser login user info
* @param projectCode project code
* @param code the process definition code
* @param version the process definition version user want to delete
* @return delete version result code
*/
@ApiOperation(value = "deleteVersion", notes = "DELETE_PROCESS_DEFINITION_VERSION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "1"),
@ApiImplicitParam(name = "version", value = "VERSION", required = true, dataTypeClass = int.class, example = "100")
})
@DeleteMapping(value = "/{code}/versions/{version}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINITION_VERSION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProcessDefinitionVersion(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code") long code,
@PathVariable(value = "version") int version) {
Map<String, Object> result =
processDefinitionService.deleteProcessDefinitionVersion(loginUser, projectCode, code, version);
return returnDataList(result);
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
* release process definition
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState release state
* @return release result code
*/
@ApiOperation(value = "release", notes = "RELEASE_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "123456789"),
@ApiImplicitParam(name = "releaseState", value = "PROCESS_DEFINITION_RELEASE", required = true, dataTypeClass = ReleaseState.class),
})
@PostMapping(value = "/{code}/release")
@ResponseStatus(HttpStatus.OK)
@ApiException(RELEASE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result releaseProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "releaseState", required = true) ReleaseState releaseState) {
Map<String, Object> result =
processDefinitionService.releaseProcessDefinition(loginUser, projectCode, code, releaseState);
return returnDataList(result);
}
/**
* query detail of process definition by code
*
* @param loginUser login user
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionByCode", notes = "QUERY_PROCESS_DEFINITION_BY_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "123456789")
})
@GetMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code", required = true) long code) {
Map<String, Object> result =
processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* query detail of process definition by name
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @return process definition detail
*/
@ApiOperation(value = "queryProcessDefinitionByName", notes = "QUERY_PROCESS_DEFINITION_BY_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
})
@GetMapping(value = "/query-by-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DETAIL_OF_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result<ProcessDefinition> queryProcessDefinitionByName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("name") String name) {
Map<String, Object> result =
processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, name);
return returnDataList(result);
}
/**
* query Process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list
*/
@ApiOperation(value = "queryList", notes = "QUERY_PROCESS_DEFINITION_LIST_NOTES")
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode);
return returnDataList(result);
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
* query Process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list
*/
@ApiOperation(value = "querySimpleList", notes = "QUERY_PROCESS_DEFINITION_SIMPLE_LIST_NOTES")
@GetMapping(value = "/simple-list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionSimpleList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionSimpleList(loginUser, projectCode);
return returnDataList(result);
}
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param otherParamsJson otherParamsJson handle other params
* @param pageNo page number
* @param pageSize page size
* @param userId user id
* @return process definition page
*/
@ApiOperation(value = "queryListPaging", notes = "QUERY_PROCESS_DEFINITION_LIST_PAGING_NOTES")
@ApiImplicitParams({
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", required = false, dataTypeClass = String.class),
@ApiImplicitParam(name = "userId", value = "USER_ID", required = false, dataTypeClass = int.class, example = "100"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataTypeClass = int.class, example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataTypeClass = int.class, example = "10"),
@ApiImplicitParam(name = "otherParamsJson", value = "OTHER_PARAMS_JSON", required = false, dataTypeClass = String.class)
})
@GetMapping()
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST_PAGING_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result queryProcessDefinitionListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam(value = "otherParamsJson", required = false) String otherParamsJson,
@RequestParam(value = "userId", required = false, defaultValue = "0") Integer userId,
@RequestParam("pageNo") Integer pageNo,
@RequestParam("pageSize") Integer pageSize) {
Result result = checkPageParams(pageNo, pageSize);
if (!result.checkResult()) {
return result;
}
searchVal = ParameterUtils.handleEscapes(searchVal);
return processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectCode, searchVal,
otherParamsJson, userId, pageNo, pageSize);
}
/**
* encapsulation tree view structure
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@ApiOperation(value = "viewTree", notes = "VIEW_TREE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataTypeClass = int.class, example = "100")
})
@GetMapping(value = "/{code}/view-tree")
@ResponseStatus(HttpStatus.OK)
@ApiException(ENCAPSULATION_TREEVIEW_STRUCTURE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result viewTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable("code") long code,
@RequestParam("limit") Integer limit) {
Map<String, Object> result = processDefinitionService.viewTree(loginUser, projectCode, code, limit);
return returnDataList(result);
}
/**
* get tasks list by process definition code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return task list
*/
@ApiOperation(value = "getTasksByDefinitionCode", notes = "GET_TASK_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "100")
})
@GetMapping(value = "/{code}/tasks")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListByDefinitionCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable("code") long code) {
Map<String, Object> result =
processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* get tasks list map by process definition multiple code
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @return node list data
*/
@ApiOperation(value = "getTaskListByDefinitionCodes", notes = "GET_TASK_LIST_BY_DEFINITION_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODES", required = true, dataTypeClass = String.class, example = "100,200,300")
})
@GetMapping(value = "/batch-query-tasks")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getNodeListMapByDefinitionCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("codes") String codes) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
Map<String, Object> result =
processDefinitionService.getNodeListMapByDefinitionCodes(loginUser, projectCode, codes);
return returnDataList(result);
}
/**
* get process definition list map by project code
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list data
*/
@ApiOperation(value = "getProcessListByProjectCode", notes = "GET_PROCESS_LIST_BY_PROCESS_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, dataTypeClass = long.class, example = "100")
})
@GetMapping(value = "/query-process-definition-list")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getProcessListByProjectCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result = processDefinitionService.queryProcessDefinitionListByProjectCode(projectCode);
return returnDataList(result);
}
/**
* get task definition list by process definition code
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list data
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiOperation(value = "getTaskListByProcessDefinitionCode", notes = "GET_TASK_LIST_BY_PROCESS_CODE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, dataTypeClass = long.class, example = "100"),
@ApiImplicitParam(name = "processDefinitionCode", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "100"),
})
@GetMapping(value = "/query-task-definition-list")
@ResponseStatus(HttpStatus.OK)
@ApiException(GET_TASKS_LIST_BY_PROCESS_DEFINITION_ID_ERROR)
public Result getTaskListByProcessDefinitionCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "processDefinitionCode") Long processDefinitionCode) {
Map<String, Object> result = processDefinitionService
.queryTaskDefinitionListByProcessDefinitionCode(projectCode, processDefinitionCode);
return returnDataList(result);
}
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return delete result code
*/
@ApiOperation(value = "deleteByCode", notes = "DELETE_PROCESS_DEFINITION_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", dataTypeClass = int.class, example = "100")
})
@DeleteMapping(value = "/{code}")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_PROCESS_DEFINE_BY_CODE_ERROR)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result deleteProcessDefinitionByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable("code") long code) {
Map<String, Object> result =
processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, code);
return returnDataList(result);
}
/**
* batch delete process definition by codes
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition code list
* @return delete result code
*/
@ApiOperation(value = "batchDeleteByCodes", notes = "BATCH_DELETE_PROCESS_DEFINITION_BY_IDS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = String.class)
})
@PostMapping(value = "/batch-delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result batchDeleteProcessDefinitionByCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("codes") String codes) {
Map<String, Object> result = new HashMap<>();
Set<String> deleteFailedCodeSet = new HashSet<>();
if (!StringUtils.isEmpty(codes)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
String[] processDefinitionCodeArray = codes.split(",");
for (String strProcessDefinitionCode : processDefinitionCodeArray) {
long code = Long.parseLong(strProcessDefinitionCode);
try {
Map<String, Object> deleteResult =
processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, code);
if (!Status.SUCCESS.equals(deleteResult.get(Constants.STATUS))) {
deleteFailedCodeSet.add((String) deleteResult.get(Constants.MSG));
logger.error((String) deleteResult.get(Constants.MSG));
}
} catch (Exception e) {
deleteFailedCodeSet.add(MessageFormat.format(Status.DELETE_PROCESS_DEFINE_BY_CODES_ERROR.getMsg(),
strProcessDefinitionCode));
}
}
}
if (!deleteFailedCodeSet.isEmpty()) {
putMsg(result, BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR, String.join("\n", deleteFailedCodeSet));
} else {
putMsg(result, Status.SUCCESS);
}
return returnDataList(result);
}
/**
* batch export process definition by codes
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param response response
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
*/
@ApiOperation(value = "batchExportByCodes", notes = "BATCH_EXPORT_PROCESS_DEFINITION_BY_CODES_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "codes", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = String.class)
})
@PostMapping(value = "/batch-export")
@ResponseBody
@AccessLogAnnotation(ignoreRequestArgs = {"loginUser", "response"})
public void batchExportProcessDefinitionByCodes(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("codes") String codes,
HttpServletResponse response) {
try {
processDefinitionService.batchExportProcessDefinitionByCodes(loginUser, projectCode, codes, response);
} catch (Exception e) {
logger.error(Status.BATCH_EXPORT_PROCESS_DEFINE_BY_IDS_ERROR.getMsg(), e);
}
}
/**
* query all process definition by project code
*
* @param loginUser login user
* @param projectCode project code
* @return process definition list
*/
@ApiOperation(value = "queryAllByProjectCode", notes = "QUERY_PROCESS_DEFINITION_All_BY_PROJECT_CODE_NOTES")
@GetMapping(value = "/all")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_PROCESS_DEFINITION_LIST)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
public Result queryAllProcessDefinitionByProjectCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode) {
Map<String, Object> result =
processDefinitionService.queryAllProcessDefinitionByProjectCode(loginUser, projectCode);
return returnDataList(result);
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file resource file
* @return import result code
*/
@ApiOperation(value = "importProcessDefinition", notes = "IMPORT_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataTypeClass = MultipartFile.class)
})
@PostMapping(value = "/import")
@ApiException(IMPORT_PROCESS_DEFINE_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = {"loginUser", "file"})
public Result importProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam("file") MultipartFile file) {
Map<String, Object> result;
if ("application/zip".equals(file.getContentType())) {
result = processDefinitionService.importSqlProcessDefinition(loginUser, projectCode, file);
} else {
result = processDefinitionService.importProcessDefinition(loginUser, projectCode, file);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
return returnDataList(result);
}
/**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
@ApiOperation(value = "createEmptyProcessDefinition", notes = "CREATE_EMPTY_PROCESS_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", required = true, dataTypeClass = long.class, example = "123456789"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, dataTypeClass = String.class)
})
@PostMapping(value = "/empty")
@ResponseStatus(HttpStatus.OK)
@ApiException(CREATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result createEmptyProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "scheduleJson", required = false) String scheduleJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType) {
return returnDataList(processDefinitionService.createEmptyProcessDefinition(loginUser, projectCode, name,
description, globalParams,
timeout, tenantCode, scheduleJson, executionType));
}
/**
* update process definition basic info, not including task definition, task relation and location.
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param executionType executionType
* @param releaseState releaseState
* @param otherParamsJson otherParamsJson handle other params
* @return update result code
*/
@ApiOperation(value = "updateBasicInfo", notes = "UPDATE_PROCESS_DEFINITION_BASIC_INFO_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = String.class),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "123456789"),
@ApiImplicitParam(name = "description", value = "PROCESS_DEFINITION_DESC", required = false, dataTypeClass = String.class),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = false, dataTypeClass = ReleaseState.class),
@ApiImplicitParam(name = "otherParamsJson", value = "OTHER_PARAMS_JSON", required = false, dataTypeClass = String.class)
})
@PutMapping(value = "/{code}/basic-info")
@ResponseStatus(HttpStatus.OK)
@ApiException(UPDATE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result updateProcessDefinitionBasicInfo(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@RequestParam(value = "name", required = true) String name,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "globalParams", required = false, defaultValue = "[]") String globalParams,
@RequestParam(value = "timeout", required = false, defaultValue = "0") int timeout,
@RequestParam(value = "tenantCode", required = true) String tenantCode,
@RequestParam(value = "scheduleJson", required = false) String scheduleJson,
@RequestParam(value = "otherParamsJson", required = false) String otherParamsJson,
@RequestParam(value = "executionType", defaultValue = "PARALLEL") ProcessExecutionTypeEnum executionType,
@RequestParam(value = "releaseState", required = false, defaultValue = "OFFLINE") ReleaseState releaseState) {
Map<String, Object> result = processDefinitionService.updateProcessDefinitionBasicInfo(loginUser, projectCode,
name, code, description, globalParams,
timeout, tenantCode, scheduleJson, otherParamsJson, executionType);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataList(result);
}
if (releaseState == ReleaseState.ONLINE) {
result = processDefinitionService.releaseWorkflowAndSchedule(loginUser, projectCode, code, releaseState);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionController.java
|
return returnDataList(result);
}
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState
* @return update result code
*/
@ApiOperation(value = "releaseWorkflowAndSchedule", notes = "RELEASE_WORKFLOW_SCHEDULE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectCode", value = "PROCESS_DEFINITION_NAME", required = true, dataTypeClass = long.class),
@ApiImplicitParam(name = "code", value = "PROCESS_DEFINITION_CODE", required = true, dataTypeClass = long.class, example = "123456789"),
@ApiImplicitParam(name = "releaseState", value = "RELEASE_PROCESS_DEFINITION_NOTES", required = true, dataTypeClass = ReleaseState.class)
})
@PostMapping(value = "/{code}/release-workflow")
@ResponseStatus(HttpStatus.OK)
@ApiException(RELEASE_PROCESS_DEFINITION_ERROR)
@AccessLogAnnotation(ignoreRequestArgs = "loginUser")
public Result releaseWorkflowAndSchedule(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectCode", value = "PROJECT_CODE", required = true) @PathVariable long projectCode,
@PathVariable(value = "code", required = true) long code,
@RequestParam(value = "releaseState", required = true, defaultValue = "OFFLINE") ReleaseState releaseState) {
return returnDataList(
processDefinitionService.releaseWorkflowAndSchedule(loginUser, projectCode, code, releaseState));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### 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
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### 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/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.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.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.