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 | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS);
createCommand(cmd);
}
/**
* query all need failover task instances by host
*
* @param host host
* @return task instance list
*/
public List<TaskInstance> queryNeedFailoverTaskInstances(String host) {
return taskInstanceMapper.queryByHostAndStatus(host,
stateArray);
}
/**
* find data source by id
*
* @param id id
* @return datasource
*/
public DataSource findDataSourceById(int id) {
return dataSourceMapper.selectById(id);
}
/**
* update process instance state by id
*
* @param processInstanceId processInstanceId
* @param executionStatus executionStatus
* @return update process result
*/
public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | ProcessInstance instance = processInstanceMapper.selectById(processInstanceId);
instance.setState(executionStatus);
return processInstanceMapper.updateById(instance);
}
/**
* find process instance by the task id
*
* @param taskId taskId
* @return process instance
*/
public ProcessInstance findProcessInstanceByTaskId(int taskId) {
TaskInstance taskInstance = taskInstanceMapper.selectById(taskId);
if (taskInstance != null) {
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
}
return null;
}
/**
* find udf function list by id list string
*
* @param ids ids
* @return udf function list
*/
public List<UdfFunc> queryUdfFunListByIds(Integer[] ids) {
return udfFuncMapper.queryUdfByIdStr(ids, null);
}
/**
* find tenant code by resource name
*
* @param resName resource name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param resourceType resource type
* @return tenant code
*/
public String queryTenantCodeByResName(String resName, ResourceType resourceType) {
String fullName = resName.startsWith("/") ? resName : String.format("/%s", resName);
List<Resource> resourceList = resourceMapper.queryResource(fullName, resourceType.ordinal());
if (CollectionUtils.isEmpty(resourceList)) {
return StringUtils.EMPTY;
}
int userId = resourceList.get(0).getUserId();
User user = userMapper.selectById(userId);
if (Objects.isNull(user)) {
return StringUtils.EMPTY;
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (Objects.isNull(tenant)) {
return StringUtils.EMPTY;
}
return tenant.getTenantCode();
}
/**
* find schedule list by process define codes.
*
* @param codes codes
* @return schedule list
*/
public List<Schedule> selectAllByProcessDefineCode(long[] codes) {
return scheduleMapper.selectAllByProcessDefineArray(codes);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | /**
* find last scheduler process instance in the date interval
*
* @param definitionCode definitionCode
* @param dateInterval dateInterval
* @return process instance
*/
public ProcessInstance findLastSchedulerProcessInterval(Long definitionCode, DateInterval dateInterval) {
return processInstanceMapper.queryLastSchedulerProcess(definitionCode,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last manual process instance interval
*
* @param definitionCode process definition code
* @param dateInterval dateInterval
* @return process instance
*/
public ProcessInstance findLastManualProcessInterval(Long definitionCode, DateInterval dateInterval) {
return processInstanceMapper.queryLastManualProcess(definitionCode,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/**
* find last running process instance
*
* @param definitionCode process definition code
* @param startTime start time
* @param endTime end time |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return process instance
*/
public ProcessInstance findLastRunningProcess(Long definitionCode, Date startTime, Date endTime) {
return processInstanceMapper.queryLastRunningProcess(definitionCode,
startTime,
endTime,
stateArray);
}
/**
* query user queue by process instance
*
* @param processInstance processInstance
* @return queue
*/
public String queryUserQueueByProcessInstance(ProcessInstance processInstance) {
String queue = "";
if (processInstance == null) {
return queue;
}
User executor = userMapper.selectById(processInstance.getExecutorId());
if (executor != null) {
queue = executor.getQueue();
}
return queue;
}
/**
* query project name and user name by processInstanceId.
*
* @param processInstanceId processInstanceId
* @return projectName and userName |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public ProjectUser queryProjectWithUserByProcessInstanceId(int processInstanceId) {
return projectMapper.queryProjectWithUserByProcessInstanceId(processInstanceId);
}
/**
* get task worker group
*
* @param taskInstance taskInstance
* @return workerGroupId
*/
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup();
if (StringUtils.isNotBlank(workerGroup)) {
return workerGroup;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if (processInstance != null) {
return processInstance.getWorkerGroup();
}
logger.info("task : {} will use default worker group", taskInstance.getId());
return Constants.DEFAULT_WORKER_GROUP;
}
/**
* get have perm project list
*
* @param userId userId
* @return project list
*/
public List<Project> getProjectListHavePerm(int userId) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
if (createProjects == null) {
createProjects = new ArrayList<>();
}
if (authedProjects != null) {
createProjects.addAll(authedProjects);
}
return createProjects;
}
/**
* list unauthorized udf function
*
* @param userId user id
* @param needChecks data source id array
* @return unauthorized udf function list
*/
public <T> List<T> listUnauthorized(int userId, T[] needChecks, AuthorizationType authorizationType) {
List<T> resultList = new ArrayList<>();
if (Objects.nonNull(needChecks) && needChecks.length > 0) {
Set<T> originResSet = new HashSet<>(Arrays.asList(needChecks));
switch (authorizationType) {
case RESOURCE_FILE_ID:
case UDF_FILE:
List<Resource> ownUdfResources = resourceMapper.listAuthorizedResourceById(userId, needChecks);
addAuthorizedResources(ownUdfResources, userId);
Set<Integer> authorizedResourceFiles = ownUdfResources.stream().map(Resource::getId).collect(toSet());
originResSet.removeAll(authorizedResourceFiles);
break;
case RESOURCE_FILE_NAME: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<Resource> ownResources = resourceMapper.listAuthorizedResource(userId, needChecks);
addAuthorizedResources(ownResources, userId);
Set<String> authorizedResources = ownResources.stream().map(Resource::getFullName).collect(toSet());
originResSet.removeAll(authorizedResources);
break;
case DATASOURCE:
Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId, needChecks).stream().map(DataSource::getId).collect(toSet());
originResSet.removeAll(authorizedDatasources);
break;
case UDF:
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet());
originResSet.removeAll(authorizedUdfs);
break;
default:
break;
}
resultList.addAll(originResSet);
}
return resultList;
}
/**
* get user by user id
*
* @param userId user id
* @return User
*/
public User getUserById(int userId) {
return userMapper.selectById(userId);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * get resource by resource id
*
* @param resourceId resource id
* @return Resource
*/
public Resource getResourceById(int resourceId) {
return resourceMapper.selectById(resourceId);
}
/**
* list resources by ids
*
* @param resIds resIds
* @return resource list
*/
public List<Resource> listResourceByIds(Integer[] resIds) {
return resourceMapper.listResourceByIds(resIds);
}
/**
* format task app id in task instance
*/
public String formatTaskAppId(TaskInstance taskInstance) {
ProcessInstance processInstance = findProcessInstanceById(taskInstance.getProcessInstanceId());
if (processInstance == null) {
return "";
}
ProcessDefinition definition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion());
if (definition == null) {
return "";
}
return String.format("%s_%s_%s", definition.getId(), processInstance.getId(), taskInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* switch process definition version to process definition log version
*/
public int switchVersion(ProcessDefinition processDefinition, ProcessDefinitionLog processDefinitionLog) {
if (null == processDefinition || null == processDefinitionLog) {
return Constants.DEFINITION_FAILURE;
}
processDefinitionLog.setId(processDefinition.getId());
processDefinitionLog.setReleaseState(ReleaseState.OFFLINE);
processDefinitionLog.setFlag(Flag.YES);
int result = processDefineMapper.updateById(processDefinitionLog);
if (result > 0) {
result = switchProcessTaskRelationVersion(processDefinitionLog);
if (result <= 0) {
return Constants.EXIT_CODE_FAILURE;
}
}
return result;
}
public int switchProcessTaskRelationVersion(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
if (!processTaskRelationList.isEmpty()) {
processTaskRelationMapper.deleteByCode(processDefinition.getProjectCode(), processDefinition.getCode());
}
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
int batchInsert = processTaskRelationMapper.batchInsert(processTaskRelationLogList);
if (batchInsert == 0) {
return Constants.EXIT_CODE_FAILURE;
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | int result = 0;
for (ProcessTaskRelationLog taskRelationLog : processTaskRelationLogList) {
int switchResult = switchTaskDefinitionVersion(taskRelationLog.getPostTaskCode(), taskRelationLog.getPostTaskVersion());
if (switchResult != Constants.EXIT_CODE_FAILURE) {
result++;
}
}
return result;
}
}
public int switchTaskDefinitionVersion(long taskCode, int taskVersion) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByCode(taskCode);
if (taskDefinition == null) {
return Constants.EXIT_CODE_FAILURE;
}
if (taskDefinition.getVersion() == taskVersion) {
return Constants.EXIT_CODE_SUCCESS;
}
TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskVersion);
if (taskDefinitionUpdate == null) {
return Constants.EXIT_CODE_FAILURE;
}
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
return taskDefinitionMapper.updateById(taskDefinitionUpdate);
}
/**
* get resource ids
*
* @param taskDefinition taskDefinition |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @return resource ids
*/
public String getResourceIds(TaskDefinition taskDefinition) {
Set<Integer> resourceIds = null;
AbstractParameters params = taskPluginManager.getParameters(ParametersNode.builder().taskType(taskDefinition.getTaskType()).taskParams(taskDefinition.getTaskParams()).build());
if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) {
resourceIds = params.getResourceFilesList().
stream()
.filter(t -> t.getId() != 0)
.map(ResourceInfo::getId)
.collect(Collectors.toSet());
}
if (CollectionUtils.isEmpty(resourceIds)) {
return StringUtils.EMPTY;
}
return StringUtils.join(resourceIds, ",");
}
public int saveTaskDefine(User operator, long projectCode, List<TaskDefinitionLog> taskDefinitionLogs, Boolean syncDefine) {
Date now = new Date();
List<TaskDefinitionLog> newTaskDefinitionLogs = new ArrayList<>();
List<TaskDefinitionLog> updateTaskDefinitionLogs = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperateTime(now);
taskDefinitionLog.setOperator(operator.getId());
taskDefinitionLog.setResourceIds(getResourceIds(taskDefinitionLog));
if (taskDefinitionLog.getCode() > 0 && taskDefinitionLog.getVersion() > 0) {
TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper
.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if (definitionCodeAndVersion != null) {
if (!taskDefinitionLog.equals(definitionCodeAndVersion)) {
taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
taskDefinitionLog.setVersion(version + 1);
taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
updateTaskDefinitionLogs.add(taskDefinitionLog);
}
continue;
}
}
taskDefinitionLog.setUserId(operator.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
if (taskDefinitionLog.getCode() == 0) {
try {
taskDefinitionLog.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
return Constants.DEFINITION_FAILURE;
}
}
newTaskDefinitionLogs.add(taskDefinitionLog);
}
int insertResult = 0;
int updateResult = 0;
for (TaskDefinitionLog taskDefinitionToUpdate : updateTaskDefinitionLogs) {
TaskDefinition task = taskDefinitionMapper.queryByCode(taskDefinitionToUpdate.getCode());
if (task == null) {
newTaskDefinitionLogs.add(taskDefinitionToUpdate); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | } else {
insertResult += taskDefinitionLogMapper.insert(taskDefinitionToUpdate);
if (Boolean.TRUE.equals(syncDefine)) {
taskDefinitionToUpdate.setId(task.getId());
updateResult += taskDefinitionMapper.updateById(taskDefinitionToUpdate);
} else {
updateResult++;
}
}
}
if (!newTaskDefinitionLogs.isEmpty()) {
insertResult += taskDefinitionLogMapper.batchInsert(newTaskDefinitionLogs);
if (Boolean.TRUE.equals(syncDefine)) {
updateResult += taskDefinitionMapper.batchInsert(newTaskDefinitionLogs);
} else {
updateResult += newTaskDefinitionLogs.size();
}
}
return (insertResult & updateResult) > 0 ? 1 : Constants.EXIT_CODE_SUCCESS;
}
/**
* save processDefinition (including create or update processDefinition)
*/
public int saveProcessDefine(User operator, ProcessDefinition processDefinition, Boolean syncDefine, Boolean isFromProcessDefine) {
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition);
Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinition.getCode());
int insertVersion = version == null || version == 0 ? Constants.VERSION_FIRST : version + 1;
processDefinitionLog.setVersion(insertVersion);
processDefinitionLog.setReleaseState(!isFromProcessDefine || processDefinitionLog.getReleaseState() == ReleaseState.ONLINE ? ReleaseState.ONLINE : ReleaseState.OFFLINE);
processDefinitionLog.setOperator(operator.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processDefinitionLog.setOperateTime(processDefinition.getUpdateTime());
int insertLog = processDefineLogMapper.insert(processDefinitionLog);
int result = 1;
if (Boolean.TRUE.equals(syncDefine)) {
if (0 == processDefinition.getId()) {
result = processDefineMapper.insert(processDefinitionLog);
} else {
processDefinitionLog.setId(processDefinition.getId());
result = processDefineMapper.updateById(processDefinitionLog);
}
}
return (insertLog & result) > 0 ? insertVersion : 0;
}
/**
* save task relations
*/
public int saveTaskRelation(User operator, long projectCode, long processDefinitionCode, int processDefinitionVersion,
List<ProcessTaskRelationLog> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs,
Boolean syncDefine) {
if (taskRelationList.isEmpty()) {
return Constants.EXIT_CODE_SUCCESS;
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = null;
if (CollectionUtils.isNotEmpty(taskDefinitionLogs)) {
taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinition::getCode, taskDefinitionLog -> taskDefinitionLog));
}
Date now = new Date();
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
processTaskRelationLog.setProjectCode(projectCode); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processTaskRelationLog.setProcessDefinitionCode(processDefinitionCode);
processTaskRelationLog.setProcessDefinitionVersion(processDefinitionVersion);
if (taskDefinitionLogMap != null) {
TaskDefinitionLog preTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPreTaskCode());
if (preTaskDefinitionLog != null) {
processTaskRelationLog.setPreTaskVersion(preTaskDefinitionLog.getVersion());
}
TaskDefinitionLog postTaskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPostTaskCode());
if (postTaskDefinitionLog != null) {
processTaskRelationLog.setPostTaskVersion(postTaskDefinitionLog.getVersion());
}
}
processTaskRelationLog.setCreateTime(now);
processTaskRelationLog.setUpdateTime(now);
processTaskRelationLog.setOperator(operator.getId());
processTaskRelationLog.setOperateTime(now);
}
int insert = taskRelationList.size();
if (Boolean.TRUE.equals(syncDefine)) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
if (!processTaskRelationList.isEmpty()) {
Set<Integer> processTaskRelationSet = processTaskRelationList.stream().map(ProcessTaskRelation::hashCode).collect(toSet());
Set<Integer> taskRelationSet = taskRelationList.stream().map(ProcessTaskRelationLog::hashCode).collect(toSet());
boolean result = CollectionUtils.isEqualCollection(processTaskRelationSet, taskRelationSet);
if (result) {
return Constants.EXIT_CODE_SUCCESS;
}
processTaskRelationMapper.deleteByCode(projectCode, processDefinitionCode);
}
insert = processTaskRelationMapper.batchInsert(taskRelationList); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
int resultLog = processTaskRelationLogMapper.batchInsert(taskRelationList);
return (insert & resultLog) > 0 ? Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE;
}
public boolean isTaskOnline(long taskCode) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByTaskCode(taskCode);
if (!processTaskRelationList.isEmpty()) {
Set<Long> processDefinitionCodes = processTaskRelationList
.stream()
.map(ProcessTaskRelation::getProcessDefinitionCode)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefineMapper.queryByCodes(processDefinitionCodes);
for (ProcessDefinition processDefinition : processDefinitionList) {
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
return true;
}
}
}
return false;
}
/**
* Generate the DAG Graph based on the process definition id
* Use temporarily before refactoring taskNode
*
* @param processDefinition process definition
* @return dag graph
*/
public DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<TaskNode> taskNodeList = transformTask(taskRelations, Lists.newArrayList());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList, new ArrayList<>(taskRelations));
return DagHelper.buildDagGraph(processDag);
}
/**
* generate DagData
*/
public DagData genDagData(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion());
List<TaskDefinitionLog> taskDefinitionLogList = genTaskDefineList(taskRelations);
List<TaskDefinition> taskDefinitions = taskDefinitionLogList.stream().map(t -> (TaskDefinition) t).collect(Collectors.toList());
return new DagData(processDefinition, taskRelations, taskDefinitions);
}
public List<TaskDefinitionLog> genTaskDefineList(List<ProcessTaskRelation> processTaskRelations) {
Set<TaskDefinition> taskDefinitionSet = new HashSet<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPreTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion()));
}
if (processTaskRelation.getPostTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion()));
}
}
if (taskDefinitionSet.isEmpty()) {
return Lists.newArrayList();
}
return taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionSet);
}
public List<TaskDefinitionLog> getTaskDefineLogListByRelation(List<ProcessTaskRelation> processTaskRelations) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<TaskDefinitionLog> taskDefinitionLogs = new ArrayList<>();
Map<Long, Integer> taskCodeVersionMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPreTaskCode() > 0) {
taskCodeVersionMap.put(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion());
}
if (processTaskRelation.getPostTaskCode() > 0) {
taskCodeVersionMap.put(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion());
}
}
taskCodeVersionMap.forEach((code,version) -> {
taskDefinitionLogs.add((TaskDefinitionLog) this.findTaskDefinition(code, version));
});
return taskDefinitionLogs;
}
/**
* find task definition by code and version
*/
public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersion) {
return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion);
}
/**
* find process task relation list by process
*/
public List<ProcessTaskRelation> findRelationByCode(long processDefinitionCode, int processDefinitionVersion) {
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinitionCode, processDefinitionVersion);
return processTaskRelationLogList.stream().map(r -> (ProcessTaskRelation) r).collect(Collectors.toList());
}
/**
* add authorized resources |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | *
* @param ownResources own resources
* @param userId userId
*/
private void addAuthorizedResources(List<Resource> ownResources, int userId) {
List<Integer> relationResourceIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 7);
List<Resource> relationResources = CollectionUtils.isNotEmpty(relationResourceIds) ? resourceMapper.queryResourceListById(relationResourceIds) : new ArrayList<>();
ownResources.addAll(relationResources);
}
/**
* Use temporarily before refactoring taskNode
*/
public List<TaskNode> transformTask(List<ProcessTaskRelation> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<Long, List<Long>> taskCodeMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
taskCodeMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> {
if (v == null) {
v = new ArrayList<>();
}
if (processTaskRelation.getPreTaskCode() != 0L) {
v.add(processTaskRelation.getPreTaskCode());
}
return v;
});
}
if (CollectionUtils.isEmpty(taskDefinitionLogs)) {
taskDefinitionLogs = genTaskDefineList(taskRelationList);
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<TaskNode> taskNodeList = new ArrayList<>();
for (Entry<Long, List<Long>> code : taskCodeMap.entrySet()) {
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMap.get(code.getKey());
if (taskDefinitionLog != null) {
TaskNode taskNode = new TaskNode();
taskNode.setCode(taskDefinitionLog.getCode());
taskNode.setVersion(taskDefinitionLog.getVersion());
taskNode.setName(taskDefinitionLog.getName());
taskNode.setDesc(taskDefinitionLog.getDescription());
taskNode.setType(taskDefinitionLog.getTaskType().toUpperCase());
taskNode.setRunFlag(taskDefinitionLog.getFlag() == Flag.YES ? Constants.FLOWNODE_RUN_FLAG_NORMAL : Constants.FLOWNODE_RUN_FLAG_FORBIDDEN);
taskNode.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes());
taskNode.setRetryInterval(taskDefinitionLog.getFailRetryInterval());
Map<String, Object> taskParamsMap = taskNode.taskParamsToJsonObj(taskDefinitionLog.getTaskParams());
taskNode.setConditionResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.CONDITION_RESULT)));
taskNode.setSwitchResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.SWITCH_RESULT)));
taskNode.setDependence(JSONUtils.toJsonString(taskParamsMap.get(Constants.DEPENDENCE)));
taskParamsMap.remove(Constants.CONDITION_RESULT);
taskParamsMap.remove(Constants.DEPENDENCE);
taskNode.setParams(JSONUtils.toJsonString(taskParamsMap));
taskNode.setTaskInstancePriority(taskDefinitionLog.getTaskPriority());
taskNode.setWorkerGroup(taskDefinitionLog.getWorkerGroup());
taskNode.setEnvironmentCode(taskDefinitionLog.getEnvironmentCode());
taskNode.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN,
taskDefinitionLog.getTimeoutNotifyStrategy(),
taskDefinitionLog.getTimeout())));
taskNode.setDelayTime(taskDefinitionLog.getDelayTime());
taskNode.setPreTasks(JSONUtils.toJsonString(code.getValue().stream().map(taskDefinitionLogMap::get).map(TaskDefinition::getCode).collect(Collectors.toList())));
taskNode.setTaskGroupId(taskDefinitionLog.getTaskGroupId());
taskNode.setTaskGroupPriority(taskDefinitionLog.getTaskGroupPriority()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskNodeList.add(taskNode);
}
}
return taskNodeList;
}
public Map<ProcessInstance, TaskInstance> notifyProcessList(int processId) {
HashMap<ProcessInstance, TaskInstance> processTaskMap = new HashMap<>();
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(processId);
if (processInstanceMap == null) {
return processTaskMap;
}
ProcessInstance fatherProcess = this.findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
TaskInstance fatherTask = this.findTaskInstanceById(processInstanceMap.getParentTaskInstanceId());
if (fatherProcess != null) {
processTaskMap.put(fatherProcess, fatherTask);
}
return processTaskMap;
}
public DqExecuteResult getDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.getExecuteResultById(taskInstanceId);
}
public int updateDqExecuteResultUserId(int taskInstanceId) {
DqExecuteResult dqExecuteResult =
dqExecuteResultMapper.selectOne(new QueryWrapper<DqExecuteResult>().eq(TASK_INSTANCE_ID,taskInstanceId));
if (dqExecuteResult == null) {
return -1;
}
ProcessInstance processInstance = processInstanceMapper.selectById(dqExecuteResult.getProcessInstanceId());
if (processInstance == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return -1;
}
ProcessDefinition processDefinition = processDefineMapper.queryByCode(processInstance.getProcessDefinitionCode());
if (processDefinition == null) {
return -1;
}
dqExecuteResult.setProcessDefinitionId(processDefinition.getId());
dqExecuteResult.setUserId(processDefinition.getUserId());
dqExecuteResult.setState(DqTaskState.DEFAULT.getCode());
return dqExecuteResultMapper.updateById(dqExecuteResult);
}
public int updateDqExecuteResultState(DqExecuteResult dqExecuteResult) {
return dqExecuteResultMapper.updateById(dqExecuteResult);
}
public int deleteDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.delete(
new QueryWrapper<DqExecuteResult>()
.eq(TASK_INSTANCE_ID,taskInstanceId));
}
public int deleteTaskStatisticsValueByTaskInstanceId(int taskInstanceId) {
return dqTaskStatisticsValueMapper.delete(
new QueryWrapper<DqTaskStatisticsValue>()
.eq(TASK_INSTANCE_ID,taskInstanceId));
}
public DqRule getDqRule(int ruleId) {
return dqRuleMapper.selectById(ruleId);
}
public List<DqRuleInputEntry> getRuleInputEntry(int ruleId) {
return DqRuleUtils.transformInputEntry(dqRuleInputEntryMapper.getRuleInputEntryList(ruleId));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public List<DqRuleExecuteSql> getDqExecuteSql(int ruleId) {
return dqRuleExecuteSqlMapper.getExecuteSqlList(ruleId);
}
public DqComparisonType getComparisonTypeById(int id) {
return dqComparisonTypeMapper.selectById(id);
}
/**
* the first time (when submit the task ) get the resource of the task group
* @param taskId task id
* @param taskName
* @param groupId
* @param processId
* @param priority
* @return
*/
public boolean acquireTaskGroup(int taskId,
String taskName, int groupId,
int processId, int priority) {
TaskGroup taskGroup = taskGroupMapper.selectById(groupId);
if (taskGroup == null) {
return true;
}
if (taskGroup.getStatus() == Flag.NO.getCode()) {
return true;
}
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskId);
if (taskGroupQueue == null) {
taskGroupQueue = insertIntoTaskGroupQueue(taskId, taskName, groupId, processId, priority, TaskGroupQueueStatus.WAIT_QUEUE);
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if (taskGroupQueue.getStatus() == TaskGroupQueueStatus.ACQUIRE_SUCCESS) {
return true;
}
taskGroupQueue.setInQueue(Flag.NO.getCode());
taskGroupQueue.setStatus(TaskGroupQueueStatus.WAIT_QUEUE);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
}
List<TaskGroupQueue> highPriorityTasks = taskGroupQueueMapper.queryHighPriorityTasks(groupId, priority, TaskGroupQueueStatus.WAIT_QUEUE.getCode());
if (CollectionUtils.isNotEmpty(highPriorityTasks)) {
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
int count = taskGroupMapper.selectAvailableCountById(groupId);
if (count == 1 && robTaskGroupResouce(taskGroupQueue)) {
return true;
}
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
/**
* try to get the task group resource(when other task release the resource)
* @param taskGroupQueue
* @return
*/
public boolean robTaskGroupResouce(TaskGroupQueue taskGroupQueue) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskGroupQueue.getGroupId());
int affectedCount = taskGroupMapper.updateTaskGroupResource(taskGroup.getId(),taskGroupQueue.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if (affectedCount > 0) {
taskGroupQueue.setStatus(TaskGroupQueueStatus.ACQUIRE_SUCCESS);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return true;
}
return false;
}
public boolean acquireTaskGroupAgain(TaskGroupQueue taskGroupQueue) {
return robTaskGroupResouce(taskGroupQueue);
}
public void releaseAllTaskGroup(int processInstanceId) {
List<TaskInstance> taskInstances = this.taskInstanceMapper.loadAllInfosNoRelease(processInstanceId, TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
for (TaskInstance info : taskInstances) {
releaseTaskGroup(info);
}
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @return the result code and msg
*/
public TaskInstance releaseTaskGroup(TaskInstance taskInstance) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
if (taskGroup == null) {
return null;
}
TaskGroupQueue thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId());
if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
try {
while (taskGroupMapper.releaseTaskGroupResource(taskGroup.getId(), taskGroup.getUseSize()
, thisTaskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()) != 1) {
thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId());
if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null;
}
taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
}
} catch (Exception e) {
logger.error("release the task group error",e);
}
logger.info("updateTask:{}",taskInstance.getName());
changeTaskGroupQueueStatus(taskInstance.getId(), TaskGroupQueueStatus.RELEASE);
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
while (this.taskGroupQueueMapper.updateInQueueCAS(Flag.NO.getCode(), Flag.YES.getCode(), taskGroupQueue.getId()) != 1) {
taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
}
return this.taskInstanceMapper.selectById(taskGroupQueue.getTaskId());
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * release the TGQ resource when the corresponding task is finished.
*
* @param taskId task id
* @return the result code and msg
*/
public void changeTaskGroupQueueStatus(int taskId, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.queryByTaskId(taskId);
taskGroupQueue.setStatus(status);
taskGroupQueue.setUpdateTime(new Date(System.currentTimeMillis()));
taskGroupQueueMapper.updateById(taskGroupQueue);
}
/**
* insert into task group queue
*
* @param taskId task id
* @param taskName task name
* @param groupId group id
* @param processId process id
* @param priority priority
* @return result and msg code
*/
public TaskGroupQueue insertIntoTaskGroupQueue(Integer taskId,
String taskName, Integer groupId,
Integer processId, Integer priority, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = new TaskGroupQueue(taskId, taskName, groupId, processId, priority, status);
taskGroupQueue.setCreateTime(new Date());
taskGroupQueue.setUpdateTime(new Date());
taskGroupQueueMapper.insert(taskGroupQueue);
return taskGroupQueue;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,790 | [Bug] [Process Definition] Duplicate key TaskDefinition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
I'm trying to save an process instance which was upgrade from before version(v2.0.1) and it reporting this error:
![Uploading Screen Shot 2022-03-10 at 10.41.08 AM.png…]()
### What you expected to happen
saved successfully
### How to reproduce
upgrade from v2.0.1 to v2.0.3,and try to modify process instance and save
### Anything else
_No response_
### Version
2.0.3
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8790 | https://github.com/apache/dolphinscheduler/pull/8986 | 30746d9762b350df530187a628c58c547c7f7ba1 | a93033b62051c5cd0c509c6d856c3a75697da6ae | 2022-03-10T02:42:43Z | java | 2022-03-18T11:02:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public int updateTaskGroupQueueStatus(Integer taskId, int status) {
return taskGroupQueueMapper.updateStatusByTaskId(taskId, status);
}
public int updateTaskGroupQueue(TaskGroupQueue taskGroupQueue) {
return taskGroupQueueMapper.updateById(taskGroupQueue);
}
public TaskGroupQueue loadTaskGroupQueue(int taskId) {
return this.taskGroupQueueMapper.queryByTaskId(taskId);
}
public void sendStartTask2Master(ProcessInstance processInstance,int taskId,
org.apache.dolphinscheduler.remote.command.CommandType taskType) {
String host = processInstance.getHost();
String address = host.split(":")[0];
int port = Integer.parseInt(host.split(":")[1]);
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand(
processInstance.getId(), taskId
);
stateEventCallbackService.sendResult(address, port, taskEventChangeCommand.convert2Command(taskType));
}
public ProcessInstance loadNextProcess4Serial(long code, int state) {
return this.processInstanceMapper.loadNextProcess4Serial(code, state);
}
private void deleteCommandWithCheck(int commandId) {
int delete = this.commandMapper.deleteById(commandId);
if (delete != 1) {
throw new ServiceException("delete command fail, id:" + commandId);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java | /*
* Licensed to 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. Apache Software Foundation (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.e2e.cases;
import org.apache.dolphinscheduler.e2e.core.DolphinScheduler;
import org.apache.dolphinscheduler.e2e.pages.LoginPage;
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
import org.apache.dolphinscheduler.e2e.pages.project.ProjectDetailPage; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java | import org.apache.dolphinscheduler.e2e.pages.project.ProjectPage;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowDefinitionTab;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm.TaskType;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowInstanceTab;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowInstanceTab.Row;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.ShellTaskForm;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.task.SubWorkflowTaskForm;
import org.apache.dolphinscheduler.e2e.pages.security.SecurityPage;
import org.apache.dolphinscheduler.e2e.pages.security.TenantPage;
import org.apache.dolphinscheduler.e2e.pages.security.UserPage;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Order;
import org.junit.jupiter.api.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
@DolphinScheduler(composeFiles = "docker/basic/docker-compose.yaml")
class WorkflowE2ETest {
private static final String project = "test-workflow-1";
private static final String user = "admin";
private static final String password = "dolphinscheduler123";
private static final String email = "[email protected]";
private static final String phone = "15800000000";
private static final String tenant = System.getProperty("user.name");
private static RemoteWebDriver browser;
@BeforeAll |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java | public static void setup() {
UserPage userPage = new LoginPage(browser)
.login("admin", "dolphinscheduler123")
.goToNav(SecurityPage.class)
.goToTab(TenantPage.class)
.create(tenant)
.goToNav(SecurityPage.class)
.goToTab(UserPage.class);
new WebDriverWait(userPage.driver(), 20).until(ExpectedConditions.visibilityOfElementLocated(
new By.ByClassName("name")));
userPage.update(user, user, password, email, phone, tenant)
.goToNav(ProjectPage.class)
.create(project)
;
}
@Test
@Order(1)
void testCreateWorkflow() {
final String workflow = "test-workflow-1";
WorkflowDefinitionTab workflowDefinitionPage =
new ProjectPage(browser)
.goTo(project)
.goToTab(WorkflowDefinitionTab.class);
workflowDefinitionPage
.createWorkflow()
.<ShellTaskForm> addTask(TaskType.SHELL)
.script("echo ${today}\necho ${global_param}\n")
.name("test-1")
.addParam("today", "${system.datetime}")
.submit() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java | .submit()
.name(workflow)
.tenant(tenant)
.addGlobalParam("global_param", "hello world")
.submit()
;
await().untilAsserted(() -> assertThat(workflowDefinitionPage.workflowList())
.as("Workflow list should contain newly-created workflow")
.anyMatch(
it -> it.getText().contains(workflow)
));
workflowDefinitionPage.publish(workflow);
}
@Test
@Order(30)
void testRunWorkflow() {
final String workflow = "test-workflow-1";
final ProjectDetailPage projectPage =
new ProjectPage(browser)
.goToNav(ProjectPage.class)
.goTo(project);
projectPage
.goToTab(WorkflowInstanceTab.class)
.deleteAll();
projectPage
.goToTab(WorkflowDefinitionTab.class)
.run(workflow)
.submit();
await().untilAsserted(() -> {
browser.navigate().refresh(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/cases/WorkflowE2ETest.java | final Row row = projectPage
.goToTab(WorkflowInstanceTab.class)
.instances()
.iterator()
.next();
assertThat(row.isSuccess()).isTrue();
assertThat(row.executionTime()).isEqualTo(1);
});
projectPage
.goToTab(WorkflowInstanceTab.class)
.instances()
.stream()
.filter(it -> it.rerunButton().isDisplayed())
.iterator()
.next()
.rerun();
await().untilAsserted(() -> {
browser.navigate().refresh();
final Row row = projectPage
.goToTab(WorkflowInstanceTab.class)
.instances()
.iterator()
.next();
assertThat(row.isSuccess()).isTrue();
assertThat(row.executionTime()).isEqualTo(2);
});
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.apache.dolphinscheduler.e2e.pages.project.workflow;
import lombok.Getter;
import org.apache.dolphinscheduler.e2e.pages.common.NavBarPage;
import org.apache.dolphinscheduler.e2e.pages.project.ProjectDetailPage;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.FindBys;
import java.util.List;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@Getter
public final class WorkflowDefinitionTab extends NavBarPage implements ProjectDetailPage.Tab {
@FindBy(className = "btn-create-process")
private WebElement buttonCreateProcess;
@FindBy(className = "select-all")
private WebElement checkBoxSelectAll;
@FindBy(className = "btn-delete-all") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java | private WebElement buttonDeleteAll;
@FindBys({
@FindBy(className = "n-popconfirm__action"),
@FindBy(className = "n-button--primary-type"),
})
private WebElement buttonConfirm;
@FindBy(className = "items")
private List<WebElement> workflowList;
public WorkflowDefinitionTab(RemoteWebDriver driver) {
super(driver);
}
public WorkflowForm createWorkflow() {
buttonCreateProcess().click();
return new WorkflowForm(driver);
}
public WorkflowDefinitionTab publish(String workflow) {
workflowList()
.stream()
.filter(it -> it.findElement(By.className("workflow-name")).getAttribute("innerText").equals(workflow))
.flatMap(it -> it.findElements(By.className("btn-publish")).stream())
.filter(WebElement::isDisplayed)
.findFirst()
.orElseThrow(() -> new RuntimeException("Can not find publish button in workflow definition"))
.click();
return this;
}
public WorkflowRunDialog run(String workflow) {
workflowList()
.stream()
.filter(it -> it.findElement(By.className("workflow-name")).getAttribute("innerText").equals(workflow)) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowDefinitionTab.java | .flatMap(it -> it.findElements(By.className("btn-run")).stream())
.filter(WebElement::isDisplayed)
.findFirst()
.orElseThrow(() -> new RuntimeException("Can not find run button in workflow definition"))
.click();
return new WorkflowRunDialog(this);
}
public WorkflowDefinitionTab cancelPublishAll() {
List<WebElement> cancelButtons = workflowList()
.stream()
.flatMap(it -> it.findElements(By.className("btn-publish")).stream())
.filter(WebElement::isDisplayed)
.collect(Collectors.toList());
for (WebElement cancelButton : cancelButtons) {
cancelButton.click();
driver().navigate().refresh();
}
return this;
}
public WorkflowDefinitionTab deleteAll() {
if (workflowList().isEmpty()) {
return this;
}
checkBoxSelectAll().click();
buttonDeleteAll().click();
((JavascriptExecutor) driver).executeScript("arguments[0].click();", buttonConfirm());
return this;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.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.e2e.pages.project.workflow.task;
import org.apache.dolphinscheduler.e2e.pages.project.workflow.WorkflowForm;
import lombok.Getter;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.FindBys;
import org.openqa.selenium.support.ui.ExpectedConditions; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,021 | [Feature][E2E] Recover sub_process e2e test in ui-next | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
_No response_
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9021 | https://github.com/apache/dolphinscheduler/pull/9023 | fd5e79bd803a287aa6f7074333029347bcceef1d | 82394ba81d54cab5ada8be06990ec52e486a91b9 | 2022-03-20T02:59:05Z | java | 2022-03-20T05:11:48Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java | import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.List;
@Getter
public final class SubWorkflowTaskForm extends TaskNodeForm {
@FindBys({
@FindBy(className = "select-child-node"),
@FindBy(className = "n-base-selection"),
})
private WebElement btnSelectChildNodeDropdown;
@FindBy(className = "n-base-select-option__content")
private List<WebElement> selectChildNode;
private WebDriver driver;
public SubWorkflowTaskForm(WorkflowForm parent) {
super(parent);
this.driver = parent.driver();
}
public SubWorkflowTaskForm childNode(String node) {
btnSelectChildNodeDropdown().click();
new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(new By.ByClassName(
"n-base-select-option__content")));
selectChildNode()
.stream()
.filter(it -> it.getText().contains(node))
.findFirst()
.orElseThrow(() -> new RuntimeException(String.format("No %s in child node dropdown list", node)))
.click();
return this;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.TaskGroupQueueService;
import org.apache.dolphinscheduler.api.service.TaskGroupService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* task Group Service
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | public class TaskGroupServiceImpl extends BaseServiceImpl implements TaskGroupService {
@Autowired
private TaskGroupMapper taskGroupMapper;
@Autowired
private TaskGroupQueueService taskGroupQueueService;
@Autowired
private ProcessService processService;
private static final Logger logger = LoggerFactory.getLogger(TaskGroupServiceImpl.class);
/**
* create a Task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg
*/
@Override
public Map<String, Object> createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | }
TaskGroup taskGroup1 = taskGroupMapper.queryByName(loginUser.getId(), name);
if (taskGroup1 != null) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = new TaskGroup(name, projectCode, description,
groupSize, loginUser.getId(), Flag.YES.getCode());
taskGroup.setCreateTime(new Date());
taskGroup.setUpdateTime(new Date());
if (taskGroupMapper.insert(taskGroup) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_TASK_GROUP_ERROR);
return result;
}
return result;
}
/**
* update the task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg
*/
@Override
public Map<String, Object> updateTaskGroup(User loginUser, int id, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | if (isNotAdmin(loginUser, result)) {
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result;
}
Integer exists = taskGroupMapper.selectCount(new QueryWrapper<TaskGroup>().lambda().eq(TaskGroup::getName, name).ne(TaskGroup::getId, id));
if (exists > 0) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() != Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_ERROR);
return result;
}
taskGroup.setGroupSize(groupSize);
taskGroup.setDescription(description);
taskGroup.setUpdateTime(new Date());
if (StringUtils.isNotEmpty(name)) {
taskGroup.setName(name);
}
int i = taskGroupMapper.updateById(taskGroup);
logger.info("update result:{}", i);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | return result;
}
/**
* get task group status
*
* @param id task group id
* @return is the task group available
*/
@Override
public boolean isTheTaskGroupAvailable(int id) {
return taskGroupMapper.selectCountByIdStatus(id, Flag.YES.getCode()) == 1;
}
/**
* query all task group by user id
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @return the result code and msg
*/
@Override
public Map<String, Object> queryAllTaskGroup(User loginUser, String name, Integer status, int pageNo, int pageSize) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), name, status);
}
/**
* query all task group by status
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByStatus(User loginUser, int pageNo, int pageSize, int status) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), null, status);
}
/**
* query all task group by name
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @param projectCode project code
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, projectCode);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
private Map<String, Object> getStringObjectMap(int pageNo, int pageSize, Map<String, Object> result, IPage<TaskGroup> taskGroupPaging) {
PageInfo<TaskGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
int total = taskGroupPaging == null ? 0 : (int) taskGroupPaging.getTotal();
List<TaskGroup> list = taskGroupPaging == null ? new ArrayList<TaskGroup>() : taskGroupPaging.getRecords(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | pageInfo.setTotal(total);
pageInfo.setTotalList(list);
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query all task group by id
*
* @param loginUser login user
* @param id id
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupById(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
result.put(Constants.DATA_LIST, taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query
*
* @param pageNo page no
* @param pageSize page size
* @param userId user id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * @param name name
* @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> doQuery(User loginUser, int pageNo, int pageSize, int userId, String name, Integer status) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPaging(page, userId, name, status);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
/**
* close a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> closeTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.NO.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_CLOSED); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | return result;
}
taskGroup.setStatus(Flag.NO.getCode());
taskGroupMapper.updateById(taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* start a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> startTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_OPENED);
return result;
}
taskGroup.setStatus(Flag.YES.getCode());
taskGroup.setUpdateTime(new Date(System.currentTimeMillis()));
int update = taskGroupMapper.updateById(taskGroup);
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,026 | [Bug] [UI Next] When there is no task group, the task group name is always displayed in loading | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When there is no task group, the task group name is always displayed in loading
<img width="921" alt="image" src="https://user-images.githubusercontent.com/95271106/159150317-41a8e5e5-cc83-4c60-a400-80ac690308f1.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9026 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T06:01:38Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | }
/**
* wake a task manually
*
* @param loginUser
* @param queueId task group queue id
* @return result
*/
@Override
public Map<String, Object> forceStartTask(User loginUser, int queueId) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
taskGroupQueueService.forceStartTask(queueId, Flag.YES.getCode());
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public Map<String, Object> modifyPriority(User loginUser, Integer queueId, Integer priority) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
taskGroupQueueService.modifyPriority(queueId, priority);
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.TaskGroupQueueService;
import org.apache.dolphinscheduler.api.service.TaskGroupService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.dao.entity.TaskGroup;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.TaskGroupMapper;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* task Group Service
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | public class TaskGroupServiceImpl extends BaseServiceImpl implements TaskGroupService {
@Autowired
private TaskGroupMapper taskGroupMapper;
@Autowired
private TaskGroupQueueService taskGroupQueueService;
@Autowired
private ProcessService processService;
private static final Logger logger = LoggerFactory.getLogger(TaskGroupServiceImpl.class);
/**
* create a Task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg
*/
@Override
public Map<String, Object> createTaskGroup(User loginUser, Long projectCode, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | }
TaskGroup taskGroup1 = taskGroupMapper.queryByName(loginUser.getId(), name);
if (taskGroup1 != null) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = new TaskGroup(name, projectCode, description,
groupSize, loginUser.getId(), Flag.YES.getCode());
taskGroup.setCreateTime(new Date());
taskGroup.setUpdateTime(new Date());
if (taskGroupMapper.insert(taskGroup) > 0) {
putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_TASK_GROUP_ERROR);
return result;
}
return result;
}
/**
* update the task group
*
* @param loginUser login user
* @param name task group name
* @param description task group description
* @param groupSize task group total size
* @return the result code and msg
*/
@Override
public Map<String, Object> updateTaskGroup(User loginUser, int id, String name, String description, int groupSize) {
Map<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | if (isNotAdmin(loginUser, result)) {
return result;
}
if (name == null) {
putMsg(result, Status.NAME_NULL);
return result;
}
if (groupSize <= 0) {
putMsg(result, Status.TASK_GROUP_SIZE_ERROR);
return result;
}
Integer exists = taskGroupMapper.selectCount(new QueryWrapper<TaskGroup>().lambda().eq(TaskGroup::getName, name).ne(TaskGroup::getId, id));
if (exists > 0) {
putMsg(result, Status.TASK_GROUP_NAME_EXSIT);
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() != Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_ERROR);
return result;
}
taskGroup.setGroupSize(groupSize);
taskGroup.setDescription(description);
taskGroup.setUpdateTime(new Date());
if (StringUtils.isNotEmpty(name)) {
taskGroup.setName(name);
}
int i = taskGroupMapper.updateById(taskGroup);
logger.info("update result:{}", i);
putMsg(result, Status.SUCCESS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | return result;
}
/**
* get task group status
*
* @param id task group id
* @return is the task group available
*/
@Override
public boolean isTheTaskGroupAvailable(int id) {
return taskGroupMapper.selectCountByIdStatus(id, Flag.YES.getCode()) == 1;
}
/**
* query all task group by user id
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @return the result code and msg
*/
@Override
public Map<String, Object> queryAllTaskGroup(User loginUser, String name, Integer status, int pageNo, int pageSize) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), name, status);
}
/**
* query all task group by status
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByStatus(User loginUser, int pageNo, int pageSize, int status) {
return this.doQuery(loginUser, pageNo, pageSize, loginUser.getId(), null, status);
}
/**
* query all task group by name
*
* @param loginUser login user
* @param pageNo page no
* @param pageSize page size
* @param projectCode project code
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupByProjectCode(User loginUser, int pageNo, int pageSize, Long projectCode) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPagingByProjectCode(page, projectCode);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
private Map<String, Object> getStringObjectMap(int pageNo, int pageSize, Map<String, Object> result, IPage<TaskGroup> taskGroupPaging) {
PageInfo<TaskGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
int total = taskGroupPaging == null ? 0 : (int) taskGroupPaging.getTotal();
List<TaskGroup> list = taskGroupPaging == null ? new ArrayList<TaskGroup>() : taskGroupPaging.getRecords(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | pageInfo.setTotal(total);
pageInfo.setTotalList(list);
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query all task group by id
*
* @param loginUser login user
* @param id id
* @return the result code and msg
*/
@Override
public Map<String, Object> queryTaskGroupById(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
result.put(Constants.DATA_LIST, taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query
*
* @param pageNo page no
* @param pageSize page size
* @param userId user id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | * @param name name
* @param status status
* @return the result code and msg
*/
@Override
public Map<String, Object> doQuery(User loginUser, int pageNo, int pageSize, int userId, String name, Integer status) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
Page<TaskGroup> page = new Page<>(pageNo, pageSize);
IPage<TaskGroup> taskGroupPaging = taskGroupMapper.queryTaskGroupPaging(page, userId, name, status);
return getStringObjectMap(pageNo, pageSize, result, taskGroupPaging);
}
/**
* close a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> closeTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.NO.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_CLOSED); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | return result;
}
taskGroup.setStatus(Flag.NO.getCode());
taskGroupMapper.updateById(taskGroup);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* start a task group
*
* @param loginUser login user
* @param id task group id
* @return the result code and msg
*/
@Override
public Map<String, Object> startTaskGroup(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
TaskGroup taskGroup = taskGroupMapper.selectById(id);
if (taskGroup.getStatus() == Flag.YES.getCode()) {
putMsg(result, Status.TASK_GROUP_STATUS_OPENED);
return result;
}
taskGroup.setStatus(Flag.YES.getCode());
taskGroup.setUpdateTime(new Date(System.currentTimeMillis()));
int update = taskGroupMapper.updateById(taskGroup);
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,025 | [Bug] [UI Next] An error is reported when an ordinary user creates a workflow definition | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1. Ordinary users create workflows and drag shell components
2. Picture 404, JS error
<img width="912" alt="image" src="https://user-images.githubusercontent.com/95271106/159149774-6eecc175-1059-407b-8d28-d6eadbc60c8d.png">
3. No operation permission returned by the interface
<img width="1108" alt="image" src="https://user-images.githubusercontent.com/95271106/159149807-efe39272-a5d9-4fe6-b068-5c7a667683c6.png">
### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9025 | https://github.com/apache/dolphinscheduler/pull/9063 | 659c610457c566160b9211764580eab93fdf8c01 | 9b163249d60a3abaf63c834da173dbaa58ebb606 | 2022-03-20T05:49:14Z | java | 2022-03-21T13:52:07Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskGroupServiceImpl.java | }
/**
* wake a task manually
*
* @param loginUser
* @param queueId task group queue id
* @return result
*/
@Override
public Map<String, Object> forceStartTask(User loginUser, int queueId) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
taskGroupQueueService.forceStartTask(queueId, Flag.YES.getCode());
putMsg(result, Status.SUCCESS);
return result;
}
@Override
public Map<String, Object> modifyPriority(User loginUser, Integer queueId, Integer priority) {
Map<String, Object> result = new HashMap<>();
if (isNotAdmin(loginUser, result)) {
return result;
}
taskGroupQueueService.modifyPriority(queueId, priority);
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.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.master.consumer;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.TaskExecuteRequestCommand;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.dispatch.ExecutorDispatcher;
import org.apache.dolphinscheduler.server.master.dispatch.context.ExecutionContext;
import org.apache.dolphinscheduler.server.master.dispatch.enums.ExecutorType;
import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteException;
import org.apache.dolphinscheduler.service.exceptions.TaskPriorityQueueException; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.queue.TaskPriority;
import org.apache.dolphinscheduler.service.queue.TaskPriorityQueue;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* TaskUpdateQueue consumer
*/
@Component
public class TaskPriorityQueueConsumer extends Thread {
/**
* logger of TaskUpdateQueueConsumer
*/
private static final Logger logger = LoggerFactory.getLogger(TaskPriorityQueueConsumer.class);
/**
* taskUpdateQueue
*/
@Autowired
private TaskPriorityQueue<TaskPriority> taskPriorityQueue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | /**
* processService
*/
@Autowired
private ProcessService processService;
/**
* executor dispatcher
*/
@Autowired
private ExecutorDispatcher dispatcher;
/**
* master config
*/
@Autowired
private MasterConfig masterConfig;
/**
* consumer thread pool
*/
private ThreadPoolExecutor consumerThreadPoolExecutor;
@PostConstruct
public void init() {
this.consumerThreadPoolExecutor = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("TaskUpdateQueueConsumerThread", masterConfig.getDispatchTaskNumber());
super.start();
}
@Override
public void run() {
int fetchTaskNum = masterConfig.getDispatchTaskNumber();
while (Stopper.isRunning()) {
try {
List<TaskPriority> failedDispatchTasks = this.batchDispatch(fetchTaskNum); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | if (!failedDispatchTasks.isEmpty()) {
for (TaskPriority dispatchFailedTask : failedDispatchTasks) {
taskPriorityQueue.put(dispatchFailedTask);
}
if (taskPriorityQueue.size() <= failedDispatchTasks.size()) {
TimeUnit.MILLISECONDS.sleep(Constants.SLEEP_TIME_MILLIS);
}
}
} catch (Exception e) {
logger.error("dispatcher task error", e);
}
}
}
/**
* batch dispatch with thread pool
*/
private List<TaskPriority> batchDispatch(int fetchTaskNum) throws TaskPriorityQueueException, InterruptedException {
List<TaskPriority> failedDispatchTasks = Collections.synchronizedList(new ArrayList<>());
CountDownLatch latch = new CountDownLatch(fetchTaskNum);
for (int i = 0; i < fetchTaskNum; i++) {
TaskPriority taskPriority = taskPriorityQueue.poll(Constants.SLEEP_TIME_MILLIS, TimeUnit.MILLISECONDS);
if (Objects.isNull(taskPriority)) {
latch.countDown();
continue;
}
consumerThreadPoolExecutor.submit(() -> {
boolean dispatchResult = this.dispatchTask(taskPriority);
if (!dispatchResult) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | failedDispatchTasks.add(taskPriority);
}
latch.countDown();
});
}
latch.await();
return failedDispatchTasks;
}
/**
* dispatch task
*
* @param taskPriority taskPriority
* @return result
*/
protected boolean dispatchTask(TaskPriority taskPriority) {
boolean result = false;
try {
TaskExecutionContext context = taskPriority.getTaskExecutionContext();
ExecutionContext executionContext = new ExecutionContext(toCommand(context), ExecutorType.WORKER, context.getWorkerGroup());
if (isTaskNeedToCheck(taskPriority)) {
if (taskInstanceIsFinalState(taskPriority.getTaskId())) {
return true;
}
}
result = dispatcher.dispatch(executionContext);
} catch (ExecuteException e) {
logger.error("dispatch error: {}", e.getMessage(), e);
}
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java | }
private Command toCommand(TaskExecutionContext taskExecutionContext) {
TaskExecuteRequestCommand requestCommand = new TaskExecuteRequestCommand();
requestCommand.setTaskExecutionContext(JSONUtils.toJsonString(taskExecutionContext));
return requestCommand.convert2Command();
}
/**
* taskInstance is final state
* success,failure,kill,stop,pause,threadwaiting is final state
*
* @param taskInstanceId taskInstanceId
* @return taskInstance is final state
*/
public Boolean taskInstanceIsFinalState(int taskInstanceId) {
TaskInstance taskInstance = processService.findTaskInstanceById(taskInstanceId);
return taskInstance.getState().typeIsFinished();
}
/**
* check if task need to check state, if true, refresh the checkpoint
*/
private boolean isTaskNeedToCheck(TaskPriority taskPriority) {
long now = System.currentTimeMillis();
if (now - taskPriority.getCheckpoint() > Constants.SECOND_TIME_MILLIS) {
taskPriority.setCheckpoint(now);
return true;
}
return false;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/resource/AbstractResourceParameters.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.api.parameters.resource;
public abstract class AbstractResourceParameters {
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/resource/ResourceParametersHelper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.api.parameters.resource;
import org.apache.dolphinscheduler.plugin.task.api.enums.ResourceType;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public class ResourceParametersHelper { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,070 | [Bug] [Server] SQL task dispatch fail and keep submit state | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
SQL task dispatch fail and no error log.
### What you expected to happen
SQL task can run success.
### How to reproduce
1. create a datasource, like MySQL;
2. create a workflow with a SQL task, like `select now();`, use the MySQL datasource;
3. run workflow;
### 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/9070 | https://github.com/apache/dolphinscheduler/pull/9072 | f5ef410d06e0ef7717dd0065320edbd631aef8c3 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 2022-03-22T03:12:05Z | java | 2022-03-22T06:02:07Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/resource/ResourceParametersHelper.java | private Map<ResourceType, Map<Integer, AbstractResourceParameters>> map = new HashMap<>();
public void put(ResourceType resourceType, Integer id) {
put(resourceType, id, null);
}
public void put(ResourceType resourceType, Integer id, AbstractResourceParameters parameters) {
Map<Integer, AbstractResourceParameters> resourceParametersMap = map.get(resourceType);
if (Objects.isNull(resourceParametersMap)) {
resourceParametersMap = new HashMap<>();
map.put(resourceType, resourceParametersMap);
}
resourceParametersMap.put(id, parameters);
}
public Map<ResourceType, Map<Integer, AbstractResourceParameters>> getResourceMap() {
return map;
}
public Map<Integer, AbstractResourceParameters> getResourceMap(ResourceType resourceType) {
return this.getResourceMap().get(resourceType);
}
public AbstractResourceParameters getResourceParameters(ResourceType resourceType, Integer code) {
return this.getResourceMap(resourceType).get(code);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.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.e2e.pages.project.workflow;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.PageFactory;
import lombok.Getter;
@Getter |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/WorkflowRunDialog.java | public final class WorkflowRunDialog {
private final WorkflowDefinitionTab parent;
@FindBy(className = "btn-submit")
private WebElement buttonSubmit;
public WorkflowRunDialog(WorkflowDefinitionTab parent) {
this.parent = parent;
PageFactory.initElements(parent().driver(), this);
}
public WorkflowDefinitionTab submit() {
buttonSubmit().click();
return parent();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | /*
* Licensed to 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. Apache Software Foundation (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.e2e.core;
import static org.testcontainers.containers.BrowserWebDriverContainer.VncRecordingMode.RECORD_ALL;
import static org.testcontainers.containers.VncRecordingContainer.VncRecordingFormat.MP4;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | import java.time.Duration;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.remote.RemoteWebDriver;
import org.testcontainers.Testcontainers;
import org.testcontainers.containers.BrowserWebDriverContainer;
import org.testcontainers.containers.ContainerState;
import org.testcontainers.containers.DockerComposeContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.shaded.org.awaitility.Awaitility;
import com.google.common.base.Strings;
import com.google.common.net.HostAndPort;
import lombok.extern.slf4j.Slf4j;
@Slf4j
final class DolphinSchedulerExtension
implements BeforeAllCallback, AfterAllCallback,
BeforeEachCallback { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | private final boolean LOCAL_MODE = Objects.equals(System.getProperty("local"), "true");
private RemoteWebDriver driver;
private DockerComposeContainer<?> compose;
private BrowserWebDriverContainer<?> browser;
private Network network;
private HostAndPort address;
private String rootPath;
@Override
@SuppressWarnings("UnstableApiUsage")
public void beforeAll(ExtensionContext context) throws IOException {
Awaitility.setDefaultTimeout(Duration.ofSeconds(60));
Awaitility.setDefaultPollInterval(Duration.ofSeconds(10));
if (LOCAL_MODE) {
runInLocal();
} else {
runInDockerContainer(context);
}
final Path record;
if (!Strings.isNullOrEmpty(System.getenv("RECORDING_PATH"))) {
record = Paths.get(System.getenv("RECORDING_PATH"));
if (!record.toFile().exists()) {
if (!record.toFile().mkdir()) {
throw new IOException("Failed to create recording directory: " + record.toAbsolutePath());
}
}
} else {
record = Files.createTempDirectory("record-");
}
browser = new BrowserWebDriverContainer<>()
.withCapabilities(new ChromeOptions()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | .withCreateContainerCmdModifier(cmd -> cmd.withUser("root"))
.withFileSystemBind(Constants.HOST_CHROME_DOWNLOAD_PATH.toFile().getAbsolutePath(),
Constants.SELENIUM_CONTAINER_CHROME_DOWNLOAD_PATH)
.withRecordingMode(RECORD_ALL, record.toFile(), MP4);
if (network != null) {
browser.withNetwork(network);
}
browser.start();
driver = browser.getWebDriver();
driver.manage().timeouts()
.implicitlyWait(5, TimeUnit.SECONDS)
.pageLoadTimeout(5, TimeUnit.SECONDS);
driver.manage().window()
.maximize();
driver.get(new URL("http", address.getHost(), address.getPort(), rootPath).toString());
browser.beforeTest(new TestDescription(context));
final Class<?> clazz = context.getRequiredTestClass();
Stream.of(clazz.getDeclaredFields())
.filter(it -> Modifier.isStatic(it.getModifiers()))
.filter(f -> WebDriver.class.isAssignableFrom(f.getType()))
.forEach(it -> setDriver(clazz, it));
}
private void runInLocal() {
Testcontainers.exposeHostPorts(8888);
address = HostAndPort.fromParts("host.testcontainers.internal", 8888);
rootPath = "/";
}
private void runInDockerContainer(ExtensionContext context) {
compose = createDockerCompose(context);
compose.start(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | final ContainerState dsContainer = compose.getContainerByServiceName("dolphinscheduler_1")
.orElseThrow(() -> new RuntimeException("Failed to find a container named 'dolphinscheduler'"));
final String networkId = dsContainer.getContainerInfo().getNetworkSettings().getNetworks().keySet().iterator().next();
network = new Network() {
@Override
public String getId() {
return networkId;
}
@Override
public void close() {
}
@Override
public Statement apply(Statement base, Description description) {
return null;
}
};
address = HostAndPort.fromParts("dolphinscheduler", 12345);
rootPath = "/dolphinscheduler/ui/";
}
@Override
public void afterAll(ExtensionContext context) {
browser.afterTest(new TestDescription(context), Optional.empty());
browser.stop();
if (compose != null) {
compose.stop();
}
}
@Override
public void beforeEach(ExtensionContext context) {
final Object instance = context.getRequiredTestInstance(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,039 | [Feature][e2e] Suggest e2e test adapt M1 chip | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Currently ```E2E``` test does not support running in M1 chip.
Suggest to support it.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9039 | https://github.com/apache/dolphinscheduler/pull/9077 | 852597c9bf3340b679be8e11b5fe33b3e34e03e7 | 197accc60107370600719a7ade7e86bd80f69d26 | 2022-03-21T01:54:42Z | java | 2022-03-22T06:11:50Z | dolphinscheduler-e2e/dolphinscheduler-e2e-core/src/main/java/org/apache/dolphinscheduler/e2e/core/DolphinSchedulerExtension.java | Stream.of(instance.getClass().getDeclaredFields())
.filter(f -> WebDriver.class.isAssignableFrom(f.getType()))
.forEach(it -> setDriver(instance, it));
}
private void setDriver(Object object, Field field) {
try {
field.setAccessible(true);
field.set(object, driver);
} catch (IllegalAccessException e) {
LOGGER.error("Failed to inject web driver to field: {}", field.getName(), e);
}
}
private DockerComposeContainer<?> createDockerCompose(ExtensionContext context) {
final Class<?> clazz = context.getRequiredTestClass();
final DolphinScheduler annotation = clazz.getAnnotation(DolphinScheduler.class);
final List<File> files = Stream.of(annotation.composeFiles())
.map(it -> DolphinScheduler.class.getClassLoader().getResource(it))
.filter(Objects::nonNull)
.map(URL::getPath)
.map(File::new)
.collect(Collectors.toList());
compose = new DockerComposeContainer<>(files)
.withPull(true)
.withTailChildContainers(true)
.withLogConsumer("dolphinscheduler_1", outputFrame -> LOGGER.info(outputFrame.getUtf8String()))
.waitingFor("dolphinscheduler_1", Wait.forHealthcheck().withStartupTimeout(Duration.ofSeconds(180)));
return compose;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
import static org.apache.dolphinscheduler.common.Constants.ALIAS;
import static org.apache.dolphinscheduler.common.Constants.CONTENT;
import static org.apache.dolphinscheduler.common.Constants.JAR;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter;
import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor;
import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ServiceException;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.RegexUtils;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ProgramType;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.HadoopUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.PropertyUtils;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.ResourcesUser;
import org.apache.dolphinscheduler.dao.entity.Tenant;
import org.apache.dolphinscheduler.dao.entity.UdfFunc;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceMapper;
import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper;
import org.apache.dolphinscheduler.dao.mapper.TenantMapper;
import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils;
import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.CollectionUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | import org.apache.commons.lang.StringUtils;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.io.Files;
/**
* resources service impl
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | public class ResourcesServiceImpl extends BaseServiceImpl implements ResourcesService {
private static final Logger logger = LoggerFactory.getLogger(ResourcesServiceImpl.class);
@Autowired
private ResourceMapper resourcesMapper;
@Autowired
private UdfFuncMapper udfFunctionMapper;
@Autowired
private TenantMapper tenantMapper;
@Autowired
private UserMapper userMapper;
@Autowired
private ResourceUserMapper resourceUserMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
/**
* create directory
*
* @param loginUser login user
* @param name alias
* @param description description
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create directory result
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | @Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> createDirectory(User loginUser,
String name,
String description,
ResourceType type,
int pid,
String currentDir) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name);
result = verifyResource(loginUser, type, fullName, pid);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
if (checkResourceExists(fullName, type.ordinal())) {
logger.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
Date now = new Date();
Resource resource = new Resource(pid,name,fullName,true,description,name,loginUser.getId(),type,0,now,now);
try {
resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (DuplicateKeyException e) {
logger.error("resource directory {} has exist, can't recreate", fullName);
putMsg(result, Status.RESOURCE_EXIST);
return result;
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new ServiceException("resource already exists, can't recreate");
}
createDirectory(loginUser,fullName,type,result);
return result;
}
/**
* create resource
*
* @param loginUser login user
* @param name alias
* @param desc description
* @param file file
* @param type type
* @param pid parent id
* @param currentDir current directory
* @return create result code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | @Transactional(rollbackFor = Exception.class)
public Result<Object> createResource(User loginUser,
String name,
String desc,
ResourceType type,
MultipartFile file,
int pid,
String currentDir) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
result = verifyPid(loginUser, pid);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String fullName = currentDir.equals("/") ? String.format("%s%s",currentDir,name) : String.format("%s/%s",currentDir,name);
if (checkResourceExists(fullName, type.ordinal())) {
logger.error("resource {} has exist, can't recreate", RegexUtils.escapeNRT(name));
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
Date now = new Date();
Resource resource = new Resource(pid,name,fullName,false,desc,file.getOriginalFilename(),loginUser.getId(),type,file.getSize(),now,now);
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | resourcesMapper.insert(resource);
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!"class".equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue());
}
}
result.setData(resultMap);
} catch (Exception e) {
logger.error("resource already exists, can't recreate ", e);
throw new ServiceException("resource already exists, can't recreate");
}
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", RegexUtils.escapeNRT(name), RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
return result;
}
/**
* check resource is exists
*
* @param fullName fullName
* @param type type
* @return true if resource exists
*/
private boolean checkResourceExists(String fullName, int type) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | Boolean existResource = resourcesMapper.existResource(fullName, type);
return existResource == Boolean.TRUE;
}
/**
* update resource
* @param loginUser login user
* @param resourceId resource id
* @param name name
* @param desc description
* @param type resource type
* @param file resource file
* @return update result code
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> updateResource(User loginUser,
int resourceId,
String name,
String desc,
ResourceType type,
MultipartFile file) {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!hasPerm(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (file == null && name.equals(resource.getAlias()) && desc.equals(resource.getDescription())) {
putMsg(result, Status.SUCCESS);
return result;
}
String originFullName = resource.getFullName();
String originResourceName = resource.getAlias();
String fullName = String.format("%s%s",originFullName.substring(0,originFullName.lastIndexOf("/") + 1),name);
if (!originResourceName.equals(name) && checkResourceExists(fullName, type.ordinal())) {
logger.error("resource {} already exists, can't recreate", name);
putMsg(result, Status.RESOURCE_EXIST);
return result;
}
result = verifyFile(name, type, file);
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
String tenantCode = getTenantCode(resource.getUserId(),result);
if (StringUtils.isEmpty(tenantCode)) {
return result;
}
String originHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,originFullName);
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!HadoopUtils.getInstance().exists(originHdfsFileName)) {
logger.error("{} not exist", originHdfsFileName);
putMsg(result,Status.RESOURCE_NOT_EXIST);
return result;
}
} catch (IOException e) {
logger.error(e.getMessage(),e);
throw new ServiceException(Status.HDFS_OPERATION_ERROR);
}
if (!resource.isDirectory()) {
String originSuffix = Files.getFileExtension(originFullName);
String suffix = Files.getFileExtension(fullName);
boolean suffixIsChanged = false;
if (StringUtils.isBlank(suffix) && StringUtils.isNotBlank(originSuffix)) {
suffixIsChanged = true;
}
if (StringUtils.isNotBlank(suffix) && !suffix.equals(originSuffix)) {
suffixIsChanged = true;
}
if (suffixIsChanged) {
Map<String, Object> columnMap = new HashMap<>();
columnMap.put("resources_id", resourceId);
List<ResourcesUser> resourcesUsers = resourceUserMapper.selectByMap(columnMap);
if (CollectionUtils.isNotEmpty(resourcesUsers)) {
List<Integer> userIds = resourcesUsers.stream().map(ResourcesUser::getUserId).collect(Collectors.toList());
List<User> users = userMapper.selectBatchIds(userIds);
String userNames = users.stream().map(User::getUserName).collect(Collectors.toList()).toString(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | logger.error("resource is authorized to user {},suffix not allowed to be modified", userNames);
putMsg(result,Status.RESOURCE_IS_AUTHORIZED,userNames);
return result;
}
}
}
Date now = new Date();
resource.setAlias(name);
resource.setFileName(name);
resource.setFullName(fullName);
resource.setDescription(desc);
resource.setUpdateTime(now);
if (file != null) {
resource.setSize(file.getSize());
}
try {
resourcesMapper.updateById(resource);
if (resource.isDirectory()) {
List<Integer> childrenResource = listAllChildren(resource,false);
if (CollectionUtils.isNotEmpty(childrenResource)) {
String matcherFullName = Matcher.quoteReplacement(fullName);
List<Resource> childResourceList;
Integer[] childResIdArray = childrenResource.toArray(new Integer[childrenResource.size()]);
List<Resource> resourceList = resourcesMapper.listResourceByIds(childResIdArray);
childResourceList = resourceList.stream().map(t -> {
t.setFullName(t.getFullName().replaceFirst(originFullName, matcherFullName));
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | resourcesMapper.batchUpdateResource(childResourceList);
if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(childResIdArray);
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> {
t.setResourceName(t.getResourceName().replaceFirst(originFullName, matcherFullName));
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
}
} else if (ResourceType.UDF.equals(resource.getType())) {
List<UdfFunc> udfFuncs = udfFunctionMapper.listUdfByResourceId(new Integer[]{resourceId});
if (CollectionUtils.isNotEmpty(udfFuncs)) {
udfFuncs = udfFuncs.stream().map(t -> {
t.setResourceName(fullName);
t.setUpdateTime(now);
return t;
}).collect(Collectors.toList());
udfFunctionMapper.batchUpdateUdfFunc(udfFuncs);
}
}
putMsg(result, Status.SUCCESS);
Map<Object, Object> dataMap = new BeanMap(resource);
Map<String, Object> resultMap = new HashMap<>();
for (Map.Entry<Object, Object> entry: dataMap.entrySet()) {
if (!Constants.CLASS.equalsIgnoreCase(entry.getKey().toString())) {
resultMap.put(entry.getKey().toString(), entry.getValue()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | }
}
result.setData(resultMap);
} catch (Exception e) {
logger.error(Status.UPDATE_RESOURCE_ERROR.getMsg(), e);
throw new ServiceException(Status.UPDATE_RESOURCE_ERROR);
}
if (originResourceName.equals(name) && file == null) {
return result;
}
if (file != null) {
if (!upload(loginUser, fullName, file, type)) {
logger.error("upload resource: {} file: {} failed.", name, RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.HDFS_OPERATION_ERROR);
throw new ServiceException(String.format("upload resource: %s file: %s failed.", name, file.getOriginalFilename()));
}
if (!fullName.equals(originFullName)) {
try {
HadoopUtils.getInstance().delete(originHdfsFileName,false);
} catch (IOException e) {
logger.error(e.getMessage(),e);
throw new ServiceException(String.format("delete resource: %s failed.", originFullName));
}
}
return result;
}
String destHdfsFileName = HadoopUtils.getHdfsFileName(resource.getType(),tenantCode,fullName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | try {
logger.info("start hdfs copy {} -> {}", originHdfsFileName, destHdfsFileName);
HadoopUtils.getInstance().copy(originHdfsFileName, destHdfsFileName, true, true);
} catch (Exception e) {
logger.error(MessageFormat.format("hdfs copy {0} -> {1} fail", originHdfsFileName, destHdfsFileName), e);
putMsg(result,Status.HDFS_COPY_FAIL);
throw new ServiceException(Status.HDFS_COPY_FAIL);
}
return result;
}
private Result<Object> verifyFile(String name, ResourceType type, MultipartFile file) {
Result<Object> result = new Result<>();
putMsg(result, Status.SUCCESS);
if (file != null) {
if (file.isEmpty()) {
logger.error("file is empty: {}", RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_FILE_IS_EMPTY);
return result;
}
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(name);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
logger.error("rename file suffix and original suffix must be consistent: {}", RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_SUFFIX_FORBID_CHANGE);
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (Constants.UDF.equals(type.name()) && !JAR.equalsIgnoreCase(fileSuffix)) {
logger.error(Status.UDF_RESOURCE_SUFFIX_NOT_JAR.getMsg());
putMsg(result, Status.UDF_RESOURCE_SUFFIX_NOT_JAR);
return result;
}
if (file.getSize() > Constants.MAX_FILE_SIZE) {
logger.error("file size is too large: {}", RegexUtils.escapeNRT(file.getOriginalFilename()));
putMsg(result, Status.RESOURCE_SIZE_EXCEED_LIMIT);
return result;
}
}
return result;
}
/**
* query resources list paging
*
* @param loginUser login user
* @param type resource type
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return resource list page
*/
@Override
public Result queryResourceListPaging(User loginUser, int directoryId, ResourceType type, String searchVal, Integer pageNo, Integer pageSize) {
Result result = new Result();
Page<Resource> page = new Page<>(pageNo, pageSize);
int userId = loginUser.getId();
if (isAdmin(loginUser)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | userId = 0;
}
if (directoryId != -1) {
Resource directory = resourcesMapper.selectById(directoryId);
if (directory == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
}
List<Integer> resourcesIds = resourceUserMapper.queryResourcesIdListByUserIdAndPerm(userId, 0);
IPage<Resource> resourceIPage = resourcesMapper.queryResourcePaging(page, userId, directoryId, type.ordinal(), searchVal,resourcesIds);
PageInfo<Resource> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int)resourceIPage.getTotal());
pageInfo.setTotalList(resourceIPage.getRecords());
result.setData(pageInfo);
putMsg(result,Status.SUCCESS);
return result;
}
/**
* create directory
* @param loginUser login user
* @param fullName full name
* @param type resource type
* @param result Result
*/
private void createDirectory(User loginUser,String fullName,ResourceType type,Result<Object> result) {
String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String directoryName = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
String resourceRootPath = HadoopUtils.getHdfsDir(type,tenantCode);
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | if (!HadoopUtils.getInstance().exists(resourceRootPath)) {
createTenantDirIfNotExists(tenantCode);
}
if (!HadoopUtils.getInstance().mkdir(directoryName)) {
logger.error("create resource directory {} of hdfs failed",directoryName);
putMsg(result,Status.HDFS_OPERATION_ERROR);
throw new ServiceException(String.format("create resource directory: %s failed.", directoryName));
}
} catch (Exception e) {
logger.error("create resource directory {} of hdfs failed",directoryName);
putMsg(result,Status.HDFS_OPERATION_ERROR);
throw new ServiceException(String.format("create resource directory: %s failed.", directoryName));
}
}
/**
* upload file to hdfs
*
* @param loginUser login user
* @param fullName full name
* @param file file
*/
private boolean upload(User loginUser, String fullName, MultipartFile file, ResourceType type) {
String fileSuffix = Files.getFileExtension(file.getOriginalFilename());
String nameSuffix = Files.getFileExtension(fullName);
if (!(StringUtils.isNotEmpty(fileSuffix) && fileSuffix.equalsIgnoreCase(nameSuffix))) {
return false;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | String tenantCode = tenantMapper.queryById(loginUser.getTenantId()).getTenantCode();
String localFilename = FileUtils.getUploadFilename(tenantCode, UUID.randomUUID().toString());
String hdfsFilename = HadoopUtils.getHdfsFileName(type,tenantCode,fullName);
String resourcePath = HadoopUtils.getHdfsDir(type,tenantCode);
try {
if (!HadoopUtils.getInstance().exists(resourcePath)) {
createTenantDirIfNotExists(tenantCode);
}
org.apache.dolphinscheduler.api.utils.FileUtils.copyInputStreamToFile(file, localFilename);
HadoopUtils.getInstance().copyLocalToHdfs(localFilename, hdfsFilename, true, true);
} catch (Exception e) {
FileUtils.deleteFile(localFilename);
logger.error(e.getMessage(), e);
return false;
}
return true;
}
/**
* query resource list
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@Override
public Map<String, Object> queryResourceList(User loginUser, ResourceType type) {
Map<String, Object> result = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type);
Visitor resourceTreeVisitor = new ResourceTreeVisitor(allResourceList);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query resource list by program type
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@Override
public Map<String, Object> queryResourceByProgramType(User loginUser, ResourceType type, ProgramType programType) {
Map<String, Object> result = new HashMap<>();
List<Resource> allResourceList = queryAuthoredResourceList(loginUser, type);
String suffix = ".jar";
if (programType != null) {
switch (programType) {
case JAVA:
case SCALA:
break;
case PYTHON:
suffix = ".py";
break;
default:
}
}
List<Resource> resources = new ResourceFilter(suffix, new ArrayList<>(allResourceList)).filter(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,544 | [Bug] [Resource Center-UDF Management/Resource Management] Folder size statistics error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
<img width="1223" alt="image" src="https://user-images.githubusercontent.com/76080484/155693270-c322ed34-8867-4ba4-849c-f5bc99249fb4.png">
<img width="1243" alt="image" src="https://user-images.githubusercontent.com/76080484/155693495-91b99fbb-1f12-495e-9643-05990651fcec.png">
### What you expected to happen
The parent folder size is the child file / folder size count
### How to reproduce
1. Create folder
2. Open folder
3. Upload jar package
4. Return to outer folder
### Anything else
_No response_
### Version
2.0.4
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8544 | https://github.com/apache/dolphinscheduler/pull/9107 | 08ea1aa701910d90ed16164e9019557292cc4249 | 7c5bebea98b64394a74960a5fa0e7a40af26c465 | 2022-02-25T09:55:26Z | java | 2022-03-23T10:58:41Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java | Visitor resourceTreeVisitor = new ResourceTreeVisitor(resources);
result.put(Constants.DATA_LIST, resourceTreeVisitor.visit().getChildren());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete resource
*
* @param loginUser login user
* @param resourceId resource id
* @return delete result code
* @throws IOException exception
*/
@Override
@Transactional(rollbackFor = Exception.class)
public Result<Object> delete(User loginUser, int resourceId) throws IOException {
Result<Object> result = checkResourceUploadStartupState();
if (!result.getCode().equals(Status.SUCCESS.getCode())) {
return result;
}
Resource resource = resourcesMapper.selectById(resourceId);
if (resource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, resource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.