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
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
logger.warn("Process task relation list is null.");
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition =
processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson,
List<TaskDefinitionLog> taskDefinitionLogsList) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("Process task relation data is null.");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelation> taskRelationList =
JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList);
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("Task node data is empty.");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("Process DAG has cycle.");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskNode.getType())
.taskParams(taskNode.getTaskParams())
.dependence(taskNode.getDependence())
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
.switchResult(taskNode.getSwitchResult())
.build())) {
logger.error("Task node {} parameter invalid.", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e);
}
return result;
}
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.error("Process definitions do not exist, codes:{}.", defineCodeSet);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())
.forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
Set<Long> codesInProject = processDefinitionListInProject.stream()
.map(ProcessDefinition::getCode).collect(Collectors.toSet());
logger.error("Process definitions do not exist in project, projectCode:{}, processDefinitionsCodes:{}.",
processDefinitionListInProject.get(0).getProjectCode(), codesInProject);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList =
processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by project code
*
* @param projectCode project code
* @return process definition list in the project
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
@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
.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet);
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode(
processDefinitions.get(0).getCode(),
processDefinitions.get(0).getVersion());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<TaskDefinitionLog> taskDefinitionLogsList =
taskDefinitionLogDao.getTaskDefineLogList(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) {
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
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 = taskDefinitionLogDao.getTaskDefineLogList(processTaskRelationMapper
.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit < 0) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
return result;
}
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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());
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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);
}
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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);
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) {
Map<String, Object> result =
checkParams(loginUser, projectCode, codes, targetProjectCode, TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (projectCode == targetProjectCode) {
logger.warn("Project code is same as target project code, projectCode:{}.", projectCode);
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 (StringUtils.isEmpty(processDefinitionCodes)) {
logger.error("Parameter processDefinitionCodes is empty, projectCode is {}.", projectCode);
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult =
projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode, perm);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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);
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
logger.info("Copy process definition...");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<TaskDefinitionLog> taskDefinitionLogs =
taskDefinitionLogDao.getTaskDefineLogList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
try {
long taskCode = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) {
logger.error("Generate task definition code error, projectCode:{}.", targetProjectCode, 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()));
}
}
final long oldProcessDefinitionCode = processDefinition.getCode();
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
logger.error("Generate process definition code error, projectCode:{}.", targetProjectCode, e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(null);
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.setId(null);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setCreateTime(date);
scheduleObj.setUpdateTime(date);
int insertResult = scheduleMapper.insert(scheduleObj);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (insertResult != 1) {
logger.error("Schedule create error, processDefinitionCode:{}.", processDefinition.getCode());
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) {
logger.error("Copy process definition error, processDefinitionCode from {} to {}.",
oldProcessDefinitionCode, processDefinition.getCode(), e);
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
logger.info("Move process definition...");
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null,
Lists.newArrayList(), otherParamsJson));
} catch (Exception e) {
logger.error("Move process definition error, processDefinitionCode:{}.",
processDefinition.getCode(), 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() + "]");
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
}
/**
* get new Task name or Process name when copy or import operate
* @param originalName Task or Process original name
* @param suffix "_copy_" or "_import_"
* @return new name
*/
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @return switch process definition version result code
*/
@Override
@Transactional
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code,
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()) {
logger.error(
"Switch process definition error because it does not exist, projectCode:{}, processDefinitionCode:{}.",
projectCode, code);
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)) {
logger.error(
"Switch process definition error because version does not exist, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR,
processDefinition.getCode(), version);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
logger.error(
"Switch process definition version error, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
logger.info("Switch process definition version complete, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check batch operate result
*
* @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()) {
String failedProcess = String.join(",", failedProcessList);
if (isCopy) {
logger.error(
"Copy process definition error, srcProjectCode:{}, targetProjectCode:{}, failedProcessList:{}.",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
srcProjectCode, targetProjectCode, failedProcess);
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, failedProcess);
} else {
logger.error(
"Move process definition error, srcProjectCode:{}, targetProjectCode:{}, failedProcessList:{}.",
srcProjectCode, targetProjectCode, failedProcess);
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, failedProcess);
}
} else {
logger.info("Batch {} process definition complete, srcProjectCode:{}, targetProjectCode:{}.",
isCopy ? "copy" : "move", srcProjectCode, targetProjectCode);
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
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize,
long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
* @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,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
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, VERSION_DELETE);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
if (processDefinition.getVersion() == version) {
logger.warn(
"Process definition can not be deleted due to version is being used, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, 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) {
logger.error(
"Delete process definition version error, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
deleteOtherRelation(project, result, processDefinition);
logger.info(
"Delete process definition version complete, projectCode:{}, processDefinitionCode:{}, version:{}.",
projectCode, code, version);
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,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String scheduleJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.",
definition.getName(), definition.getCode());
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) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
logger.error("Generate process definition code error, projectCode:{}.", projectCode, e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
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) {
logger.error("Create empty process definition error.");
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);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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) {
logger.error("Save process definition error, processDefinitionCode:{}.", processDefinition.getCode());
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);
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 schedule start time must not be the same as the end, processDefinitionCode:{}.",
processDefinition.getCode());
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) {
logger.error("CronExpression verify failure, cron:{}.", 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());
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @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,
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);
boolean hasProjectAndWritePerm = projectService.hasProjectAndWritePerm(loginUser, project, result);
if (!hasProjectAndWritePerm) {
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
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) {
logger.error("Tenant does not exist.");
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
logger.warn("Process definition is not allowed to be modified due to {}, processDefinitionCode:{}.",
ReleaseState.ONLINE.getDescp(), processDefinition.getCode());
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.",
definition.getName(), definition.getCode());
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) {
logger.error("Update process definition basic info error.");
return result;
}
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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
throw new ServiceException(scheduleResultStatus);
}
return result;
}
private void updateWorkflowValid(User user, ProcessDefinition oldProcessDefinition,
ProcessDefinition newProcessDefinition) {
if (oldProcessDefinition.getReleaseState() == ReleaseState.ONLINE) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, oldProcessDefinition.getName());
}
Project project = projectMapper.queryByCode(oldProcessDefinition.getProjectCode());
projectService.checkProjectAndAuthThrowException(user, project, WORKFLOW_UPDATE);
if (checkDescriptionLength(newProcessDefinition.getDescription())) {
throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR);
}
if (!oldProcessDefinition.getName().equals(newProcessDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper
.verifyByDefineName(newProcessDefinition.getProjectCode(), newProcessDefinition.getName());
if (definition != null) {
throw new ServiceException(Status.PROCESS_DEFINITION_NAME_EXIST, newProcessDefinition.getName());
}
}
}
/**
* update single resource workflow
*
* @param loginUser login user
* @param workflowCode workflow resource code want to update
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param workflowUpdateRequest workflow update resource object
* @return Process definition
*/
@Override
@Transactional
public ProcessDefinition updateSingleProcessDefinition(User loginUser,
long workflowCode,
WorkflowUpdateRequest workflowUpdateRequest) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(workflowCode);
if (processDefinition == null) {
throw new ServiceException(Status.PROCESS_DEFINE_NOT_EXIST, workflowCode);
}
ProcessDefinition processDefinitionUpdate = workflowUpdateRequest.mergeIntoProcessDefinition(processDefinition);
this.updateWorkflowValid(loginUser, processDefinition, processDefinitionUpdate);
if (processDefinitionUpdate.getTenantCode() != null) {
Tenant tenant = tenantMapper.queryByTenantCode(processDefinitionUpdate.getTenantCode());
if (tenant == null) {
throw new ServiceException(Status.TENANT_NOT_EXIST);
}
processDefinitionUpdate.setTenantId(tenant.getId());
}
int update = processDefinitionMapper.updateById(processDefinitionUpdate);
if (update <= 0) {
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
this.syncObj2Log(loginUser, processDefinition);
return processDefinition;
}
protected Map<String, Object> updateDagSchedule(User loginUser,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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();
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,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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,
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;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
logger.error("Process definition does not exist, code:{}.", code);
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj == null) {
logger.error("Schedule cron does not exist, processDefinitionCode:{}.", code);
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)) {
logger.warn("Process definition has no task relation, processDefinitionCode:{}.", code);
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
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, projectCode:{}, processDefinitionCode:{}, scheduleId:{}.",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
projectCode, code, scheduleObj.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
logger.error(
"Set schedule offline error, projectCode:{}, processDefinitionCode:{}, scheduleId:{}",
projectCode, code, scheduleObj.getId());
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
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* view process variables
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return variables data
*/
@Override
public Map<String, Object> viewVariables(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode,
code);
putMsg(result, PROCESS_DEFINE_NOT_EXIST, code);
return result;
}
List<Property> globalParams = processDefinition.getGlobalParamList();
Map<String, Map<String, Object>> localUserDefParams = getLocalParams(processDefinition);
Map<String, Object> resultMap = new HashMap<>();
if (Objects.nonNull(globalParams)) {
resultMap.put(GLOBAL_PARAMS, globalParams);
}
if (Objects.nonNull(localUserDefParams)) {
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(ProcessDefinition processDefinition) {
Map<String, Map<String, Object>> localUserDefParams = new HashMap<>();
Set<Long> taskCodeSet = new TreeSet<>();
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode())
.forEach(processTaskRelation -> {
if (processTaskRelation.getPreTaskCode() > 0) {
taskCodeSet.add(processTaskRelation.getPreTaskCode());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (processTaskRelation.getPostTaskCode() > 0) {
taskCodeSet.add(processTaskRelation.getPostTaskCode());
}
});
taskDefinitionMapper.queryByCodeList(taskCodeSet)
.stream().forEach(taskDefinition -> {
Map<String, Object> localParamsMap = new HashMap<>();
String localParams = JSONUtils.getNodeString(taskDefinition.getTaskParams(), LOCAL_PARAMS);
if (!StringUtils.isEmpty(localParams)) {
List<Property> localParamsList = JSONUtils.toList(localParams, Property.class);
localParamsMap.put(TASK_TYPE, taskDefinition.getTaskType());
localParamsMap.put(LOCAL_PARAMS_LIST, localParamsList);
if (CollectionUtils.isNotEmpty(localParamsList)) {
localUserDefParams.put(taskDefinition.getName(), localParamsMap);
}
}
});
return localUserDefParams;
}
/**
* 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
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_BATCH_COPY;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_CREATE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_DELETE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_IMPORT;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_ONLINE_OFFLINE;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE;
import static org.apache.dolphinscheduler.common.constants.Constants.DEFAULT;
import static org.apache.dolphinscheduler.common.constants.Constants.EMPTY_STRING;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.isA;
import org.apache.dolphinscheduler.api.dto.workflow.WorkflowCreateRequest;
import org.apache.dolphinscheduler.api.dto.workflow.WorkflowFilterRequest;
import org.apache.dolphinscheduler.api.dto.workflow.WorkflowUpdateRequest;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.common.enums.UserType;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.graph.DAG;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.DagData;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskMainInfo;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.model.PageListingResult;
import org.apache.dolphinscheduler.dao.repository.ProcessDefinitionDao;
import org.apache.dolphinscheduler.dao.repository.TaskDefinitionLogDao;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.commons.lang3.StringUtils;
import java.io.ByteArrayOutputStream;
import java.nio.charset.StandardCharsets;
import java.text.MessageFormat;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.mock.web.MockMultipartFile;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
@ExtendWith(MockitoExtension.class)
public class ProcessDefinitionServiceTest extends BaseServiceTestTool {
private static final String taskRelationJson =
"[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":123456789,"
+ "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"},{\"name\":\"\",\"preTaskCode\":123456789,"
+ "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"}]";
private static final String taskDefinitionJson =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
"[{\"code\":123456789,\"name\":\"test1\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\","
+ "\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},"
+ "\"switchResult\":{}},\"flag\":\"YES\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\","
+ "\"timeoutNotifyStrategy\":null,\"timeout\":0,\"environmentCode\":-1},{\"code\":123451234,\"name\":\"test2\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\","
+ "\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{},"
+ "\"switchResult\":{}},\"flag\":\"YES\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\","
+ "\"timeoutNotifyStrategy\":\"WARN\",\"timeout\":0,\"environmentCode\":-1}]";
@InjectMocks
private ProcessDefinitionServiceImpl processDefinitionService;
@Mock
private ProcessDefinitionMapper processDefinitionMapper;
@Mock
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Mock
private ProcessDefinitionDao processDefinitionDao;
@Mock
private ProcessTaskRelationMapper processTaskRelationMapper;
@Mock
private ProjectMapper projectMapper;
@Mock
private ProjectServiceImpl projectService;
@Mock
private ScheduleMapper scheduleMapper;
@Mock
private SchedulerService schedulerService;
@Mock
private ProcessService processService;
@Mock
private TaskDefinitionLogDao taskDefinitionLogDao;
@Mock
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
private ProcessInstanceService processInstanceService;
@Mock
private TenantMapper tenantMapper;
@Mock
private DataSourceMapper dataSourceMapper;
@Mock
private WorkFlowLineageService workFlowLineageService;
protected User user;
protected Exception exception;
protected final static long projectCode = 1L;
protected final static long projectCodeOther = 2L;
protected final static long processDefinitionCode = 11L;
protected final static String name = "testProcessDefinitionName";
protected final static String description = "this is a description";
protected final static String releaseState = "ONLINE";
protected final static int warningGroupId = 1;
protected final static int timeout = 60;
protected final static String executionType = "PARALLEL";
protected final static String tenantCode = "tenant";
@BeforeEach
public void before() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setTenantId(2);
loginUser.setUserType(UserType.GENERAL_USER);
loginUser.setUserName("admin");
user = loginUser;
}
@Test
public void testQueryProcessDefinitionList() {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(user, projectCode);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
List<ProcessDefinition> resourceList = new ArrayList<>();
resourceList.add(getProcessDefinition());
Mockito.when(processDefinitionMapper.queryAllDefinitionList(project.getCode())).thenReturn(resourceList);
Map<String, Object> checkSuccessRes =
processDefinitionService.queryProcessDefinitionList(user, projectCode);
Assertions.assertEquals(Status.SUCCESS, checkSuccessRes.get(Constants.STATUS));
}
@Test
public void testQueryProcessDefinitionListPaging() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
try {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(null);
Mockito.doThrow(new ServiceException(Status.PROJECT_NOT_EXIST)).when(projectService)
.checkProjectAndAuthThrowException(user, null, WORKFLOW_DEFINITION);
processDefinitionService.queryProcessDefinitionListPaging(user, projectCode, "", "", 1, 5, 0);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
} catch (ServiceException serviceException) {
Assertions.assertEquals(Status.PROJECT_NOT_EXIST.getCode(), serviceException.getCode());
}
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
user.setId(1);
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, project,
WORKFLOW_DEFINITION);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
PageListingResult<ProcessDefinition> pageListingResult = PageListingResult.<ProcessDefinition>builder()
.records(Collections.emptyList())
.currentPage(1)
.pageSize(10)
.totalCount(30)
.build();
Mockito.when(processDefinitionDao.listingProcessDefinition(
Mockito.eq(0),
Mockito.eq(10),
Mockito.eq(""),
Mockito.eq(1),
Mockito.eq(project.getCode()))).thenReturn(pageListingResult);
PageInfo<ProcessDefinition> pageInfo = processDefinitionService.queryProcessDefinitionListPaging(
user, project.getCode(), "", "", 1, 0, 10);
Assertions.assertNotNull(pageInfo);
}
@Test
public void testQueryProcessDefinitionByCode() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Tenant tenant = new Tenant();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
tenant.setId(1);
tenant.setTenantCode("root");
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> map = processDefinitionService.queryProcessDefinitionByCode(user, 1L, 1L);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
DagData dagData = new DagData(getProcessDefinition(), null, null);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData);
Map<String, Object> instanceNotexitRes =
processDefinitionService.queryProcessDefinitionByCode(user, projectCode, 1L);
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS));
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(getProcessDefinition());
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Mockito.when(tenantMapper.queryById(1)).thenReturn(tenant);
Map<String, Object> successRes =
processDefinitionService.queryProcessDefinitionByCode(user, projectCode, 46L);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testQueryProcessDefinitionByName() {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> map =
processDefinitionService.queryProcessDefinitionByName(user, projectCode, "test_def");
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Mockito.when(processDefinitionMapper.queryByDefineName(project.getCode(), "test_def")).thenReturn(null);
Map<String, Object> instanceNotExitRes =
processDefinitionService.queryProcessDefinitionByName(user, projectCode, "test_def");
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS));
Mockito.when(processDefinitionMapper.queryByDefineName(project.getCode(), "test"))
.thenReturn(getProcessDefinition());
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> successRes =
processDefinitionService.queryProcessDefinitionByName(user, projectCode, "test");
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testBatchCopyProcessDefinition() {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Project project = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_BATCH_COPY))
.thenReturn(result);
Map<String, Object> map =
processDefinitionService.batchCopyProcessDefinition(user, projectCode, StringUtils.EMPTY, 2L);
Assertions.assertEquals(Status.PROCESS_DEFINITION_CODES_IS_EMPTY, map.get(Constants.STATUS));
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_BATCH_COPY))
.thenReturn(result);
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition(
user, projectCode, String.valueOf(project.getId()), 2L);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map1.get(Constants.STATUS));
Project project1 = getProject(projectCodeOther);
Mockito.when(projectMapper.queryByCode(projectCodeOther)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCodeOther, WORKFLOW_BATCH_COPY))
.thenReturn(result);
putMsg(result, Status.SUCCESS, projectCodeOther);
ProcessDefinition definition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(definition);
Set<Long> definitionCodes = new HashSet<>();
for (String code : String.valueOf(processDefinitionCode).split(Constants.COMMA)) {
try {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
long parse = Long.parseLong(code);
definitionCodes.add(parse);
} catch (NumberFormatException e) {
Assertions.fail();
}
}
Mockito.when(processDefinitionMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Mockito.when(processService.saveProcessDefine(user, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2);
Map<String, Object> map3 = processDefinitionService.batchCopyProcessDefinition(
user, projectCodeOther, String.valueOf(processDefinitionCode), projectCode);
Assertions.assertEquals(Status.SUCCESS, map3.get(Constants.STATUS));
}
@Test
public void testBatchMoveProcessDefinition() {
Project project1 = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1);
Project project2 = getProject(projectCodeOther);
Mockito.when(projectMapper.queryByCode(projectCodeOther)).thenReturn(project2);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project1, projectCode, TASK_DEFINITION_MOVE))
.thenReturn(result);
Mockito.when(projectService.checkProjectAndAuth(user, project2, projectCodeOther, TASK_DEFINITION_MOVE))
.thenReturn(result);
ProcessDefinition definition = getProcessDefinition();
definition.setVersion(1);
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(definition);
Set<Long> definitionCodes = new HashSet<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
for (String code : String.valueOf(processDefinitionCode).split(Constants.COMMA)) {
try {
long parse = Long.parseLong(code);
definitionCodes.add(parse);
} catch (NumberFormatException e) {
Assertions.fail();
}
}
Mockito.when(processDefinitionMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Mockito.when(processService.saveProcessDefine(user, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2);
Mockito.when(processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode))
.thenReturn(getProcessTaskRelation());
putMsg(result, Status.SUCCESS);
Map<String, Object> successRes = processDefinitionService.batchMoveProcessDefinition(
user, projectCode, String.valueOf(processDefinitionCode), projectCodeOther);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void deleteProcessDefinitionByCodeTest() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 2L));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.when(processDefinitionMapper.queryByCode(6L)).thenReturn(this.getProcessDefinition());
Mockito.doThrow(new ServiceException(Status.PROJECT_NOT_FOUND)).when(projectService)
.checkProjectAndAuthThrowException(user, project, WORKFLOW_DEFINITION_DELETE);
exception = Assertions.assertThrows(ServiceException.class,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 6L));
Assertions.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), ((ServiceException) exception).getCode());
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, project,
WORKFLOW_DEFINITION_DELETE);
Mockito.when(processDefinitionMapper.queryByCode(1L)).thenReturn(null);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 1L));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 46L));
Assertions.assertEquals(Status.USER_NO_OPERATION_PERM.getCode(), ((ServiceException) exception).getCode());
user.setUserType(UserType.ADMIN_USER);
processDefinition.setReleaseState(ReleaseState.ONLINE);
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 46L));
Assertions.assertEquals(Status.PROCESS_DEFINE_STATE_ONLINE.getCode(), ((ServiceException) exception).getCode());
processDefinition.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule());
Mockito.when(scheduleMapper.deleteById(46)).thenReturn(1);
Mockito.when(processDefinitionMapper.deleteById(processDefinition.getId())).thenReturn(1);
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()))
.thenReturn(1);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode()))
.thenReturn(Collections.emptySet());
processDefinitionService.deleteProcessDefinitionByCode(user, 46L);
Schedule schedule = getSchedule();
schedule.setReleaseState(ReleaseState.ONLINE);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(schedule);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 46L));
Assertions.assertEquals(Status.SCHEDULE_STATE_ONLINE.getCode(), ((ServiceException) exception).getCode());
user.setUserType(UserType.ADMIN_USER);
TaskMainInfo taskMainInfo = getTaskMainInfo().get(0);
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode()))
.thenReturn(ImmutableSet.copyOf(getTaskMainInfo()));
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.deleteProcessDefinitionByCode(user, 46L));
Assertions.assertEquals(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL.getCode(),
((ServiceException) exception).getCode());
schedule.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefinitionMapper.deleteById(46)).thenReturn(1);
Mockito.when(scheduleMapper.deleteById(schedule.getId())).thenReturn(1);
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()))
.thenReturn(1);
Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule());
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode()))
.thenReturn(Collections.emptySet());
Assertions.assertDoesNotThrow(() -> processDefinitionService.deleteProcessDefinitionByCode(user, 46L));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
@Test
public void batchDeleteProcessDefinitionByCodeTest() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
final String twoCodes = "11,12";
Set<Long> definitionCodes = Lists.newArrayList(twoCodes.split(Constants.COMMA)).stream()
.map(Long::parseLong).collect(Collectors.toSet());
ProcessDefinition process = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(process);
Mockito.when(processDefinitionMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Throwable exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.batchDeleteProcessDefinitionByCodes(user, projectCode, twoCodes));
String formatter = MessageFormat.format(Status.BATCH_DELETE_PROCESS_DEFINE_BY_CODES_ERROR.getMsg(),
"12[process definition not exist]");
Assertions.assertEquals(formatter, exception.getMessage());
Map<String, Object> result = new HashMap<>();
final String singleCodes = "11";
definitionCodes = Lists.newArrayList(singleCodes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
Mockito.when(processDefinitionMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList);
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(process);
user.setUserType(UserType.ADMIN_USER);
putMsg(result, Status.SUCCESS, projectCode);
process.setReleaseState(ReleaseState.ONLINE);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.batchDeleteProcessDefinitionByCodes(user, projectCode, singleCodes));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
String subFormatter =
MessageFormat.format(Status.PROCESS_DEFINE_STATE_ONLINE.getMsg(), process.getName());
formatter =
MessageFormat.format(Status.DELETE_PROCESS_DEFINE_ERROR.getMsg(), process.getName(), subFormatter);
Assertions.assertEquals(formatter, exception.getMessage());
process.setReleaseState(ReleaseState.OFFLINE);
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(process);
Mockito.when(processDefinitionMapper.deleteById(process.getId())).thenReturn(1);
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), process.getCode()))
.thenReturn(1);
Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), process.getCode()))
.thenReturn(Collections.emptySet());
putMsg(result, Status.SUCCESS, projectCode);
Map<String, Object> deleteSuccess =
processDefinitionService.batchDeleteProcessDefinitionByCodes(user, projectCode, singleCodes);
Assertions.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS));
}
@Test
public void testReleaseProcessDefinition() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_ONLINE_OFFLINE))
.thenReturn(result);
Map<String, Object> map = processDefinitionService.releaseProcessDefinition(user, projectCode,
processDefinitionCode, ReleaseState.OFFLINE);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(getProcessDefinition());
List<ProcessTaskRelation> processTaskRelationList = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(projectCode);
processTaskRelation.setProcessDefinitionCode(46L);
processTaskRelation.setPostTaskCode(123L);
processTaskRelationList.add(processTaskRelation);
Mockito.when(processService.findRelationByCode(46L, 1)).thenReturn(processTaskRelationList);
Map<String, Object> onlineRes =
processDefinitionService.releaseProcessDefinition(user, projectCode, 46, ReleaseState.ONLINE);
Assertions.assertEquals(Status.SUCCESS, onlineRes.get(Constants.STATUS));
Map<String, Object> onlineWithResourceRes =
processDefinitionService.releaseProcessDefinition(user, projectCode, 46, ReleaseState.ONLINE);
Assertions.assertEquals(Status.SUCCESS, onlineWithResourceRes.get(Constants.STATUS));
Map<String, Object> failRes =
processDefinitionService.releaseProcessDefinition(user, projectCode, 46, ReleaseState.getEnum(2));
Assertions.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failRes.get(Constants.STATUS));
}
@Test
public void testVerifyProcessDefinitionName() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_CREATE))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
.thenReturn(result);
Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(user,
projectCode, "test_pdf", 0);
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processDefinitionMapper.verifyByDefineName(project.getCode(), "test_pdf")).thenReturn(null);
Map<String, Object> processNotExistRes =
processDefinitionService.verifyProcessDefinitionName(user, projectCode, "test_pdf", 0);
Assertions.assertEquals(Status.SUCCESS, processNotExistRes.get(Constants.STATUS));
Mockito.when(processDefinitionMapper.verifyByDefineName(project.getCode(), "test_pdf"))
.thenReturn(getProcessDefinition());
Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(user,
projectCode, "test_pdf", 0);
Assertions.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST, processExistRes.get(Constants.STATUS));
}
@Test
public void testCheckProcessNodeList() {
Map<String, Object> dataNotValidRes = processDefinitionService.checkProcessNodeList(null, null);
Assertions.assertEquals(Status.DATA_IS_NOT_VALID, dataNotValidRes.get(Constants.STATUS));
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> taskEmptyRes =
processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs);
Assertions.assertEquals(Status.PROCESS_DAG_IS_EMPTY, taskEmptyRes.get(Constants.STATUS));
}
@Test
public void testGetTaskNodeListByDefinitionCode() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, null)).thenReturn(result);
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(null);
Map<String, Object> processDefinitionNullRes =
processDefinitionService.getTaskNodeListByDefinitionCode(user, projectCode, 46L);
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
ProcessDefinition processDefinition = getProcessDefinition();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null));
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
Map<String, Object> dataNotValidRes =
processDefinitionService.getTaskNodeListByDefinitionCode(user, projectCode, 46L);
Assertions.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS));
}
@Test
public void testGetTaskNodeListByDefinitionCodes() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, null)).thenReturn(result);
String defineCodes = "46";
Set<Long> defineCodeSet = Lists.newArrayList(defineCodes.split(Constants.COMMA)).stream().map(Long::parseLong)
.collect(Collectors.toSet());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Mockito.when(processDefinitionMapper.queryByCodes(defineCodeSet)).thenReturn(null);
Map<String, Object> processNotExistRes =
processDefinitionService.getNodeListMapByDefinitionCodes(user, projectCode, defineCodes);
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
ProcessDefinition processDefinition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefinitionMapper.queryByCodes(defineCodeSet)).thenReturn(processDefinitionList);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null));
Project project1 = getProject(projectCode);
List<Project> projects = new ArrayList<>();
projects.add(project1);
Mockito.when(projectMapper.queryProjectCreatedAndAuthorizedByUserId(user.getId())).thenReturn(projects);
Map<String, Object> successRes =
processDefinitionService.getNodeListMapByDefinitionCodes(user, projectCode, defineCodes);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testQueryAllProcessDefinitionByProjectCode() {
Map<String, Object> result = new HashMap<>();
Project project = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
ProcessDefinition processDefinition = getProcessDefinition();
List<ProcessDefinition> processDefinitionList = new ArrayList<>();
processDefinitionList.add(processDefinition);
Mockito.when(processDefinitionMapper.queryAllDefinitionList(projectCode)).thenReturn(processDefinitionList);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Map<String, Object> successRes =
processDefinitionService.queryAllProcessDefinitionByProjectCode(user, projectCode);
Assertions.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS));
}
@Test
public void testViewTree() {
Project project1 = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(user, project1, projectCode, WORKFLOW_TREE_VIEW))
.thenReturn(result);
ProcessDefinition processDefinition = getProcessDefinition();
Map<String, Object> processDefinitionNullRes =
processDefinitionService.viewTree(user, processDefinition.getProjectCode(), 46, 10);
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
putMsg(result, Status.SUCCESS, projectCode);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(user, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result);
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>());
Map<String, Object> taskNullRes =
processDefinitionService.viewTree(user, processDefinition.getProjectCode(), 46, 10);
Assertions.assertEquals(Status.SUCCESS, taskNullRes.get(Constants.STATUS));
Map<String, Object> taskNotNuLLRes =
processDefinitionService.viewTree(user, processDefinition.getProjectCode(), 46, 10);
Assertions.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
}
@Test
public void testSubProcessViewTree() {
ProcessDefinition processDefinition = getProcessDefinition();
Mockito.when(processDefinitionMapper.queryByCode(46L)).thenReturn(processDefinition);
Project project1 = getProject(1);
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1);
Mockito.when(projectService.checkProjectAndAuth(user, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result);
Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>());
Mockito.when(processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode))
.thenReturn(getProcessTaskRelation());
Mockito.when(taskDefinitionLogDao.getTaskDefineLogList(any())).thenReturn(new ArrayList<>());
Map<String, Object> taskNotNuLLRes =
processDefinitionService.viewTree(user, processDefinition.getProjectCode(), 46, 10);
Assertions.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS));
}
@Test
public void testUpdateProcessDefinition() {
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.SUCCESS);
Project project = getProject(projectCode);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_UPDATE))
.thenReturn(result);
Mockito.when(projectService.hasProjectAndWritePerm(user, project, result)).thenReturn(true);
try {
processDefinitionService.updateProcessDefinition(user, projectCode, "test", 1,
"", "", "", 0, "root", null, "", null, ProcessExecutionTypeEnum.PARALLEL);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Assertions.fail();
} catch (ServiceException ex) {
Assertions.assertEquals(Status.DATA_IS_NOT_VALID.getCode(), ex.getCode());
}
}
@Test
public void testBatchExportProcessDefinitionByCodes() {
processDefinitionService.batchExportProcessDefinitionByCodes(null, 1L, null, null);
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
processDefinitionService.batchExportProcessDefinitionByCodes(user, projectCode, "1", null);
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(1);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
HttpServletResponse response = Mockito.mock(HttpServletResponse.class);
DagData dagData = new DagData(getProcessDefinition(), null, null);
Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData);
processDefinitionService.batchExportProcessDefinitionByCodes(user, projectCode, "1", response);
Assertions.assertNotNull(processDefinitionService.exportProcessDagData(processDefinition));
}
@Test
public void testImportSqlProcessDefinition() throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
ZipOutputStream outputStream = new ZipOutputStream(byteArrayOutputStream);
outputStream.putNextEntry(new ZipEntry("import_sql/"));
outputStream.putNextEntry(new ZipEntry("import_sql/a.sql"));
outputStream.write(
"-- upstream: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
outputStream.putNextEntry(new ZipEntry("import_sql/b.sql"));
outputStream
.write("-- name: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8));
outputStream.close();
MockMultipartFile mockMultipartFile =
new MockMultipartFile("import_sql.zip", byteArrayOutputStream.toByteArray());
DataSource dataSource = Mockito.mock(DataSource.class);
Mockito.when(dataSource.getId()).thenReturn(1);
Mockito.when(dataSource.getType()).thenReturn(DbType.MYSQL);
Mockito.when(dataSourceMapper.queryDataSourceByNameAndUserId(user.getId(), "mysql_1")).thenReturn(dataSource);
Project project = getProject(projectCode);
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, Status.SUCCESS);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_IMPORT))
.thenReturn(result);
Mockito.when(processService.saveTaskDefine(Mockito.same(user), Mockito.eq(projectCode), Mockito.notNull(),
Mockito.anyBoolean())).thenReturn(2);
Mockito.when(processService.saveProcessDefine(Mockito.same(user), Mockito.notNull(), Mockito.notNull(),
Mockito.anyBoolean())).thenReturn(1);
Mockito.when(
processService.saveTaskRelation(Mockito.same(user), Mockito.eq(projectCode), Mockito.anyLong(),
Mockito.eq(1), Mockito.notNull(), Mockito.notNull(), Mockito.anyBoolean()))
.thenReturn(0);
result = processDefinitionService.importSqlProcessDefinition(user, projectCode, mockMultipartFile);
Assertions.assertEquals(result.get(Constants.STATUS), Status.SUCCESS);
}
@Test
public void testGetNewProcessName() {
String processName1 = "test_copy_" + DateUtils.getCurrentTimeStamp();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
final String newName1 = processDefinitionService.getNewName(processName1, Constants.COPY_SUFFIX);
Assertions.assertEquals(2, newName1.split(Constants.COPY_SUFFIX).length);
String processName2 = "wf_copy_all_ods_data_to_d";
final String newName2 = processDefinitionService.getNewName(processName2, Constants.COPY_SUFFIX);
Assertions.assertEquals(3, newName2.split(Constants.COPY_SUFFIX).length);
String processName3 = "test_import_" + DateUtils.getCurrentTimeStamp();
final String newName3 = processDefinitionService.getNewName(processName3, Constants.IMPORT_SUFFIX);
Assertions.assertEquals(2, newName3.split(Constants.IMPORT_SUFFIX).length);
}
@Test
public void testCreateProcessDefinitionV2() {
Project project = this.getProject(projectCode);
WorkflowCreateRequest workflowCreateRequest = new WorkflowCreateRequest();
workflowCreateRequest.setName(name);
workflowCreateRequest.setProjectCode(projectCode);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest));
Assertions.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), ((ServiceException) exception).getCode());
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project);
Mockito.doThrow(new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM)).when(projectService)
.checkProjectAndAuthThrowException(user, project, WORKFLOW_CREATE);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest));
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM.getCode(),
((ServiceException) exception).getCode());
workflowCreateRequest.setDescription(taskDefinitionJson);
Mockito.doThrow(new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR)).when(projectService)
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
.checkProjectAndAuthThrowException(user, project, WORKFLOW_CREATE);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest));
Assertions.assertEquals(Status.DESCRIPTION_TOO_LONG_ERROR.getCode(), ((ServiceException) exception).getCode());
workflowCreateRequest.setDescription(EMPTY_STRING);
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, project, WORKFLOW_CREATE);
Mockito.when(processDefinitionMapper.verifyByDefineName(project.getCode(), name))
.thenReturn(this.getProcessDefinition());
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest));
Assertions.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST.getCode(),
((ServiceException) exception).getCode());
Mockito.when(processDefinitionMapper.verifyByDefineName(project.getCode(), name)).thenReturn(null);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest));
Assertions.assertEquals(Status.TENANT_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
workflowCreateRequest.setTenantCode(DEFAULT);
workflowCreateRequest.setDescription(description);
workflowCreateRequest.setTimeout(timeout);
workflowCreateRequest.setReleaseState(releaseState);
workflowCreateRequest.setWarningGroupId(warningGroupId);
workflowCreateRequest.setExecutionType(executionType);
Mockito.when(processDefinitionLogMapper.insert(Mockito.any())).thenReturn(1);
Mockito.when(processDefinitionMapper.insert(Mockito.any())).thenReturn(1);
ProcessDefinition processDefinition =
processDefinitionService.createSingleProcessDefinition(user, workflowCreateRequest);
Assertions.assertTrue(processDefinition.getCode() > 0L);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Assertions.assertEquals(workflowCreateRequest.getName(), processDefinition.getName());
Assertions.assertEquals(workflowCreateRequest.getDescription(), processDefinition.getDescription());
Assertions.assertTrue(StringUtils.endsWithIgnoreCase(workflowCreateRequest.getReleaseState(),
processDefinition.getReleaseState().getDescp()));
Assertions.assertEquals(workflowCreateRequest.getTimeout(), processDefinition.getTimeout());
Assertions.assertTrue(StringUtils.endsWithIgnoreCase(workflowCreateRequest.getExecutionType(),
processDefinition.getExecutionType().getDescp()));
}
@Test
public void testFilterProcessDefinition() {
Project project = this.getProject(projectCode);
WorkflowFilterRequest workflowFilterRequest = new WorkflowFilterRequest();
workflowFilterRequest.setProjectName(project.getName());
Mockito.when(projectMapper.queryByName(project.getName())).thenReturn(project);
Mockito.doThrow(new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM, user.getUserName(), projectCode))
.when(projectService).checkProjectAndAuthThrowException(user, project, WORKFLOW_DEFINITION);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.filterProcessDefinition(user, workflowFilterRequest));
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM.getCode(),
((ServiceException) exception).getCode());
}
@Test
public void testGetProcessDefinition() {
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.getProcessDefinition(user, processDefinitionCode));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode))
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
.thenReturn(this.getProcessDefinition());
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(this.getProject(projectCode));
Mockito.doThrow(new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM, user.getUserName(), projectCode))
.when(projectService)
.checkProjectAndAuthThrowException(user, this.getProject(projectCode), WORKFLOW_DEFINITION);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.getProcessDefinition(user, processDefinitionCode));
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM.getCode(),
((ServiceException) exception).getCode());
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, this.getProject(projectCode),
WORKFLOW_DEFINITION);
ProcessDefinition processDefinition =
processDefinitionService.getProcessDefinition(user, processDefinitionCode);
Assertions.assertEquals(this.getProcessDefinition(), processDefinition);
}
@Test
public void testUpdateProcessDefinitionV2() {
ProcessDefinition processDefinition;
WorkflowUpdateRequest workflowUpdateRequest = new WorkflowUpdateRequest();
workflowUpdateRequest.setName(name);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.getProcessDefinition(user, processDefinitionCode));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
processDefinition = this.getProcessDefinition();
processDefinition.setReleaseState(ReleaseState.ONLINE);
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(processDefinition);
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
.updateSingleProcessDefinition(user, processDefinitionCode, workflowUpdateRequest));
Assertions.assertEquals(Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT.getCode(),
((ServiceException) exception).getCode());
processDefinition = this.getProcessDefinition();
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(processDefinition);
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(this.getProject(projectCode));
Mockito.doThrow(new ServiceException(Status.USER_NO_OPERATION_PROJECT_PERM, user.getUserName(), projectCode))
.when(projectService)
.checkProjectAndAuthThrowException(user, this.getProject(projectCode), WORKFLOW_DEFINITION);
exception = Assertions.assertThrows(ServiceException.class,
() -> processDefinitionService.getProcessDefinition(user, processDefinitionCode));
Assertions.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM.getCode(),
((ServiceException) exception).getCode());
workflowUpdateRequest.setDescription(taskDefinitionJson);
Mockito.doThrow(new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR)).when(projectService)
.checkProjectAndAuthThrowException(user, this.getProject(projectCode), WORKFLOW_UPDATE);
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService
.updateSingleProcessDefinition(user, processDefinitionCode, workflowUpdateRequest));
Assertions.assertEquals(Status.DESCRIPTION_TOO_LONG_ERROR.getCode(), ((ServiceException) exception).getCode());
workflowUpdateRequest.setDescription(EMPTY_STRING);
Mockito.doNothing().when(projectService).checkProjectAndAuthThrowException(user, this.getProject(projectCode),
WORKFLOW_UPDATE);
Mockito.when(processDefinitionMapper.verifyByDefineName(projectCode, workflowUpdateRequest.getName()))
.thenReturn(this.getProcessDefinition());
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService
.updateSingleProcessDefinition(user, processDefinitionCode, workflowUpdateRequest));
Assertions.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST.getCode(),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
((ServiceException) exception).getCode());
processDefinition = this.getProcessDefinition();
workflowUpdateRequest.setTenantCode(tenantCode);
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(processDefinition);
Mockito.when(processDefinitionMapper.verifyByDefineName(projectCode, workflowUpdateRequest.getName()))
.thenReturn(null);
Mockito.when(tenantMapper.queryByTenantCode(workflowUpdateRequest.getTenantCode())).thenReturn(null);
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService
.updateSingleProcessDefinition(user, processDefinitionCode, workflowUpdateRequest));
Assertions.assertEquals(Status.TENANT_NOT_EXIST.getCode(), ((ServiceException) exception).getCode());
workflowUpdateRequest.setTenantCode(null);
workflowUpdateRequest.setName(name);
Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(processDefinition);
Mockito.when(processDefinitionLogMapper.insert(Mockito.any())).thenReturn(1);
exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService
.updateSingleProcessDefinition(user, processDefinitionCode, workflowUpdateRequest));
Assertions.assertEquals(Status.UPDATE_PROCESS_DEFINITION_ERROR.getCode(),
((ServiceException) exception).getCode());
Mockito.when(processDefinitionMapper.updateById(isA(ProcessDefinition.class))).thenReturn(1);
ProcessDefinition processDefinitionUpdate =
processDefinitionService.updateSingleProcessDefinition(user, processDefinitionCode,
workflowUpdateRequest);
Assertions.assertEquals(processDefinition, processDefinitionUpdate);
}
@Test
public void testViewVariables() {
Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
Project project = getProject(projectCode);
ProcessDefinition processDefinition = getProcessDefinition();
Map<String, Object> result = new HashMap<>();
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode);
Mockito.when(projectService.checkProjectAndAuth(user, project, projectCode, WORKFLOW_DEFINITION))
.thenReturn(result);
Map<String, Object> map =
processDefinitionService.viewVariables(user, processDefinition.getProjectCode(),
processDefinition.getCode());
Assertions.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
}
/**
* get mock processDefinition
*
* @return ProcessDefinition
*/
private ProcessDefinition getProcessDefinition() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(46);
processDefinition.setProjectCode(1L);
processDefinition.setName("test_pdf");
processDefinition.setTenantId(1);
processDefinition.setDescription("");
processDefinition.setCode(processDefinitionCode);
processDefinition.setProjectCode(projectCode);
processDefinition.setVersion(1);
return processDefinition;
}
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
* get mock Project
*
* @param projectCode projectCode
* @return Project
*/
private Project getProject(long projectCode) {
Project project = new Project();
project.setCode(projectCode);
project.setId(1);
project.setName("test");
project.setUserId(1);
return project;
}
private List<ProcessTaskRelation> getProcessTaskRelation() {
List<ProcessTaskRelation> processTaskRelations = new ArrayList<>();
ProcessTaskRelation processTaskRelation = new ProcessTaskRelation();
processTaskRelation.setProjectCode(projectCode);
processTaskRelation.setProcessDefinitionCode(46L);
processTaskRelation.setProcessDefinitionVersion(1);
processTaskRelations.add(processTaskRelation);
return processTaskRelations;
}
/**
* get mock schedule
*
* @return schedule
*/
private Schedule getSchedule() {
Date date = new Date();
Schedule schedule = new Schedule();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
|
schedule.setId(46);
schedule.setProcessDefinitionCode(1);
schedule.setStartTime(date);
schedule.setEndTime(date);
schedule.setCrontab("0 0 5 * * ? *");
schedule.setFailureStrategy(FailureStrategy.END);
schedule.setUserId(1);
schedule.setReleaseState(ReleaseState.OFFLINE);
schedule.setProcessInstancePriority(Priority.MEDIUM);
schedule.setWarningType(WarningType.NONE);
schedule.setWarningGroupId(1);
schedule.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP);
return schedule;
}
/**
* get mock task main info
*
* @return schedule
*/
private List<TaskMainInfo> getTaskMainInfo() {
List<TaskMainInfo> taskMainInfos = new ArrayList<>();
TaskMainInfo taskMainInfo = new TaskMainInfo();
taskMainInfo.setId(1);
taskMainInfo.setProcessDefinitionName("process");
taskMainInfo.setTaskName("task");
taskMainInfos.add(taskMainInfo);
return taskMainInfos;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
|
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.mapper;
import org.apache.dolphinscheduler.common.enums.TaskExecuteType;
import org.apache.dolphinscheduler.dao.entity.DefinitionGroupByUser;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.TaskMainInfo;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
* task definition mapper interface
*/
public interface TaskDefinitionMapper extends BaseMapper<TaskDefinition> {
/**
* query task definition by name
*
* @param projectCode projectCode
* @param processCode processCode
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
|
* @param name name
* @return task definition
*/
TaskDefinition queryByName(@Param("projectCode") long projectCode,
@Param("processCode") long processCode,
@Param("name") String name);
/**
* query task definition by code
*
* @param code taskDefinitionCode
* @return task definition
*/
TaskDefinition queryByCode(@Param("code") long code);
/**
* query all task definition list
*
* @param projectCode projectCode
* @return task definition list
*/
List<TaskDefinition> queryAllDefinitionList(@Param("projectCode") long projectCode);
/**
* count task definition group by user
*
* @param projectCodes projectCodes
* @return task definition list
*/
List<DefinitionGroupByUser> countDefinitionGroupByUser(@Param("projectCodes") Long[] projectCodes);
/**
* list all resource ids and task_params containing resourceList
*
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
|
* @return task ids list
*/
@MapKey("id")
List<Map<String, Object>> listResources();
/**
* list all resource ids by user id
*
* @return resource ids list
*/
@MapKey("id")
List<Map<String, Object>> listResourcesByUser(@Param("userId") Integer userId);
/**
* delete task definition by code
*
* @param code code
* @return int
*/
int deleteByCode(@Param("code") long code);
/**
* batch insert task definitions
*
* @param taskDefinitions taskDefinitions
* @return int
*/
int batchInsert(@Param("taskDefinitions") List<TaskDefinitionLog> taskDefinitions);
/**
* task main info page
*
* @param page page
* @param projectCode projectCode
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,671 |
[Bug] [dolphinscheduler-api] when delete workflow, should determine whether there are related tasks
|
### 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
start

After deleting the workflow

### What you expected to happen
When deleting a workflow, should determine whether there are related tasks
### How to reproduce
1. create workflow and task
2. delete workflow
3. look task list
### Anything else
_No response_
### 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/12671
|
https://github.com/apache/dolphinscheduler/pull/12681
|
e702beced5edb567c5f14bec19be3b1697890145
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
| 2022-11-02T16:22:39Z |
java
| 2022-11-04T06:40:15Z |
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/TaskDefinitionMapper.java
|
* @param searchWorkflowName searchWorkflowName
* @param searchTaskName searchTaskName
* @param taskType taskType
* @param taskExecuteType taskExecuteType
* @return task main info IPage
*/
IPage<TaskMainInfo> queryDefineListPaging(IPage<TaskMainInfo> page,
@Param("projectCode") long projectCode,
@Param("searchWorkflowName") String searchWorkflowName,
@Param("searchTaskName") String searchTaskName,
@Param("taskType") String taskType,
@Param("taskExecuteType") TaskExecuteType taskExecuteType);
/**
* query task definition by code list
*
* @param codes taskDefinitionCode list
* @return task definition list
*/
List<TaskDefinition> queryByCodeList(@Param("codes") Collection<Long> codes);
/**
* Filter task definition
*
* @param page page
* @param taskDefinition process definition object
* @return task definition IPage
*/
IPage<TaskDefinition> filterTaskDefinition(IPage<TaskDefinition> page,
@Param("task") TaskDefinition taskDefinition);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,706 |
[Bug] [Flink] Flink SQL cannot run due to missing main jar 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
![Uploading image.png…]()
### What you expected to happen
Flink sql task can work well.
### How to reproduce
submit a flink sql task
### Anything else
_No response_
### Version
3.1.x
### 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/12706
|
https://github.com/apache/dolphinscheduler/pull/12705
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
|
2c3cc31a4ce43b3b03b42530d41e21785796ab30
| 2022-11-04T08:40:30Z |
java
| 2022-11-04T15:02:00Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.flink;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractYarnTask;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class FlinkTask extends AbstractYarnTask {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,706 |
[Bug] [Flink] Flink SQL cannot run due to missing main jar 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
![Uploading image.png…]()
### What you expected to happen
Flink sql task can work well.
### How to reproduce
submit a flink sql task
### Anything else
_No response_
### Version
3.1.x
### 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/12706
|
https://github.com/apache/dolphinscheduler/pull/12705
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
|
2c3cc31a4ce43b3b03b42530d41e21785796ab30
| 2022-11-04T08:40:30Z |
java
| 2022-11-04T15:02:00Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java
|
/**
* flink parameters
*/
private FlinkParameters flinkParameters;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,706 |
[Bug] [Flink] Flink SQL cannot run due to missing main jar 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
![Uploading image.png…]()
### What you expected to happen
Flink sql task can work well.
### How to reproduce
submit a flink sql task
### Anything else
_No response_
### Version
3.1.x
### 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/12706
|
https://github.com/apache/dolphinscheduler/pull/12705
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
|
2c3cc31a4ce43b3b03b42530d41e21785796ab30
| 2022-11-04T08:40:30Z |
java
| 2022-11-04T15:02:00Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java
|
/**
* rules for flink application ID
*/
protected static final Pattern FLINK_APPLICATION_REGEX = Pattern.compile(TaskConstants.FLINK_APPLICATION_REGEX);
public FlinkTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
}
@Override
public void init() {
logger.info("flink task params {}", taskExecutionContext.getTaskParams());
flinkParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), FlinkParameters.class);
if (flinkParameters == null || !flinkParameters.checkParameters()) {
throw new RuntimeException("flink task params is not valid");
}
flinkParameters.setQueue(taskExecutionContext.getQueue());
setMainJarName();
FileUtils.generateScriptFile(taskExecutionContext, flinkParameters);
}
/**
* create command
*
* @return command
*/
@Override
protected String buildCommand() {
List<String> args = FlinkArgsUtils.buildRunCommandLine(taskExecutionContext, flinkParameters);
String command = ParameterUtils
.convertParameterPlaceholders(String.join(" ", args), taskExecutionContext.getDefinedParams());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,706 |
[Bug] [Flink] Flink SQL cannot run due to missing main jar 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
![Uploading image.png…]()
### What you expected to happen
Flink sql task can work well.
### How to reproduce
submit a flink sql task
### Anything else
_No response_
### Version
3.1.x
### 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/12706
|
https://github.com/apache/dolphinscheduler/pull/12705
|
7d0e2cbbb9fcd2e1543f5166f0518eda03afae89
|
2c3cc31a4ce43b3b03b42530d41e21785796ab30
| 2022-11-04T08:40:30Z |
java
| 2022-11-04T15:02:00Z |
dolphinscheduler-task-plugin/dolphinscheduler-task-flink/src/main/java/org/apache/dolphinscheduler/plugin/task/flink/FlinkTask.java
|
logger.info("flink task command : {}", command);
return command;
}
@Override
protected void setMainJarName() {
ResourceInfo mainJar = flinkParameters.getMainJar();
String resourceName = getResourceNameOfMainJar(mainJar);
mainJar.setRes(resourceName);
flinkParameters.setMainJar(mainJar);
}
@Override
public AbstractParameters getParameters() {
return flinkParameters;
}
/**
* find app id
*
* @param line line
* @return appid
*/
protected String findAppId(String line) {
Matcher matcher = FLINK_APPLICATION_REGEX.matcher(line);
if (matcher.find()) {
String str = matcher.group();
return str.substring(6);
}
return null;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.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
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.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.api.service.impl;
import static org.apache.dolphinscheduler.common.constants.Constants.ALIAS;
import static org.apache.dolphinscheduler.common.constants.Constants.CONTENT;
import static org.apache.dolphinscheduler.common.constants.Constants.EMPTY_STRING;
import static org.apache.dolphinscheduler.common.constants.Constants.FOLDER_SEPARATOR;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_SS;
import static org.apache.dolphinscheduler.common.constants.Constants.FORMAT_S_S;
import static org.apache.dolphinscheduler.common.constants.Constants.JAR;
import static org.apache.dolphinscheduler.common.constants.Constants.PERIOD;
import org.apache.dolphinscheduler.api.dto.resources.DeleteDataTransferResponse;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.RegexUtils;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.constants.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.common.enums.ResUploadType;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.ResourcesTask;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceTaskMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.storage.StorageEntity;
import org.apache.dolphinscheduler.service.storage.StorageOperate;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.io.IOException;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
import java.rmi.ServerException;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.base.Joiner;
import com.google.common.io.Files;
/**
* resources service impl
*/
@Service
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService {
private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceImpl.class);
@Autowired
private ResourceMapper resourcesMapper;
@Autowired
private ResourceTaskMapper resourceTaskMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private UdfFuncMapper udfFunctionMapper;
@Autowired
private ProcessService processService;
@Autowired
private ProcessDefinitionService processDefinitionService;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessTaskRelationMapper processTaskRelationMapper;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
@Autowired(required = false)
private StorageOperate storageOperate;
/**
* create directory
*
* @param loginUser login user
* @param name alias
* @param description description
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create directory result
*/
@Override
@Transactional
public Result<Object> createDirectory(User loginUser,
String name,
String description,
ResourceType type,
int pid,
String currentDir) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (FileUtils.directoryTraversal(name)) {
logger.warn("Parameter name is invalid, name:{}.", RegexUtils.escapeNRT(name));
putMsg(result, Status.VERIFY_PARAMETER_NAME_FAILED);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
logger.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
logger.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, "")) {
logger.error("current user does not have permission");
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
if (checkDescriptionLength(description)) {
logger.warn("Parameter description is too long.");
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
String userResRootPath = ResourceType.UDF.equals(type) ? storageOperate.getUdfDir(tenantCode)
: storageOperate.getResDir(tenantCode);
String fullName = !currentDir.contains(userResRootPath) ? userResRootPath + name : currentDir + name;
try {
if (checkResourceExists(fullName)) {
logger.error("resource directory {} has exist, can't recreate", fullName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
logger.warn("Resource exists, can not create again, fullName:{}.", fullName, e);
throw new ServiceException("resource already exists, can't recreate");
}
createDirectory(loginUser, fullName, type, result);
return result;
}
private String getFullName(String currentDir, String name) {
return currentDir.equals(FOLDER_SEPARATOR) ? String.format(FORMAT_SS, currentDir, name)
: String.format(FORMAT_S_S, currentDir, name);
}
/**
* create resource
*
* @param loginUser login user
* @param name alias
* @param desc description
* @param type type
* @param file file
* @param currentDir current directory
* @return create result code
*/
@Override
@Transactional
public Result<Object> createResource(User loginUser,
String name,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
String desc,
ResourceType type,
MultipartFile file,
String currentDir) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
logger.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
logger.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, "")) {
logger.error("current user does not have permission");
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
}
String userResRootPath = ResourceType.UDF.equals(type) ? storageOperate.getUdfDir(tenantCode)
: storageOperate.getResDir(tenantCode);
String currDirNFileName = !currentDir.contains(userResRootPath) ? userResRootPath + name : currentDir + name;
try {
if (checkResourceExists(currDirNFileName)) {
logger.error("resource {} has exist, can't recreate", RegexUtils.escapeNRT(name));
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
throw new ServiceException("resource already exists, can't recreate");
}
if (currDirNFileName.length() > Constants.RESOURCE_FULL_NAME_MAX_LENGTH) {
logger.error(
"Resource file's name is longer than max full name length, fullName:{}, " +
"fullNameSize:{}, maxFullNameSize:{}",
RegexUtils.escapeNRT(name), currDirNFileName.length(), Constants.RESOURCE_FULL_NAME_MAX_LENGTH);
putMsg(result, Status.RESOURCE_FULL_NAME_TOO_LONG_ERROR);
return result;
}
if (!upload(loginUser, currDirNFileName, file, type)) {
logger.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name),
RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.STORE_OPERATE_CREATE_ERROR);
throw new ServiceException(
String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
} else
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
logger.info("Upload resource file complete, resourceName:{}, fileName:{}.",
RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename()));
return result;
}
/**
* update the folder's size of the resource
*
* @param resource the current resource
* @param size size
*/
private void updateParentResourceSize(Resource resource, long size) {
if (resource.getSize() > 0) {
String[] splits = resource.getFullName().split("/");
for (int i = 1; i < splits.length; i++) {
String parentFullName = Joiner.on("/").join(Arrays.copyOfRange(splits, 0, i));
if (StringUtils.isNotBlank(parentFullName)) {
List<Resource> resources =
resourcesMapper.queryResource(parentFullName, resource.getType().ordinal());
if (CollectionUtils.isNotEmpty(resources)) {
Resource parentResource = resources.get(0);
if (parentResource.getSize() + size >= 0) {
parentResource.setSize(parentResource.getSize() + size);
} else {
parentResource.setSize(0L);
}
resourcesMapper.updateById(parentResource);
logger.info("Resource size update complete, resourceFullName:{}, newSize:{}.",
parentResource.getFullName(), parentResource.getSize());
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
}
}
}
/**
* check resource is exists
*
* @param fullName fullName
* @return true if resource exists
*/
private boolean checkResourceExists(String fullName) {
Boolean existResource = false;
try {
existResource = storageOperate.exists(fullName);
} catch (IOException e) {
logger.error("error occurred when checking resource: " + fullName, e);
}
return Boolean.TRUE.equals(existResource);
}
/**
* update resource
*
* @param loginUser login user
* @param resourceFullName resource full name
* @param resTenantCode tenantCode in the request field "resTenantCode" for tenant code owning the resource,
* can be different from the login user in the case of logging in as admin users.
* @param name name
* @param desc description
* @param type resource type
* @param file resource file
* @return update result code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
*/
@Override
@Transactional
public Result<Object> updateResource(User loginUser,
String resourceFullName,
String resTenantCode,
String name,
String desc,
ResourceType type,
MultipartFile file) {
Result<Object> result = new Result<>();
result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
User user = userMapper.selectById(loginUser.getId());
if (user == null) {
logger.error("user {} not exists", loginUser.getId());
putMsg(result, Status.USER_NOT_EXIST, loginUser.getId());
return result;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (tenant == null) {
logger.error("tenant not exists");
putMsg(result, Status.CURRENT_LOGIN_USER_TENANT_NOT_EXIST);
return result;
}
String tenantCode = tenant.getTenantCode();
if (!isUserTenantValid(isAdmin(loginUser), tenantCode, resTenantCode)) {
logger.error("current user does not have permission");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION);
return result;
}
String defaultPath = storageOperate.getResDir(tenantCode);
StorageEntity resource;
try {
resource = storageOperate.getFileStatus(resourceFullName, defaultPath, resTenantCode, type);
} catch (Exception e) {
logger.error("Get file status fail, resource path: {}", resourceFullName, e);
putMsg(result, Status.RESOURCE_NOT_EXIST);
throw new ServiceException((String.format("Get file status fail, resource path: %s", resourceFullName)));
}
if (!PropertyUtils.getResUploadStartupState()) {
logger.error("Storage does not start up, resource upload startup state: {}.",
PropertyUtils.getResUploadStartupState());
putMsg(result, Status.STORAGE_NOT_STARTUP);
return result;
}
if (resource.isDirectory() && storageOperate.returnStorageType().equals(ResUploadType.S3)
&& !resource.getFileName().equals(name)) {
logger.warn("Directory in S3 storage can not be renamed.");
putMsg(result, Status.S3_CANNOT_RENAME);
return result;
}
if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
logger.info("Resource does not need to be updated due to no change, resource full name:{}.",
resourceFullName);
putMsg(result, Status.SUCCESS);
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 12,466 |
[Bug] [Resource] Resource authorization is disabled
|
### 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
Resource authorization is disabled
### What you expected to happen
Normal
### How to reproduce
Resource authorization
### 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/12466
|
https://github.com/apache/dolphinscheduler/pull/12467
|
f249f2b257847787605758797669abecf1b782d8
|
606a5aeee5b44b095ddf922e2c8c0de485e56c45
| 2022-10-20T10:47:44Z |
java
| 2022-11-06T13:15:27Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
|
}
String originFullName = resource.getFullName();
String originResourceName = resource.getAlias();
originFullName = originFullName.endsWith("/") ? StringUtils.chop(originFullName) : originFullName;
name = name.endsWith("/") ? StringUtils.chop(name) : name;
String fullName = String.format(FORMAT_SS,
originFullName.substring(0, originFullName.lastIndexOf(FOLDER_SEPARATOR) + 1), name);
if (!originResourceName.equals(name)) {
try {
if (checkResourceExists(fullName)) {
logger.error("resource {} already exists, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
} catch (Exception e) {
throw new ServiceException(String.format("error occurs while querying resource: %s", fullName));
}
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Date now = new Date();
long originFileSize = resource.getSize();
resource.setAlias(name);
resource.setFileName(name);
resource.setFullName(fullName);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.