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
9,610
[Bug] Sub-workflow status check beyond what should be checked
### 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 If there is no subtask flow, it will prompt that the status of subtasks is offline ### What you expected to happen normal execution ### How to reproduce Create a task that is not a subtask flow component and run it ### 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/9610
https://github.com/apache/dolphinscheduler/pull/9611
a3bf10c88d63a27d0682834f8a81c0dc352f4907
e2ec489042d59e4f63c181345da0da3d23f2a642
2022-04-20T06:26:40Z
java
2022-04-20T07:04:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} break; } case RUN_MODE_PARALLEL: { if (start.after(end)) { logger.warn("The startDate {} is later than the endDate {}", start, end); break; } List<Date> listDate = new ArrayList<>(); List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode(command.getProcessDefinitionCode()); listDate.addAll(CronUtils.getSelfFireDateList(start, end, schedules)); int listDateSize = listDate.size(); createCount = listDate.size(); if (!CollectionUtils.isEmpty(listDate)) { if (expectedParallelismNumber != null && expectedParallelismNumber != 0) { createCount = Math.min(listDate.size(), expectedParallelismNumber); if (listDateSize < createCount) { createCount = listDateSize; } } logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount); // // int itemsPerCommand = (listDateSize / createCount); int remainingItems = (listDateSize % createCount); int startDateIndex = 0; int endDateIndex = 0; for (int i = 1; i <= createCount; i++) { int extra = (i <= remainingItems) ? 1 : 0;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,610
[Bug] Sub-workflow status check beyond what should be checked
### 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 If there is no subtask flow, it will prompt that the status of subtasks is offline ### What you expected to happen normal execution ### How to reproduce Create a task that is not a subtask flow component and run it ### 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/9610
https://github.com/apache/dolphinscheduler/pull/9611
a3bf10c88d63a27d0682834f8a81c0dc352f4907
e2ec489042d59e4f63c181345da0da3d23f2a642
2022-04-20T06:26:40Z
java
2022-04-20T07:04:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
int singleCommandItems = (itemsPerCommand + extra); if (i == 1) { endDateIndex += singleCommandItems - 1; } else { startDateIndex = endDateIndex + 1; endDateIndex += singleCommandItems; } cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(listDate.get(startDateIndex))); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(listDate.get(endDateIndex))); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) { logger.info("process code: {} complement dependent in off mode or schedule's size is 0, skip " + "dependent complement data", command.getProcessDefinitionCode()); } else { dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } } break; } default: break; } logger.info("create complement command count: {}, create dependent complement command count: {}", createCount , dependentProcessDefinitionCreateCount); return createCount; } /** * create complement dependent command
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,610
[Bug] Sub-workflow status check beyond what should be checked
### 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 If there is no subtask flow, it will prompt that the status of subtasks is offline ### What you expected to happen normal execution ### How to reproduce Create a task that is not a subtask flow component and run it ### 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/9610
https://github.com/apache/dolphinscheduler/pull/9611
a3bf10c88d63a27d0682834f8a81c0dc352f4907
e2ec489042d59e4f63c181345da0da3d23f2a642
2022-04-20T06:26:40Z
java
2022-04-20T07:04:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
*/ protected int createComplementDependentCommand(List<Schedule> schedules, Command command) { int dependentProcessDefinitionCreateCount = 0; Command dependentCommand; try { dependentCommand = (Command) BeanUtils.cloneBean(command); } catch (Exception e) { logger.error("copy dependent command error: ", e); return dependentProcessDefinitionCreateCount; } List<DependentProcessDefinition> dependentProcessDefinitionList = getComplementDependentDefinitionList(dependentCommand.getProcessDefinitionCode(), CronUtils.getMaxCycle(schedules.get(0).getCrontab()), dependentCommand.getWorkerGroup()); dependentCommand.setTaskDependType(TaskDependType.TASK_POST); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { dependentCommand.setProcessDefinitionCode(dependentProcessDefinition.getProcessDefinitionCode()); dependentCommand.setWorkerGroup(dependentProcessDefinition.getWorkerGroup()); Map<String, String> cmdParam = JSONUtils.toMap(dependentCommand.getCommandParam()); cmdParam.put(CMD_PARAM_START_NODES, String.valueOf(dependentProcessDefinition.getTaskDefinitionCode())); dependentCommand.setCommandParam(JSONUtils.toJsonString(cmdParam)); dependentProcessDefinitionCreateCount += processService.createCommand(dependentCommand); } return dependentProcessDefinitionCreateCount; } /** * get complement list */ private List<DependentProcessDefinition> getComplementDependentDefinitionList(long processDefinitionCode, CycleEnum processDefinitionCycle,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,610
[Bug] Sub-workflow status check beyond what should be checked
### 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 If there is no subtask flow, it will prompt that the status of subtasks is offline ### What you expected to happen normal execution ### How to reproduce Create a task that is not a subtask flow component and run it ### 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/9610
https://github.com/apache/dolphinscheduler/pull/9611
a3bf10c88d63a27d0682834f8a81c0dc352f4907
e2ec489042d59e4f63c181345da0da3d23f2a642
2022-04-20T06:26:40Z
java
2022-04-20T07:04:27Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
String workerGroup) { List<DependentProcessDefinition> dependentProcessDefinitionList = processService.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode); return checkDependentProcessDefinitionValid(dependentProcessDefinitionList,processDefinitionCycle,workerGroup); } /** * Check whether the dependency cycle of the dependent node is consistent with the schedule cycle of * the and if there is no worker group in the schedule, use the complement selection's * worker group */ private List<DependentProcessDefinition> checkDependentProcessDefinitionValid(List<DependentProcessDefinition> dependentProcessDefinitionList, CycleEnum processDefinitionCycle, String workerGroup) { List<DependentProcessDefinition> validDependentProcessDefinitionList = new ArrayList<>(); List<Long> processDefinitionCodeList = dependentProcessDefinitionList.stream() .map(DependentProcessDefinition::getProcessDefinitionCode) .collect(Collectors.toList()); Map<Long, String> processDefinitionWorkerGroupMap = processService.queryWorkerGroupByProcessDefinitionCodes(processDefinitionCodeList); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { if (dependentProcessDefinition.getDependentCycle() == processDefinitionCycle) { if (processDefinitionWorkerGroupMap.get(dependentProcessDefinition.getProcessDefinitionCode()) == null) { dependentProcessDefinition.setWorkerGroup(workerGroup); } validDependentProcessDefinitionList.add(dependentProcessDefinition); } } return validDependentProcessDefinitionList; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_CONDITIONS; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SUB_PROCESS; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ProcessTaskRelationService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ConditionType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.User; 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.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.google.common.collect.Lists; /** * process task relation service impl */ @Service public class ProcessTaskRelationServiceImpl extends BaseServiceImpl implements ProcessTaskRelationService {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
@Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessService processService; /** * create process task relation * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode processDefinitionCode * @param preTaskCode preTaskCode * @param postTaskCode postTaskCode * @return create result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> createProcessTaskRelation(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); return result; } if (processDefinition.getProjectCode() != projectCode) { putMsg(result, Status.PROJECT_PROCESS_NOT_MATCH); return result; } updateProcessDefiniteVersion(loginUser, result, processDefinition); List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); List<ProcessTaskRelation> processTaskRelations = Lists.newArrayList(processTaskRelationList); if (!processTaskRelations.isEmpty()) { Map<Long, ProcessTaskRelation> preTaskCodeMap = processTaskRelations.stream().filter(r -> r.getPostTaskCode() == postTaskCode) .collect(Collectors.toMap(ProcessTaskRelation::getPreTaskCode, processTaskRelation -> processTaskRelation)); if (!preTaskCodeMap.isEmpty()) { if (preTaskCodeMap.containsKey(preTaskCode) || (!preTaskCodeMap.containsKey(0L) && preTaskCode == 0L)) { putMsg(result, Status.PROCESS_TASK_RELATION_EXIST, processDefinitionCode); return result; } if (preTaskCodeMap.containsKey(0L) && preTaskCode != 0L) { processTaskRelations.remove(preTaskCodeMap.get(0L)); } } } TaskDefinition postTaskDefinition = taskDefinitionMapper.queryByCode(postTaskCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
ProcessTaskRelation processTaskRelation = setRelation(processDefinition, postTaskDefinition); if (preTaskCode != 0L) { TaskDefinition preTaskDefinition = taskDefinitionMapper.queryByCode(preTaskCode); List<ProcessTaskRelation> upstreamTaskRelationList = processTaskRelations.stream().filter(r -> r.getPostTaskCode() == preTaskCode).collect(Collectors.toList()); if (upstreamTaskRelationList.isEmpty()) { ProcessTaskRelation preProcessTaskRelation = setRelation(processDefinition, preTaskDefinition); preProcessTaskRelation.setPreTaskCode(0L); preProcessTaskRelation.setPreTaskVersion(0); processTaskRelations.add(preProcessTaskRelation); } processTaskRelation.setPreTaskCode(preTaskDefinition.getCode()); processTaskRelation.setPreTaskVersion(preTaskDefinition.getVersion()); } else { processTaskRelation.setPreTaskCode(0L); processTaskRelation.setPreTaskVersion(0); } processTaskRelations.add(processTaskRelation); updateRelation(loginUser, result, processDefinition, processTaskRelations); return result; } private ProcessTaskRelation setRelation(ProcessDefinition processDefinition, TaskDefinition taskDefinition) { Date now = new Date(); ProcessTaskRelation processTaskRelation = new ProcessTaskRelation(); processTaskRelation.setProjectCode(processDefinition.getProjectCode()); processTaskRelation.setProcessDefinitionCode(processDefinition.getCode()); processTaskRelation.setProcessDefinitionVersion(processDefinition.getVersion()); processTaskRelation.setPostTaskCode(taskDefinition.getCode()); processTaskRelation.setPostTaskVersion(taskDefinition.getVersion()); processTaskRelation.setConditionType(ConditionType.NONE);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
processTaskRelation.setConditionParams("{}"); processTaskRelation.setCreateTime(now); processTaskRelation.setUpdateTime(now); return processTaskRelation; } private void updateProcessDefiniteVersion(User loginUser, Map<String, Object> result, ProcessDefinition processDefinition) { int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion <= 0) { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } processDefinition.setVersion(insertVersion); } /** * delete process task relation * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode process definition code * @param taskCode the post task code * @return delete result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> deleteTaskProcessRelation(User loginUser, long projectCode, long processDefinitionCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
} if (taskCode == 0) { putMsg(result, Status.DELETE_TASK_PROCESS_RELATION_ERROR); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); return result; } TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode); if (null == taskDefinition) { putMsg(result, Status.TASK_DEFINE_NOT_EXIST, taskCode); return result; } List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations); if (CollectionUtils.isEmpty(processTaskRelationList)) { putMsg(result, Status.DATA_IS_NULL, "processTaskRelationList"); return result; } List<Long> downstreamList = Lists.newArrayList(); for (ProcessTaskRelation processTaskRelation : processTaskRelations) { if (processTaskRelation.getPreTaskCode() == taskCode) { downstreamList.add(processTaskRelation.getPostTaskCode()); } if (processTaskRelation.getPostTaskCode() == taskCode) { processTaskRelationList.remove(processTaskRelation); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
if (CollectionUtils.isNotEmpty(downstreamList)) { putMsg(result, Status.TASK_HAS_DOWNSTREAM, org.apache.commons.lang.StringUtils.join(downstreamList, ",")); return result; } updateProcessDefiniteVersion(loginUser, result, processDefinition); updateRelation(loginUser, result, processDefinition, processTaskRelationList); if (TASK_TYPE_CONDITIONS.equals(taskDefinition.getTaskType()) || TASK_TYPE_DEPENDENT.equals(taskDefinition.getTaskType()) || TASK_TYPE_SUB_PROCESS.equals(taskDefinition.getTaskType())) { int deleteTaskDefinition = taskDefinitionMapper.deleteByCode(taskCode); if (0 == deleteTaskDefinition) { putMsg(result, Status.DELETE_TASK_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_TASK_DEFINE_BY_CODE_ERROR); } } putMsg(result, Status.SUCCESS); return result; } private void updateRelation(User loginUser, Map<String, Object> result, ProcessDefinition processDefinition, List<ProcessTaskRelation> processTaskRelationList) { List<ProcessTaskRelationLog> relationLogs = processTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), processDefinition.getVersion(), relationLogs, Lists.newArrayList(), Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
} /** * delete task upstream relation * * @param loginUser login user * @param projectCode project code * @param preTaskCodes the pre task codes, sep ',' * @param taskCode the post task code * @return delete result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> deleteUpstreamRelation(User loginUser, long projectCode, String preTaskCodes, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (StringUtils.isEmpty(preTaskCodes)) { putMsg(result, Status.DATA_IS_NULL, "preTaskCodes"); return result; } List<ProcessTaskRelation> upstreamList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); if (CollectionUtils.isEmpty(upstreamList)) { putMsg(result, Status.DATA_IS_NULL, "taskCode"); return result; } List<Long> preTaskCodeList = Lists.newArrayList(preTaskCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toList()); if (preTaskCodeList.contains(0L)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
putMsg(result, Status.DATA_IS_NULL, "preTaskCodes"); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(upstreamList.get(0).getProcessDefinitionCode()); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, upstreamList.get(0).getProcessDefinitionCode()); return result; } List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode()); List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations); List<ProcessTaskRelation> processTaskRelationWaitRemove = Lists.newArrayList(); for (ProcessTaskRelation processTaskRelation : processTaskRelationList) { if (preTaskCodeList.size() > 1) { if (preTaskCodeList.contains(processTaskRelation.getPreTaskCode())) { preTaskCodeList.remove(processTaskRelation.getPreTaskCode()); processTaskRelationWaitRemove.add(processTaskRelation); } } else { if (processTaskRelation.getPostTaskCode() == taskCode) { processTaskRelation.setPreTaskVersion(0); processTaskRelation.setPreTaskCode(0L); } } if (preTaskCodeList.contains(processTaskRelation.getPostTaskCode())) { processTaskRelationWaitRemove.add(processTaskRelation); } } processTaskRelationList.removeAll(processTaskRelationWaitRemove); updateProcessDefiniteVersion(loginUser, result, processDefinition); updateRelation(loginUser, result, processDefinition, processTaskRelationList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
return result; } /** * delete task downstream relation * * @param loginUser login user * @param projectCode project code * @param postTaskCodes the post task codes, sep ',' * @param taskCode the pre task code * @return delete result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> deleteDownstreamRelation(User loginUser, long projectCode, String postTaskCodes, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (StringUtils.isEmpty(postTaskCodes)) { putMsg(result, Status.DATA_IS_NULL, "postTaskCodes"); return result; } List<ProcessTaskRelation> downstreamList = processTaskRelationMapper.queryDownstreamByCode(projectCode, taskCode); if (CollectionUtils.isEmpty(downstreamList)) { putMsg(result, Status.DATA_IS_NULL, "taskCode"); return result; } List<Long> postTaskCodeList = Lists.newArrayList(postTaskCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toList());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
if (postTaskCodeList.contains(0L)) { putMsg(result, Status.DATA_IS_NULL, "postTaskCodes"); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(downstreamList.get(0).getProcessDefinitionCode()); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, downstreamList.get(0).getProcessDefinitionCode()); return result; } List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinition.getCode()); List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations); processTaskRelationList.removeIf(processTaskRelation -> postTaskCodeList.contains(processTaskRelation.getPostTaskCode()) && processTaskRelation.getPreTaskCode() == taskCode); updateProcessDefiniteVersion(loginUser, result, processDefinition); updateRelation(loginUser, result, processDefinition, processTaskRelationList); return result; } /** * query task upstream relation * * @param loginUser login user * @param projectCode project code * @param taskCode current task code (post task code) * @return the upstream task definitions */ @Override public Map<String, Object> queryUpstreamRelation(User loginUser, long projectCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
return result; } List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryUpstreamByCode(projectCode, taskCode); List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(processTaskRelationList)) { Set<TaskDefinition> taskDefinitions = processTaskRelationList .stream() .map(processTaskRelation -> { TaskDefinition taskDefinition = buildTaskDefinition(); taskDefinition.setProjectCode(processTaskRelation.getProjectCode()); taskDefinition.setCode(processTaskRelation.getPreTaskCode()); taskDefinition.setVersion(processTaskRelation.getPreTaskVersion()); return taskDefinition; }) .collect(Collectors.toSet()); taskDefinitionLogList = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions); } result.put(Constants.DATA_LIST, taskDefinitionLogList); putMsg(result, Status.SUCCESS); return result; } /** * query task downstream relation * * @param loginUser login user * @param projectCode project code * @param taskCode pre task code * @return the downstream task definitions */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
public Map<String, Object> queryDownstreamRelation(User loginUser, long projectCode, long taskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryDownstreamByCode(projectCode, taskCode); List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); if (CollectionUtils.isNotEmpty(processTaskRelationList)) { Set<TaskDefinition> taskDefinitions = processTaskRelationList .stream() .map(processTaskRelation -> { TaskDefinition taskDefinition = buildTaskDefinition(); taskDefinition.setProjectCode(processTaskRelation.getProjectCode()); taskDefinition.setCode(processTaskRelation.getPostTaskCode()); taskDefinition.setVersion(processTaskRelation.getPostTaskVersion()); return taskDefinition; }) .collect(Collectors.toSet()); taskDefinitionLogList = taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitions); } result.put(Constants.DATA_LIST, taskDefinitionLogList); putMsg(result, Status.SUCCESS); return result; } /** * delete edge * * @param loginUser login user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
* @param projectCode project code * @param processDefinitionCode process definition code * @param preTaskCode pre task code * @param postTaskCode post task code * @return delete result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> deleteEdge(User loginUser, long projectCode, long processDefinitionCode, long preTaskCode, long postTaskCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionCode); return result; } List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode); List<ProcessTaskRelation> processTaskRelationList = Lists.newArrayList(processTaskRelations); if (CollectionUtils.isEmpty(processTaskRelationList)) { putMsg(result, Status.DATA_IS_NULL, "processTaskRelationList"); return result; } Map<Long, List<ProcessTaskRelation>> taskRelationMap = new HashMap<>(); for (ProcessTaskRelation processTaskRelation : processTaskRelationList) { taskRelationMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> { if (v == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
v = new ArrayList<>(); } v.add(processTaskRelation); return v; }); } if (!taskRelationMap.containsKey(postTaskCode)) { putMsg(result, Status.DATA_IS_NULL, "postTaskCode"); return result; } if (taskRelationMap.get(postTaskCode).size() > 1) { for (ProcessTaskRelation processTaskRelation : taskRelationMap.get(postTaskCode)) { if (processTaskRelation.getPreTaskCode() == preTaskCode) { int delete = processTaskRelationMapper.deleteById(processTaskRelation.getId()); if (delete == 0) { putMsg(result, Status.DELETE_EDGE_ERROR); throw new ServiceException(Status.DELETE_EDGE_ERROR); } processTaskRelationList.remove(processTaskRelation); } } } else { ProcessTaskRelation processTaskRelation = taskRelationMap.get(postTaskCode).get(0); processTaskRelationList.remove(processTaskRelation); processTaskRelation.setPreTaskVersion(0); processTaskRelation.setPreTaskCode(0L); processTaskRelationList.add(processTaskRelation); } updateProcessDefiniteVersion(loginUser, result, processDefinition); updateRelation(loginUser, result, processDefinition, processTaskRelationList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,584
[Bug] [API] Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log
### 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 Deleting upstream dependencies of tasks results in duplicate data in t_ds_process_task_relation_log ### What you expected to happen Normal data ### How to reproduce call /dolphinscheduler/projects/{projectCode}/process-task-relation/{taskCode}/upstream ### Anything else _No response_ ### Version 2.0.5 ### 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/9584
https://github.com/apache/dolphinscheduler/pull/9585
e2ec489042d59e4f63c181345da0da3d23f2a642
2aa191014d91bec76344f4de106ff7ba29f3b1ed
2022-04-19T09:13:32Z
java
2022-04-20T08:10:04Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessTaskRelationServiceImpl.java
return result; } /** * build task definition * * @return task definition */ private TaskDefinition buildTaskDefinition() { return new TaskDefinition() { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof TaskDefinition)) { return false; } TaskDefinition that = (TaskDefinition) o; return getCode() == that.getCode() && getVersion() == that.getVersion() && getProjectCode() == that.getProjectCode(); } @Override public int hashCode() { return Objects.hash(getCode(), getVersion(), getProjectCode()); } }; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.controller; import static org.apache.dolphinscheduler.api.enums.Status.CREATE_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.DELETE_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_PROJECT; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_AUTHORIZED_USER; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_PROJECT_DETAILS_BY_CODE_ERROR; import static org.apache.dolphinscheduler.api.enums.Status.QUERY_UNAUTHORIZED_PROJECT_ERROR;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_PROJECT_ERROR; import org.apache.dolphinscheduler.api.aspect.AccessLogAnnotation; import org.apache.dolphinscheduler.api.exceptions.ApiException; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.utils.ParameterUtils; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseStatus; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import springfox.documentation.annotations.ApiIgnore; /** * project controller */ @Api(tags = "PROJECT_TAG")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
@RestController @RequestMapping("projects") public class ProjectController extends BaseController { @Autowired private ProjectService projectService; /** * create project * * @param loginUser login user * @param projectName project name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
* @param description description * @return returns an error if it exists */ @ApiOperation(value = "create", notes = "CREATE_PROJECT_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String") }) @PostMapping() @ResponseStatus(HttpStatus.CREATED) @ApiException(CREATE_PROJECT_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result createProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("projectName") String projectName, @RequestParam(value = "description", required = false) String description) { Map<String, Object> result = projectService.createProject(loginUser, projectName, description); return returnDataList(result); } /** * update project * * @param loginUser login user * @param code project code * @param projectName project name * @param description description * @return update result code */ @ApiOperation(value = "update", notes = "UPDATE_PROJECT_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456"),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
@ApiImplicitParam(name = "projectName", value = "PROJECT_NAME", dataType = "String"), @ApiImplicitParam(name = "description", value = "PROJECT_DESC", dataType = "String"), @ApiImplicitParam(name = "userName", value = "USER_NAME", dataType = "String"), }) @PutMapping(value = "/{code}") @ResponseStatus(HttpStatus.OK) @ApiException(UPDATE_PROJECT_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result updateProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("code") Long code, @RequestParam("projectName") String projectName, @RequestParam(value = "description", required = false) String description, @RequestParam(value = "userName") String userName) { Map<String, Object> result = projectService.update(loginUser, code, projectName, description, userName); return returnDataList(result); } /** * query project details by code * * @param loginUser login user * @param code project code * @return project detail information */ @ApiOperation(value = "queryProjectByCode", notes = "QUERY_PROJECT_BY_ID_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456") }) @GetMapping(value = "/{code}") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_PROJECT_DETAILS_BY_CODE_ERROR)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
@AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryProjectByCode(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("code") long code) { Map<String, Object> result = projectService.queryByCode(loginUser, code); return returnDataList(result); } /** * query project list paging * * @param loginUser login user * @param searchVal search value * @param pageSize page size * @param pageNo page number * @return project list which the login user have permission to see */ @ApiOperation(value = "queryProjectListPaging", notes = "QUERY_PROJECT_LIST_PAGING_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"), @ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", required = true, dataType = "Int", example = "10"), @ApiImplicitParam(name = "pageNo", value = "PAGE_NO", required = true, dataType = "Int", example = "1") }) @GetMapping() @ResponseStatus(HttpStatus.OK) @ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryProjectListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam(value = "searchVal", required = false) String searchVal, @RequestParam("pageSize") Integer pageSize, @RequestParam("pageNo") Integer pageNo ) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
Result result = checkPageParams(pageNo, pageSize); if (!result.checkResult()) { return result; } searchVal = ParameterUtils.handleEscapes(searchVal); result = projectService.queryProjectListPaging(loginUser, pageSize, pageNo, searchVal); return result; } /** * delete project by code * * @param loginUser login user * @param code project code * @return delete result code */ @ApiOperation(value = "delete", notes = "DELETE_PROJECT_BY_ID_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "code", value = "PROJECT_CODE", dataType = "Long", example = "123456") }) @DeleteMapping(value = "/{code}") @ResponseStatus(HttpStatus.OK) @ApiException(DELETE_PROJECT_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result deleteProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @PathVariable("code") Long code) { Map<String, Object> result = projectService.deleteProject(loginUser, code); return returnDataList(result); } /** * query unauthorized project
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
* * @param loginUser login user * @param userId user id * @return the projects which user have not permission to see */ @ApiOperation(value = "queryUnauthorizedProject", notes = "QUERY_UNAUTHORIZED_PROJECT_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") }) @GetMapping(value = "/unauth-project") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_UNAUTHORIZED_PROJECT_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryUnauthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("userId") Integer userId) { Map<String, Object> result = projectService.queryUnauthorizedProject(loginUser, userId); return returnDataList(result); } /** * query authorized project * * @param loginUser login user * @param userId user id * @return projects which the user have permission to see, Except for items created by this user */ @ApiOperation(value = "queryAuthorizedProject", notes = "QUERY_AUTHORIZED_PROJECT_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "USER_ID", dataType = "Int", example = "100") }) @GetMapping(value = "/authed-project")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
@ResponseStatus(HttpStatus.OK) @ApiException(QUERY_AUTHORIZED_PROJECT) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAuthorizedProject(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("userId") Integer userId) { Map<String, Object> result = projectService.queryAuthorizedProject(loginUser, userId); return returnDataList(result); } /** * query authorized user * * @param loginUser login user * @param projectCode project code * @return users who have permission for the specified project */ @ApiOperation(value = "queryAuthorizedUser", notes = "QUERY_AUTHORIZED_USER_NOTES") @ApiImplicitParams({ @ApiImplicitParam(name = "projectCode", value = "PROJECT_CODE", dataType = "Long", example = "100") }) @GetMapping(value = "/authed-user") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_AUTHORIZED_USER) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAuthorizedUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, @RequestParam("projectCode") Long projectCode) { Map<String, Object> result = this.projectService.queryAuthorizedUser(loginUser, projectCode); return this.returnDataList(result); } /** * query authorized and user created project
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ProjectController.java
* * @param loginUser login user * @return projects which the user create and authorized */ @ApiOperation(value = "queryProjectCreatedAndAuthorizedByUser", notes = "QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_NOTES") @GetMapping(value = "/created-and-authed") @ResponseStatus(HttpStatus.OK) @ApiException(QUERY_AUTHORIZED_AND_USER_CREATED_PROJECT_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryProjectCreatedAndAuthorizedByUser(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { Map<String, Object> result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser); return returnDataList(result); } /** * query all project list * * @param loginUser login user * @return all project list */ @ApiOperation(value = "queryAllProjectList", notes = "QUERY_ALL_PROJECT_LIST_NOTES") @GetMapping(value = "/list") @ResponseStatus(HttpStatus.OK) @ApiException(LOGIN_USER_QUERY_PROJECT_LIST_PAGING_ERROR) @AccessLogAnnotation(ignoreRequestArgs = "loginUser") public Result queryAllProjectList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) { Map<String, Object> result = projectService.queryAllProjectList(); return returnDataList(result); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.User; import java.util.Map; /** * project service **/ public interface ProjectService {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java
/** * create project * * @param loginUser login user * @param name project name * @param desc description * @return returns an error if it exists */ Map<String, Object> createProject(User loginUser, String name, String desc); /** * query project details by code * * @param projectCode project code * @return project detail information */ Map<String, Object> queryByCode(User loginUser, long projectCode); /** * query project details by name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java
* * @param loginUser login user * @param projectName project name * @return project detail information */ Map<String, Object> queryByName(User loginUser, String projectName); /** * check project and authorization * * @param loginUser login user * @param project project * @param projectCode project code * @return true if the login user have permission to see the project */ Map<String, Object> checkProjectAndAuth(User loginUser, Project project, long projectCode); boolean hasProjectAndPerm(User loginUser, Project project, Map<String, Object> result); boolean hasProjectAndPerm(User loginUser, Project project, Result result); /** * admin can view all projects * * @param loginUser login user * @param searchVal search value * @param pageSize page size * @param pageNo page number * @return project list which the login user have permission to see */ Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal); /** * delete project by code *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java
* @param loginUser login user * @param projectCode project code * @return delete result code */ Map<String, Object> deleteProject(User loginUser, Long projectCode); /** * updateProcessInstance project * * @param loginUser login user * @param projectCode project code * @param projectName project name * @param desc description * @param userName project owner * @return update result code */ Map<String, Object> update(User loginUser, Long projectCode, String projectName, String desc, String userName); /** * query unauthorized project * * @param loginUser login user * @param userId user id * @return the projects which user have not permission to see */ Map<String, Object> queryUnauthorizedProject(User loginUser, Integer userId); /** * query authorized project * * @param loginUser login user * @param userId user id * @return projects which the user have permission to see, Except for items created by this user
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProjectService.java
*/ Map<String, Object> queryAuthorizedProject(User loginUser, Integer userId); /** * query authorized user * * @param loginUser login user * @param projectCode project code * @return users who have permission for the specified project */ Map<String, Object> queryAuthorizedUser(User loginUser, Long projectCode); /** * query authorized project * * @param loginUser login user * @return projects which the user have permission to see, Except for items created by this user */ Map<String, Object> queryProjectCreatedByUser(User loginUser); /** * query all project list that have one or more process definitions. * * @return project list */ Map<String, Object> queryAllProjectList(); /** * query authorized and user create project list by user id * @param loginUser login user * @return project list */ Map<String, Object> queryProjectCreatedAndAuthorizedByUser(User loginUser); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.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.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
* See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.*; import static org.apache.dolphinscheduler.api.utils.CheckUtils.checkDesc; /** * project service impl **/ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
public class ProjectServiceImpl extends BaseServiceImpl implements ProjectService { @Autowired private ProjectMapper projectMapper; @Autowired private ProjectUserMapper projectUserMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private UserMapper userMapper; /** * create project * * @param loginUser login user * @param name project name * @param desc description * @return returns an error if it exists */ @Override public Map<String, Object> createProject(User loginUser, String name, String desc) { Map<String, Object> result = new HashMap<>(); Map<String, Object> descCheck = checkDesc(desc); if (descCheck.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
return descCheck; } Project project = projectMapper.queryByName(name); if (project != null) { putMsg(result, Status.PROJECT_ALREADY_EXISTS, name); return result; } Date now = new Date(); try { project = Project .newBuilder() .name(name) .code(CodeGenerateUtils.getInstance().genCode()) .description(desc) .userId(loginUser.getId()) .userName(loginUser.getUserName()) .createTime(now) .updateTime(now) .build(); } catch (CodeGenerateException e) { putMsg(result, Status.CREATE_PROJECT_ERROR); return result; } if (projectMapper.insert(project) > 0) { result.put(Constants.DATA_LIST, project); putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_PROJECT_ERROR); } return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
} /** * query project details by code * * @param projectCode project code * @return project detail information */ @Override public Map<String, Object> queryByCode(User loginUser, long projectCode) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = hasProjectAndPerm(loginUser, project, result); if (!hasProjectAndPerm) { return result; } if (project != null) { result.put(Constants.DATA_LIST, project); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryByName(User loginUser, String projectName) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByName(projectName); boolean hasProjectAndPerm = hasProjectAndPerm(loginUser, project, result); if (!hasProjectAndPerm) { return result; } if (project != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
result.put(Constants.DATA_LIST, project); putMsg(result, Status.SUCCESS); } return result; } /** * check project and authorization * * @param loginUser login user * @param project project * @param projectCode project code * @return true if the login user have permission to see the project */ @Override public Map<String, Object> checkProjectAndAuth(User loginUser, Project project, long projectCode) { Map<String, Object> result = new HashMap<>(); if (project == null) { putMsg(result, Status.PROJECT_NOT_EXIST); } else if (!checkReadPermission(loginUser, project)) { putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), projectCode); } else { putMsg(result, Status.SUCCESS); } return result; } @Override public boolean hasProjectAndPerm(User loginUser, Project project, Map<String, Object> result) { boolean checkResult = false; if (project == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
putMsg(result, Status.PROJECT_NOT_FOUND, ""); } else if (!checkReadPermission(loginUser, project)) { putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getCode()); } else { checkResult = true; } return checkResult; } @Override public boolean hasProjectAndPerm(User loginUser, Project project, Result result) { boolean checkResult = false; if (project == null) { putMsg(result, Status.PROJECT_NOT_FOUND, ""); } else if (!checkReadPermission(loginUser, project)) { putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getName()); } else { checkResult = true; } return checkResult; } /** * admin can view all projects * * @param loginUser login user * @param searchVal search value * @param pageSize page size * @param pageNo page number * @return project list which the login user have permission to see */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
public Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal) { Result result = new Result(); PageInfo<Project> pageInfo = new PageInfo<>(pageNo, pageSize); Page<Project> page = new Page<>(pageNo, pageSize); int userId = loginUser.getUserType() == UserType.ADMIN_USER ? 0 : loginUser.getId(); IPage<Project> projectIPage = projectMapper.queryProjectListPaging(page, userId, searchVal); List<Project> projectList = projectIPage.getRecords(); if (userId != 0) { for (Project project : projectList) { project.setPerm(Constants.DEFAULT_ADMIN_PERMISSION); } } pageInfo.setTotal((int) projectIPage.getTotal()); pageInfo.setTotalList(projectList); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * delete project by code * * @param loginUser login user * @param projectCode project code * @return delete result code */ @Override public Map<String, Object> deleteProject(User loginUser, Long projectCode) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = getCheckResult(loginUser, project);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
if (checkResult != null) { return checkResult; } if (!canOperator(loginUser, project.getUserId())) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryAllDefinitionList(project.getCode()); if (!processDefinitionList.isEmpty()) { putMsg(result, Status.DELETE_PROJECT_ERROR_DEFINES_NOT_NULL); return result; } int delete = projectMapper.deleteById(project.getId()); if (delete > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.DELETE_PROJECT_ERROR); } return result; } /** * get check result * * @param loginUser login user * @param project project * @return check result */ private Map<String, Object> getCheckResult(User loginUser, Project project) { Map<String, Object> checkResult = checkProjectAndAuth(loginUser, project, project == null ? 0L : project.getCode()); Status status = (Status) checkResult.get(Constants.STATUS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
if (status != Status.SUCCESS) { return checkResult; } return null; } /** * updateProcessInstance project * * @param loginUser login user * @param projectCode project code * @param projectName project name * @param desc description * @param userName project owner * @return update result code */ @Override public Map<String, Object> update(User loginUser, Long projectCode, String projectName, String desc, String userName) { Map<String, Object> result = new HashMap<>(); Map<String, Object> descCheck = checkDesc(desc); if (descCheck.get(Constants.STATUS) != Status.SUCCESS) { return descCheck; } Project project = projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = hasProjectAndPerm(loginUser, project, result); if (!hasProjectAndPerm) { return result; } Project tempProject = projectMapper.queryByName(projectName); if (tempProject != null && tempProject.getCode() != project.getCode()) { putMsg(result, Status.PROJECT_ALREADY_EXISTS, projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
return result; } User user = userMapper.queryByUserNameAccurately(userName); if (user == null) { putMsg(result, Status.USER_NOT_EXIST, userName); return result; } project.setName(projectName); project.setDescription(desc); project.setUpdateTime(new Date()); project.setUserId(user.getId()); int update = projectMapper.updateById(project); if (update > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.UPDATE_PROJECT_ERROR); } return result; } /** * query unauthorized project * * @param loginUser login user * @param userId user id * @return the projects which user have not permission to see */ @Override public Map<String, Object> queryUnauthorizedProject(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); List<Project> projectList;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
if (isAdmin(loginUser)) { projectList = projectMapper.queryProjectExceptUserId(userId); } else { projectList = projectMapper.queryProjectCreatedByUser(loginUser.getId()); } List<Project> resultList = new ArrayList<>(); Set<Project> projectSet; if (projectList != null && !projectList.isEmpty()) { projectSet = new HashSet<>(projectList); List<Project> authedProjectList = projectMapper.queryAuthedProjectListByUserId(userId); resultList = getUnauthorizedProjects(projectSet, authedProjectList); } result.put(Constants.DATA_LIST, resultList); putMsg(result, Status.SUCCESS); return result; } /** * get unauthorized project * * @param projectSet project set * @param authedProjectList authed project list * @return project list that authorization */ private List<Project> getUnauthorizedProjects(Set<Project> projectSet, List<Project> authedProjectList) { List<Project> resultList; Set<Project> authedProjectSet; if (authedProjectList != null && !authedProjectList.isEmpty()) { authedProjectSet = new HashSet<>(authedProjectList); projectSet.removeAll(authedProjectSet);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
} resultList = new ArrayList<>(projectSet); return resultList; } /** * query authorized project * * @param loginUser login user * @param userId user id * @return projects which the user have permission to see, Except for items created by this user */ @Override public Map<String, Object> queryAuthorizedProject(User loginUser, Integer userId) { Map<String, Object> result = new HashMap<>(); List<Project> projects = projectMapper.queryAuthedProjectListByUserId(userId); result.put(Constants.DATA_LIST, projects); putMsg(result, Status.SUCCESS); return result; } /** * query authorized user * * @param loginUser login user * @param projectCode project code * @return users who have permission for the specified project */ @Override public Map<String, Object> queryAuthorizedUser(User loginUser, Long projectCode) { Map<String, Object> result = new HashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
Project project = this.projectMapper.queryByCode(projectCode); boolean hasProjectAndPerm = this.hasProjectAndPerm(loginUser, project, result); if (!hasProjectAndPerm) { return result; } List<User> users = this.userMapper.queryAuthedUserListByProjectId(project.getId()); result.put(Constants.DATA_LIST, users); this.putMsg(result, Status.SUCCESS); return result; } /** * query authorized project * * @param loginUser login user * @return projects which the user have permission to see, Except for items created by this user */ @Override public Map<String, Object> queryProjectCreatedByUser(User loginUser) { Map<String, Object> result = new HashMap<>(); List<Project> projects = projectMapper.queryProjectCreatedByUser(loginUser.getId()); result.put(Constants.DATA_LIST, projects); putMsg(result, Status.SUCCESS); return result; } /** * query authorized and user create project list by user * * @param loginUser login user * @return project list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
*/ @Override public Map<String, Object> queryProjectCreatedAndAuthorizedByUser(User loginUser) { Map<String, Object> result = new HashMap<>(); List<Project> projects = null; if (loginUser.getUserType() == UserType.ADMIN_USER) { projects = projectMapper.selectList(null); } else { projects = projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId()); } result.put(Constants.DATA_LIST, projects); putMsg(result, Status.SUCCESS); return result; } /** * check whether have read permission * * @param user user * @param project project * @return true if the user have permission to see the project, otherwise return false */ private boolean checkReadPermission(User user, Project project) { int permissionId = queryPermission(user, project); return (permissionId & Constants.READ_PERMISSION) != 0; } /** * query permission id * * @param user user * @param project project
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProjectServiceImpl.java
* @return permission */ private int queryPermission(User user, Project project) { if (user.getUserType() == UserType.ADMIN_USER) { return Constants.READ_PERMISSION; } if (project.getUserId() == user.getId()) { return Constants.ALL_PERMISSIONS; } ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), user.getId()); if (projectUser == null) { return 0; } return projectUser.getPerm(); } /** * query all project list * * @return project list */ @Override public Map<String, Object> queryAllProjectList() { Map<String, Object> result = new HashMap<>(); List<Project> projects = projectMapper.queryAllProject(); result.put(Constants.DATA_LIST, projects); putMsg(result, Status.SUCCESS); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProjectControllerTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.controller; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProjectControllerTest.java
import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; /** * project controller test */ @RunWith(MockitoJUnitRunner.Silent.class) public class ProjectControllerTest { @InjectMocks private ProjectController projectController; @Mock private ProjectServiceImpl projectService; @Mock private ProjectMapper projectMapper; protected User user; @Before
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProjectControllerTest.java
public void before() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setUserName("admin"); user = loginUser; } @Test public void testUpdateProject() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put("projectId", 1); long projectCode = 1L; String projectName = "test"; String desc = ""; String userName = "jack"; Mockito.when(projectService.update(user, projectCode, projectName, desc, userName)).thenReturn(result); Result response = projectController.updateProject(user, projectCode, projectName, desc, userName); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryProjectByCode() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject()); Mockito.when(projectService.queryByCode(user, projectCode)).thenReturn(result); Result response = projectController.queryProjectByCode(user, projectCode); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProjectControllerTest.java
@Test public void testQueryProjectListPaging() { int pageNo = 1; int pageSize = 10; String searchVal = ""; Result result = Result.success(new PageInfo<Resource>(1, 10)); Mockito.when(projectService.queryProjectListPaging(user, pageSize, pageNo, searchVal)).thenReturn(result); Result response = projectController.queryProjectListPaging(user, searchVal, pageSize, pageNo); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testQueryUnauthorizedProject() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(projectService.queryUnauthorizedProject(user, 2)).thenReturn(result); Result response = projectController.queryUnauthorizedProject(user, 2); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryAuthorizedProject() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(projectService.queryAuthorizedProject(user, 2)).thenReturn(result); Result response = projectController.queryAuthorizedProject(user, 2); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryAuthorizedUser() { Map<String, Object> result = new HashMap<>(); this.putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/ProjectControllerTest.java
Mockito.when(this.projectService.queryAuthorizedUser(this.user, 3682329499136L)).thenReturn(result); Result response = this.projectController.queryAuthorizedUser(this.user, 3682329499136L); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testQueryAllProjectList() { Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(projectService.queryAllProjectList()).thenReturn(result); Result response = projectController.queryAllProjectList(user); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } private Project getProject() { Project project = new Project(); project.setCode(1L); project.setId(1); project.setName("test"); project.setUserId(1); return project; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.commons.collections.CollectionUtils; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; /** * project service test **/ @RunWith(MockitoJUnitRunner.class) public class ProjectServiceTest { private static final Logger logger = LoggerFactory.getLogger(ProjectServiceTest.class); @InjectMocks private ProjectServiceImpl projectService; @Mock private ProjectMapper projectMapper; @Mock
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
private ProjectUserMapper projectUserMapper; @Mock private ProcessDefinitionMapper processDefinitionMapper; @Mock private UserMapper userMapper; private String projectName = "ProjectServiceTest"; private String userName = "ProjectServiceTest"; @Test public void testCreateProject() { User loginUser = getLoginUser(); loginUser.setId(1); Map<String, Object> result = projectService.createProject(loginUser, projectName, getDesc()); logger.info(result.toString()); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, result.get(Constants.STATUS)); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(getProject()); result = projectService.createProject(loginUser, projectName, projectName); logger.info(result.toString()); Assert.assertEquals(Status.PROJECT_ALREADY_EXISTS, result.get(Constants.STATUS)); Mockito.when(projectMapper.insert(Mockito.any(Project.class))).thenReturn(1); result = projectService.createProject(loginUser, "test", "test"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testCheckProjectAndAuth() { long projectCode = 1L; Mockito.when(projectUserMapper.queryProjectRelation(1, 1)).thenReturn(getProjectUser()); User loginUser = getLoginUser();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, null, projectCode); logger.info(result.toString()); Status status = (Status) result.get(Constants.STATUS); Assert.assertEquals(Status.PROJECT_NOT_EXIST, result.get(Constants.STATUS)); Project project = getProject(); project.setUserId(2); result = projectService.checkProjectAndAuth(loginUser, project, projectCode); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result.get(Constants.STATUS)); project.setUserId(1); result = projectService.checkProjectAndAuth(loginUser, project, projectCode); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); Map<String, Object> result2 = new HashMap<>(); result2 = projectService.checkProjectAndAuth(loginUser, null, projectCode); Assert.assertEquals(Status.PROJECT_NOT_EXIST, result2.get(Constants.STATUS)); Project project1 = getProject(); project1.setUserId(2); result2 = projectService.checkProjectAndAuth(loginUser, project1, projectCode); Assert.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result2.get(Constants.STATUS)); project1.setUserId(1); projectService.checkProjectAndAuth(loginUser, project1, projectCode); } @Test public void testHasProjectAndPerm() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
User loginUser = getLoginUser(); Project project = getProject(); Map<String, Object> result = new HashMap<>(); User tempUser = new User(); tempUser.setId(Integer.MAX_VALUE); boolean checkResult = projectService.hasProjectAndPerm(tempUser, project, result); logger.info(result.toString()); Assert.assertFalse(checkResult); result = new HashMap<>(); project.setUserId(1); checkResult = projectService.hasProjectAndPerm(loginUser, project, result); logger.info(result.toString()); Assert.assertTrue(checkResult); } @Test public void testQueryProjectListPaging() { IPage<Project> page = new Page<>(1, 10); page.setRecords(getList()); page.setTotal(1L); Mockito.when(projectMapper.queryProjectListPaging(Mockito.any(Page.class), Mockito.eq(1), Mockito.eq(projectName))).thenReturn(page); User loginUser = getLoginUser(); Result result = projectService.queryProjectListPaging(loginUser, 10, 1, projectName); logger.info(result.toString()); PageInfo<Project> pageInfo = (PageInfo<Project>) result.getData(); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getTotalList())); Mockito.when(projectMapper.queryProjectListPaging(Mockito.any(Page.class), Mockito.eq(0), Mockito.eq(projectName))).thenReturn(page);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
loginUser.setUserType(UserType.ADMIN_USER); result = projectService.queryProjectListPaging(loginUser, 10, 1, projectName); logger.info(result.toString()); pageInfo = (PageInfo<Project>) result.getData(); Assert.assertTrue(CollectionUtils.isNotEmpty(pageInfo.getTotalList())); } @Test public void testDeleteProject() { User loginUser = getLoginUser(); Mockito.when(projectMapper.queryByCode(1L)).thenReturn(getProject()); Map<String, Object> result = projectService.deleteProject(loginUser, 11L); logger.info(result.toString()); Assert.assertEquals(Status.PROJECT_NOT_EXIST, result.get(Constants.STATUS)); loginUser.setId(2); result = projectService.deleteProject(loginUser, 1L); logger.info(result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result.get(Constants.STATUS)); Mockito.when(processDefinitionMapper.queryAllDefinitionList(1L)).thenReturn(getProcessDefinitions()); loginUser.setUserType(UserType.ADMIN_USER); result = projectService.deleteProject(loginUser, 1L); logger.info(result.toString()); Assert.assertEquals(Status.DELETE_PROJECT_ERROR_DEFINES_NOT_NULL, result.get(Constants.STATUS)); Mockito.when(projectMapper.deleteById(1)).thenReturn(1); Mockito.when(processDefinitionMapper.queryAllDefinitionList(1L)).thenReturn(new ArrayList<>()); result = projectService.deleteProject(loginUser, 1L); logger.info(result.toString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testUpdate() { User loginUser = getLoginUser(); Project project = getProject(); project.setCode(2L); Mockito.when(projectMapper.queryByName(projectName)).thenReturn(project); Mockito.when(projectMapper.queryByCode(2L)).thenReturn(getProject()); Map<String, Object> result = projectService.update(loginUser, 1L, projectName, "desc", "testUser"); logger.info(result.toString()); Assert.assertEquals(Status.PROJECT_NOT_FOUND, result.get(Constants.STATUS)); result = projectService.update(loginUser, 2L, projectName, "desc", userName); logger.info(result.toString()); Assert.assertEquals(Status.PROJECT_ALREADY_EXISTS, result.get(Constants.STATUS)); Mockito.when(userMapper.queryByUserNameAccurately(Mockito.any())).thenReturn(null); result = projectService.update(loginUser, 2L, "test", "desc", "testuser"); Assert.assertEquals(Status.USER_NOT_EXIST, result.get(Constants.STATUS)); Mockito.when(userMapper.queryByUserNameAccurately(Mockito.any())).thenReturn(new User()); project.setUserId(1); Mockito.when(projectMapper.updateById(Mockito.any(Project.class))).thenReturn(1); result = projectService.update(loginUser, 2L, "test", "desc", "testUser"); logger.info(result.toString()); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testQueryAuthorizedProject() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
Mockito.when(projectMapper.queryAuthedProjectListByUserId(2)).thenReturn(getList()); User loginUser = getLoginUser(); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> result = projectService.queryAuthorizedProject(loginUser, 2); logger.info(result.toString()); List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setId(3); result = projectService.queryAuthorizedProject(loginUser, 2); projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); } @Test public void testQueryAuthorizedUser() { final User loginUser = this.getLoginUser(); Map<String, Object> result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L); logger.info("FAILURE 1: {}", result.toString()); Assert.assertEquals(Status.PROJECT_NOT_FOUND, result.get(Constants.STATUS)); loginUser.setId(100); Mockito.when(this.projectMapper.queryByCode(Mockito.anyLong())).thenReturn(this.getProject()); result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L); logger.info("FAILURE 2: {}", result.toString()); Assert.assertEquals(Status.USER_NO_OPERATION_PROJECT_PERM, result.get(Constants.STATUS)); loginUser.setUserType(UserType.ADMIN_USER);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
Mockito.when(this.userMapper.queryAuthedUserListByProjectId(1)).thenReturn(this.getUserList()); result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L); logger.info("SUCCESS 1: {}", result.toString()); List<User> users = (List<User>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(users)); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); result = this.projectService.queryAuthorizedUser(loginUser, 3682329499136L); logger.info("SUCCESS 2: {}", result.toString()); users = (List<User>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(users)); } @Test public void testQueryCreatedProject() { User loginUser = getLoginUser(); Mockito.when(projectMapper.queryProjectCreatedByUser(1)).thenReturn(getList()); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> result = projectService.queryProjectCreatedByUser(loginUser); logger.info(result.toString()); List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); } @Test public void testQueryProjectCreatedAndAuthorizedByUser() { Map<String, Object> result = null; User loginUser = getLoginUser(); Mockito.when(projectMapper.queryProjectCreatedAndAuthorizedByUserId(1)).thenReturn(getList()); result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
List<Project> notAdminUserResult = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(notAdminUserResult)); loginUser.setUserType(UserType.ADMIN_USER); Mockito.when(projectMapper.selectList(null)).thenReturn(getList()); result = projectService.queryProjectCreatedAndAuthorizedByUser(loginUser); List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); } @Test public void testQueryAllProjectList() { Mockito.when(projectMapper.queryAllProject()).thenReturn(getList()); Map<String, Object> result = projectService.queryAllProjectList(); logger.info(result.toString()); List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); } @Test public void testQueryUnauthorizedProject() { Mockito.when(projectMapper.queryProjectExceptUserId(2)).thenReturn(getList()); Mockito.when(projectMapper.queryProjectCreatedByUser(2)).thenReturn(getList()); Mockito.when(projectMapper.queryAuthedProjectListByUserId(2)).thenReturn(getSingleList()); User loginUser = new User(); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> result = projectService.queryUnauthorizedProject(loginUser, 2); logger.info(result.toString()); List<Project> projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
loginUser.setId(2); loginUser.setUserType(UserType.GENERAL_USER); result = projectService.queryUnauthorizedProject(loginUser, 3); logger.info(result.toString()); projects = (List<Project>) result.get(Constants.DATA_LIST); Assert.assertTrue(CollectionUtils.isNotEmpty(projects)); } private Project getProject() { Project project = new Project(); project.setCode(1L); project.setId(1); project.setName(projectName); project.setUserId(1); return project; } private Project getProject(int projectId) { Project project = new Project(); project.setId(projectId); project.setCode(1L); project.setName(projectName); project.setUserId(1); return project; } private List<Project> getList() { List<Project> list = new ArrayList<>(); list.add(getProject(1)); list.add(getProject(2)); list.add(getProject(3)); return list; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
private List<Project> getSingleList() { return Collections.singletonList(getProject(2)); } /** * create admin user */ private User getLoginUser() { User loginUser = new User(); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setUserName(userName); loginUser.setId(1); return loginUser; } /** * Get general user * @return */ private User getGeneralUser() { User user = new User(); user.setUserType(UserType.GENERAL_USER); user.setUserName("userTest0001"); user.setUserPassword("userTest0001"); return user; } /** * Get user list * @return */ private List<User> getUserList() { List<User> userList = new ArrayList<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProjectServiceTest.java
userList.add(this.getGeneralUser()); return userList; } /** * get project user */ private ProjectUser getProjectUser() { ProjectUser projectUser = new ProjectUser(); projectUser.setProjectId(1); projectUser.setUserId(1); return projectUser; } private List<ProcessDefinition> getProcessDefinitions() { List<ProcessDefinition> list = new ArrayList<>(); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectCode(1L); list.add(processDefinition); return list; } private List<Integer> getProjectIds() { return Collections.singletonList(1); } private String getDesc() { return "projectUserMapper.deleteProjectRelation(projectId,userId)projectUserMappe" + ".deleteProjectRelation(projectId,userId)projectUserMappe" + "r.deleteProjectRelation(projectId,userId)projectUserMapper" + ".deleteProjectRelation(projectId,userId)projectUserMapper.deleteProjectRelation(projectId,userId)"; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.dao.mapper; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.ProjectUser; import org.apache.ibatis.annotations.Param; import java.util.Collection; import java.util.List; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; /** * project mapper interface */ public interface ProjectMapper extends BaseMapper<Project> {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
/** * query project detail by code * @param projectCode projectCode * @return project */ Project queryByCode(@Param("projectCode") long projectCode); /** * query project detail by code list * @param codes codes * @return project list */ List<Project> queryByCodes(@Param("codes") Collection<Long> codes); /** * TODO: delete * query project detail by id * @param projectId projectId * @return project */ Project queryDetailById(@Param("projectId") int projectId); /** * query project detail by code * @param projectCode projectCode * @return project */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
Project queryDetailByCode(@Param("projectCode") long projectCode); /** * query project by name * @param projectName projectName * @return project */ Project queryByName(@Param("projectName") String projectName); /** * project page * @param page page * @param userId userId * @param searchName searchName * @return project Ipage */ IPage<Project> queryProjectListPaging(IPage<Project> page, @Param("userId") int userId, @Param("searchName") String searchName); /** * query create project user * @param userId userId * @return project list */ List<Project> queryProjectCreatedByUser(@Param("userId") int userId); /** * query authed project list by userId * @param userId userId * @return project list */ List<Project> queryAuthedProjectListByUserId(@Param("userId") int userId); /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,617
[BUG-RD] [V1.0.0-Beta]New task grouping item selection require
### 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 The drop-down box of the project name of the task group created by the non-admin user displays all projects. ### What you expected to happen New task grouping item selection requir,Non-admin user, no new project created,The dropdown box should be empty ### How to reproduce Create a non-admin user Create a task group Click the project name drop-down box ### 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/9617
https://github.com/apache/dolphinscheduler/pull/9625
165d7aa51f1be5aba86752b27067ec9888582acf
ae849003293417e72bb57bf5019d10f02ea61b0f
2022-04-20T07:10:45Z
java
2022-04-20T10:24:45Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/ProjectMapper.java
* query relation project list by userId * @param userId userId * @return project list */ List<Project> queryRelationProjectListByUserId(@Param("userId") int userId); /** * query project except userId * @param userId userId * @return project list */ List<Project> queryProjectExceptUserId(@Param("userId") int userId); /** * query project list by userId * @param userId * @return */ List<Project> queryProjectCreatedAndAuthorizedByUserId(@Param("userId") int userId); /** * query project name and user name by processInstanceId. * @param processInstanceId processInstanceId * @return projectName and userName */ ProjectUser queryProjectWithUserByProcessInstanceId(@Param("processInstanceId") int processInstanceId); /** * query all project * @return projectList */ List<Project> queryAllProject(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.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.server.worker.processor; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.TaskKillRequestCommand; import org.apache.dolphinscheduler.remote.command.TaskKillResponseCommand; import org.apache.dolphinscheduler.remote.processor.NettyRemoteChannel; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.remote.utils.Pair; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.log.LogClientService; import org.apache.commons.lang.StringUtils; import java.util.Collections; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import com.google.common.base.Preconditions; import io.netty.channel.Channel; /** * task kill processor */ @Component public class TaskKillProcessor implements NettyRequestProcessor { private final Logger logger = LoggerFactory.getLogger(TaskKillProcessor.class); /** * task callback service */ @Autowired private TaskCallbackService taskCallbackService; /** * task execute manager */ @Autowired private WorkerManagerThread workerManager;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
/** * task kill process * * @param channel channel channel * @param command command command */ @Override public void process(Channel channel, Command command) { Preconditions.checkArgument(CommandType.TASK_KILL_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType())); TaskKillRequestCommand killCommand = JSONUtils.parseObject(command.getBody(), TaskKillRequestCommand.class); if (killCommand == null) { logger.error("task kill request command is null"); return; } logger.info("task kill command : {}", killCommand); int taskInstanceId = killCommand.getTaskInstanceId(); TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId); if (taskExecutionContext == null) { logger.error("taskRequest cache is null, taskInstanceId: {}", killCommand.getTaskInstanceId()); return; } Integer processId = taskExecutionContext.getProcessId(); if (processId.equals(0)) { workerManager.killTaskBeforeExecuteByInstanceId(taskInstanceId); TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId); logger.info("the task has not been executed and has been cancelled, task id:{}", taskInstanceId); return; } Pair<Boolean, List<String>> result = doKill(taskExecutionContext); taskCallbackService.addRemoteChannel(killCommand.getTaskInstanceId(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
new NettyRemoteChannel(channel, command.getOpaque())); taskExecutionContext.setCurrentExecutionStatus(result.getLeft() ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE); taskExecutionContext.setAppIds(String.join(TaskConstants.COMMA, result.getRight())); taskCallbackService.sendTaskKillResponseCommand(taskExecutionContext); TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); logger.info("remove REMOTE_CHANNELS, task instance id:{}", killCommand.getTaskInstanceId()); } /** * do kill * * @return kill result */ private Pair<Boolean, List<String>> doKill(TaskExecutionContext taskExecutionContext) { boolean processFlag = true; List<String> appIds = Collections.emptyList(); try { String pidsStr = ProcessUtils.getPidsStr(taskExecutionContext.getProcessId()); if (!StringUtils.isEmpty(pidsStr)) { String cmd = String.format("kill -9 %s", pidsStr); cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd); logger.info("process id:{}, cmd:{}", taskExecutionContext.getProcessId(), cmd); OSUtils.exeCmd(cmd); } } catch (Exception e) { processFlag = false; logger.error("kill task error", e); } Pair<Boolean, List<String>> yarnResult = killYarnJob(Host.of(taskExecutionContext.getHost()), taskExecutionContext.getLogPath(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
taskExecutionContext.getExecutePath(), taskExecutionContext.getTenantCode()); return Pair.of(processFlag && yarnResult.getLeft(), yarnResult.getRight()); } /** * build TaskKillResponseCommand * * @param killCommand kill command * @param result exe result * @return build TaskKillResponseCommand */ private TaskKillResponseCommand buildKillTaskResponseCommand(TaskKillRequestCommand killCommand, Pair<Boolean, List<String>> result) { TaskKillResponseCommand taskKillResponseCommand = new TaskKillResponseCommand(); taskKillResponseCommand.setStatus(result.getLeft() ? ExecutionStatus.SUCCESS.getCode() : ExecutionStatus.FAILURE.getCode()); taskKillResponseCommand.setAppIds(result.getRight()); TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(killCommand.getTaskInstanceId()); if (taskExecutionContext == null) { return taskKillResponseCommand; } if (taskExecutionContext != null) { taskKillResponseCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskKillResponseCommand.setHost(taskExecutionContext.getHost()); taskKillResponseCommand.setProcessId(taskExecutionContext.getProcessId()); } return taskKillResponseCommand; } /** * kill yarn job *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java
* @param host host * @param logPath logPath * @param executePath executePath * @param tenantCode tenantCode * @return Pair<Boolean, List < String>> yarn kill result */ private Pair<Boolean, List<String>> killYarnJob(Host host, String logPath, String executePath, String tenantCode) { try (LogClientService logClient = new LogClientService();) { logger.info("log host : {} , logPath : {} , port : {}", host.getIp(), logPath, host.getPort()); String log = logClient.viewLog(host.getIp(), host.getPort(), logPath); List<String> appIds = Collections.emptyList(); if (!StringUtils.isEmpty(log)) { appIds = LoggerUtils.getAppIds(log, logger); if (StringUtils.isEmpty(executePath)) { logger.error("task instance execute path is empty"); throw new RuntimeException("task instance execute path is empty"); } if (appIds.size() > 0) { ProcessUtils.cancelApplication(appIds, logger, tenantCode, executePath); } } return Pair.of(true, appIds); } catch (Exception e) { logger.error("kill yarn job error", e); } return Pair.of(false, Collections.emptyList()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.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.server.worker.runner; import static org.apache.dolphinscheduler.common.Constants.SINGLE_SLASH; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.common.utils.CommonUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.plugin.task.api.AbstractTask; import org.apache.dolphinscheduler.plugin.task.api.TaskChannel; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskAlertInfo; import org.apache.dolphinscheduler.server.utils.ProcessUtils; import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.exceptions.ServiceException; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang.StringUtils; import java.io.File; import java.io.IOException; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Delayed; import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * task scheduler thread */ public class TaskExecuteThread implements Runnable, Delayed { /** * logger */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
private final Logger logger = LoggerFactory.getLogger(TaskExecuteThread.class); /** * task instance */ private TaskExecutionContext taskExecutionContext; public StorageOperate getStorageOperate() { return storageOperate; } public void setStorageOperate(StorageOperate storageOperate) { this.storageOperate = storageOperate; } private StorageOperate storageOperate; /** * abstract task */ private AbstractTask task; /** * task callback service */ private TaskCallbackService taskCallbackService; /** * alert client server */ private AlertClientService alertClientService; private TaskPluginManager taskPluginManager; /** * constructor * * @param taskExecutionContext taskExecutionContext * @param taskCallbackService taskCallbackService
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
*/ public TaskExecuteThread(TaskExecutionContext taskExecutionContext, TaskCallbackService taskCallbackService, AlertClientService alertClientService) { this.taskExecutionContext = taskExecutionContext; this.taskCallbackService = taskCallbackService; this.alertClientService = alertClientService; } public TaskExecuteThread(TaskExecutionContext taskExecutionContext, TaskCallbackService taskCallbackService, AlertClientService alertClientService, TaskPluginManager taskPluginManager, StorageOperate storageOperate) { this.taskExecutionContext = taskExecutionContext; this.taskCallbackService = taskCallbackService; this.alertClientService = alertClientService; this.taskPluginManager = taskPluginManager; this.storageOperate = storageOperate; } @Override public void run() { if (Constants.DRY_RUN_FLAG_YES == taskExecutionContext.getDryRun()) { taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.SUCCESS); taskExecutionContext.setStartTime(new Date()); taskExecutionContext.setEndTime(new Date()); TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext); return; } try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
logger.info("script path : {}", taskExecutionContext.getExecutePath()); if (taskExecutionContext.getStartTime() == null) { taskExecutionContext.setStartTime(new Date()); } logger.info("the task begins to execute. task instance id: {}", taskExecutionContext.getTaskInstanceId()); taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); taskCallbackService.sendTaskExecuteRunningCommand(taskExecutionContext); downloadResource(taskExecutionContext.getExecutePath(), taskExecutionContext.getResources(), logger); taskExecutionContext.setEnvFile(CommonUtils.getSystemEnvPath()); taskExecutionContext.setDefinedParams(getGlobalParamsMap()); taskExecutionContext.setTaskAppId(String.format("%s_%s", taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId())); preBuildBusinessParams(); TaskChannel taskChannel = taskPluginManager.getTaskChannelMap().get(taskExecutionContext.getTaskType()); if (null == taskChannel) { throw new ServiceException(String.format("%s Task Plugin Not Found,Please Check Config File.", taskExecutionContext.getTaskType())); } String taskLogName = LoggerUtils.buildTaskId(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getProcessDefineCode(), taskExecutionContext.getProcessDefineVersion(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId()); taskExecutionContext.setTaskLogName(taskLogName); Thread.currentThread().setName(taskLogName); task = taskChannel.createTask(taskExecutionContext);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
this.task.init(); this.task.getParameters().setVarPool(taskExecutionContext.getVarPool()); this.task.handle(); if (this.task.getNeedAlert()) { sendAlert(this.task.getTaskAlertInfo(), this.task.getExitStatus().getCode()); } taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.of(this.task.getExitStatus().getCode())); taskExecutionContext.setEndTime(DateUtils.getCurrentDate()); taskExecutionContext.setProcessId(this.task.getProcessId()); taskExecutionContext.setAppIds(this.task.getAppIds()); taskExecutionContext.setVarPool(JSONUtils.toJsonString(this.task.getParameters().getVarPool())); logger.info("task instance id : {},task final status : {}", taskExecutionContext.getTaskInstanceId(), this.task.getExitStatus()); } catch (Throwable e) { logger.error("task scheduler failure", e); kill(); taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.FAILURE); taskExecutionContext.setEndTime(DateUtils.getCurrentDate()); taskExecutionContext.setProcessId(this.task.getProcessId()); taskExecutionContext.setAppIds(this.task.getAppIds()); } finally { TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext); clearTaskExecPath(); } } private void sendAlert(TaskAlertInfo taskAlertInfo, int status) { int strategy = status == ExecutionStatus.SUCCESS.getCode() ? WarningType.SUCCESS.getCode() : WarningType.FAILURE.getCode();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
alertClientService.sendAlert(taskAlertInfo.getAlertGroupId(), taskAlertInfo.getTitle(), taskAlertInfo.getContent(), strategy); } /** * when task finish, clear execute path. */ private void clearTaskExecPath() { logger.info("develop mode is: {}", CommonUtils.isDevelopMode()); if (!CommonUtils.isDevelopMode()) { String execLocalPath = taskExecutionContext.getExecutePath(); if (StringUtils.isEmpty(execLocalPath)) { logger.warn("task: {} exec local path is empty.", taskExecutionContext.getTaskName()); return; } if (SINGLE_SLASH.equals(execLocalPath)) { logger.warn("task: {} exec local path is '/', direct deletion is not allowed", taskExecutionContext.getTaskName()); return; } try { org.apache.commons.io.FileUtils.deleteDirectory(new File(execLocalPath)); logger.info("exec local path: {} cleared.", execLocalPath); } catch (IOException e) { logger.error("delete exec dir failed : {}", e.getMessage(), e); } } } /** * get global paras map * * @return map
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
*/ private Map<String, String> getGlobalParamsMap() { Map<String, String> globalParamsMap = new HashMap<>(16); String globalParamsStr = taskExecutionContext.getGlobalParams(); if (globalParamsStr != null) { List<Property> globalParamsList = JSONUtils.toList(globalParamsStr, Property.class); globalParamsMap.putAll(globalParamsList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue))); } return globalParamsMap; } /** * kill task */ public void kill() { if (task != null) { try { task.cancelApplication(true); ProcessUtils.killYarnJob(taskExecutionContext); } catch (Exception e) { logger.error(e.getMessage(), e); } } } /** * download resource file * * @param execLocalPath execLocalPath * @param projectRes projectRes * @param logger logger
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
*/ private void downloadResource(String execLocalPath, Map<String, String> projectRes, Logger logger) { if (MapUtils.isEmpty(projectRes)) { return; } Set<Map.Entry<String, String>> resEntries = projectRes.entrySet(); for (Map.Entry<String, String> resource : resEntries) { String fullName = resource.getKey(); String tenantCode = resource.getValue(); File resFile = new File(execLocalPath, fullName); if (!resFile.exists()) { try { String resHdfsPath = storageOperate.getResourceFileName(tenantCode, fullName); logger.info("get resource file from hdfs :{}", resHdfsPath); storageOperate.download(tenantCode, resHdfsPath, execLocalPath + File.separator + fullName, false, true); } catch (Exception e) { logger.error(e.getMessage(), e); throw new ServiceException(e.getMessage()); } } else { logger.info("file : {} exists ", resFile.getName()); } } } /** * get current TaskExecutionContext * * @return TaskExecutionContext */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/TaskExecuteThread.java
public TaskExecutionContext getTaskExecutionContext() { return this.taskExecutionContext; } @Override public long getDelay(TimeUnit unit) { return unit.convert(DateUtils.getRemainTime(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getDelayTime() * 60L), TimeUnit.SECONDS); } @Override public int compareTo(Delayed o) { if (o == null) { return 1; } return Long.compare(this.getDelay(TimeUnit.MILLISECONDS), o.getDelay(TimeUnit.MILLISECONDS)); } private void preBuildBusinessParams() { Map<String, Property> paramsMap = new HashMap<>(); if (taskExecutionContext.getScheduleTime() != null) { Date date = taskExecutionContext.getScheduleTime(); String dateTime = DateUtils.format(date, Constants.PARAMETER_FORMAT_TIME, null); Property p = new Property(); p.setValue(dateTime); p.setProp(Constants.PARAMETER_DATETIME); paramsMap.put(Constants.PARAMETER_DATETIME, p); } taskExecutionContext.setParamsMap(paramsMap); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
* the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.worker.runner; import org.apache.dolphinscheduler.common.storage.StorageOperate; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.thread.ThreadUtils; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService; import java.util.concurrent.DelayQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.ThreadPoolExecutor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; /** * Manage tasks */ @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
public class WorkerManagerThread implements Runnable { private final Logger logger = LoggerFactory.getLogger(WorkerManagerThread.class); /** * task queue */ private final DelayQueue<TaskExecuteThread> workerExecuteQueue = new DelayQueue<>(); @Autowired(required = false) private StorageOperate storageOperate; /** * thread executor service */ private final ExecutorService workerExecService; /** * task callback service */ @Autowired private TaskCallbackService taskCallbackService; public WorkerManagerThread(WorkerConfig workerConfig) { workerExecService = ThreadUtils.newDaemonFixedThreadExecutor("Worker-Execute-Thread", workerConfig.getExecThreads()); } /** * get delay queue size * * @return queue size */ public int getDelayQueueSize() { return workerExecuteQueue.size(); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
/** * get thread pool queue size * * @return queue size */ public int getThreadPoolQueueSize() { return ((ThreadPoolExecutor) workerExecService).getQueue().size(); } /** * Kill tasks that have not been executed, like delay task * then send Response to Master, update the execution status of task instance */ public void killTaskBeforeExecuteByInstanceId(Integer taskInstanceId) { workerExecuteQueue.stream() .filter(taskExecuteThread -> taskExecuteThread.getTaskExecutionContext().getTaskInstanceId() == taskInstanceId) .forEach(workerExecuteQueue::remove); sendTaskKillResponse(taskInstanceId); } /** * kill task before execute , like delay task */ private void sendTaskKillResponse(Integer taskInstanceId) { TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId); if (taskExecutionContext == null) { return; } taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.KILL); taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,627
[Bug] [Worker] kill task fail when task is not system process
### 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 kill task fail when task is not system process, such as SQL ### What you expected to happen can kill task successfully. ### How to reproduce run a sql task and kill it. ### 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/9627
https://github.com/apache/dolphinscheduler/pull/9624
ae849003293417e72bb57bf5019d10f02ea61b0f
239be31ab732f5bbe68fca3033245125e8388657
2022-04-20T08:56:59Z
java
2022-04-20T14:46:15Z
dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java
* submit task * * @param taskExecuteThread taskExecuteThread * @return submit result */ public boolean offer(TaskExecuteThread taskExecuteThread) { return workerExecuteQueue.offer(taskExecuteThread); } public void start() { Thread thread = new Thread(this, this.getClass().getName()); thread.setDaemon(true); thread.start(); } @Override public void run() { Thread.currentThread().setName("Worker-Execute-Manager-Thread"); TaskExecuteThread taskExecuteThread; while (Stopper.isRunning()) { try { taskExecuteThread = workerExecuteQueue.take(); taskExecuteThread.setStorageOperate(storageOperate); workerExecService.submit(taskExecuteThread); } catch (Exception e) { logger.error("An unexpected interrupt is happened, " + "the exception will be ignored and this thread will continue to run", e); } } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,608
[Bug] [DAO] Due to the task param map, serialize the task definition failed
### 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 TaskDefinition.java When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object; ### What you expected to happen When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value; ### How to reproduce Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null; Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value; ### Anything else _No response_ ### Version 2.0.5 ### 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/9608
https://github.com/apache/dolphinscheduler/pull/9622
a863c6f8f121869a107611e1217c669da28c3d3e
10f8c9d983528fe57c01a975e3e98d36fff7a4ff
2022-04-20T06:08:21Z
java
2022-04-21T03:38:41Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.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,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,608
[Bug] [DAO] Due to the task param map, serialize the task definition failed
### 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 TaskDefinition.java When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object; ### What you expected to happen When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value; ### How to reproduce Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null; Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value; ### Anything else _No response_ ### Version 2.0.5 ### 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/9608
https://github.com/apache/dolphinscheduler/pull/9622
a863c6f8f121869a107611e1217c669da28c3d3e
10f8c9d983528fe57c01a975e3e98d36fff7a4ff
2022-04-20T06:08:21Z
java
2022-04-21T03:38:41Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java
* 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.entity; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.commons.lang.StringUtils; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import com.baomidou.mybatisplus.annotation.FieldStrategy; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; /** * task definition */ @TableName("t_ds_task_definition")
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,608
[Bug] [DAO] Due to the task param map, serialize the task definition failed
### 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 TaskDefinition.java When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object; ### What you expected to happen When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value; ### How to reproduce Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null; Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value; ### Anything else _No response_ ### Version 2.0.5 ### 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/9608
https://github.com/apache/dolphinscheduler/pull/9622
a863c6f8f121869a107611e1217c669da28c3d3e
10f8c9d983528fe57c01a975e3e98d36fff7a4ff
2022-04-20T06:08:21Z
java
2022-04-21T03:38:41Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java
public class TaskDefinition { /** * id */ @TableId(value = "id", type = IdType.AUTO) private int id; /** * code */ private long code; /** * name */ private String name; /** * version */ private int version; /** * description */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,608
[Bug] [DAO] Due to the task param map, serialize the task definition failed
### 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 TaskDefinition.java When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object; ### What you expected to happen When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value; ### How to reproduce Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null; Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value; ### Anything else _No response_ ### Version 2.0.5 ### 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/9608
https://github.com/apache/dolphinscheduler/pull/9622
a863c6f8f121869a107611e1217c669da28c3d3e
10f8c9d983528fe57c01a975e3e98d36fff7a4ff
2022-04-20T06:08:21Z
java
2022-04-21T03:38:41Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java
private String description; /** * project code */ private long projectCode; /** * task user id */ private int userId; /** * task type */ private String taskType; /** * user defined parameters */ @JsonDeserialize(using = JSONUtils.JsonDataDeserializer.class) @JsonSerialize(using = JSONUtils.JsonDataSerializer.class) private String taskParams; /** * user defined parameter list */ @TableField(exist = false) private List<Property> taskParamList; /** * user define parameter map */ @TableField(exist = false) private Map<String, String> taskParamMap; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
9,608
[Bug] [DAO] Due to the task param map, serialize the task definition failed
### 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 TaskDefinition.java When the local params is null or the property value is null in the local param list , it will cause the `NullPointException` in the serialization of the task definition. Because the `jackson` json lib will use the method `getTaskParamMap` to serialize the object; ### What you expected to happen When the local params is null or the property value is null in the local param list , the task definition object could be serialized normally . The `taskParamMap` could be empty HashMap or the map contains null value; ### How to reproduce Case 1 : The `taskParams` doesn't contain `localParams` parameter , which is null; Case 2: The `taskParams` contains `localParams` parameter , whose property element has a null value; ### Anything else _No response_ ### Version 2.0.5 ### 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/9608
https://github.com/apache/dolphinscheduler/pull/9622
a863c6f8f121869a107611e1217c669da28c3d3e
10f8c9d983528fe57c01a975e3e98d36fff7a4ff
2022-04-20T06:08:21Z
java
2022-04-21T03:38:41Z
dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/TaskDefinition.java
* task is valid: yes/no */ private Flag flag; /** * task priority */ private Priority taskPriority; /** * user name */ @TableField(exist = false) private String userName; /** * project name */ @TableField(exist = false) private String projectName; /** * worker group */ private String workerGroup; /** * environment code */ private long environmentCode; /** * fail retry times */ private int failRetryTimes; /**