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 | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public List<TaskInstance> queryNeedFailoverTaskInstances(String host) {
return taskInstanceMapper.queryByHostAndStatus(host,
ExecutionStatus.getNeedFailoverWorkflowInstanceState());
}
/**
* find data source by id
*
* @param id id
* @return datasource
*/
@Override
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
*/
@Override
public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) {
ProcessInstance instance = processInstanceMapper.selectById(processInstanceId);
instance.setState(executionStatus);
return processInstanceMapper.updateById(instance);
}
/**
* find process instance by the task id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | *
* @param taskId taskId
* @return process instance
*/
@Override
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
*/
@Override
public List<UdfFunc> queryUdfFunListByIds(Integer[] ids) {
return udfFuncMapper.queryUdfByIdStr(ids, null);
}
/**
* find tenant code by resource name
*
* @param resName resource name
* @param resourceType resource type
* @return tenant code
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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 "";
}
int userId = resourceList.get(0).getUserId();
User user = userMapper.selectById(userId);
if (Objects.isNull(user)) {
return "";
}
Tenant tenant = tenantMapper.queryById(user.getTenantId());
if (Objects.isNull(tenant)) {
return "";
}
return tenant.getTenantCode();
}
/**
* find schedule list by process define codes.
*
* @param codes codes
* @return schedule list
*/
@Override
public List<Schedule> selectAllByProcessDefineCode(long[] codes) {
return scheduleMapper.selectAllByProcessDefineArray(codes);
}
/**
* find last scheduler process instance in the date interval |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | *
* @param definitionCode definitionCode
* @param dateInterval dateInterval
* @return process instance
*/
@Override
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
*/
@Override
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 | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @return process instance
*/
@Override
public ProcessInstance findLastRunningProcess(Long definitionCode, Date startTime, Date endTime) {
return processInstanceMapper.queryLastRunningProcess(definitionCode,
startTime,
endTime,
ExecutionStatus.getNeedFailoverWorkflowInstanceState());
}
/**
* query user queue by process instance
*
* @param processInstance processInstance
* @return queue
*/
@Override
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.
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @param processInstanceId processInstanceId
* @return projectName and userName
*/
@Override
public ProjectUser queryProjectWithUserByProcessInstanceId(int processInstanceId) {
return projectMapper.queryProjectWithUserByProcessInstanceId(processInstanceId);
}
/**
* get task worker group
*
* @param taskInstance taskInstance
* @return workerGroupId
*/
@Override
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup();
if (!Strings.isNullOrEmpty(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
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @param userId userId
* @return project list
*/
@Override
public List<Project> getProjectListHavePerm(int userId) {
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
*/
@Override
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: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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:
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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @return User
*/
@Override
public User getUserById(int userId) {
return userMapper.selectById(userId);
}
/**
* get resource by resource id
*
* @param resourceId resource id
* @return Resource
*/
@Override
public Resource getResourceById(int resourceId) {
return resourceMapper.selectById(resourceId);
}
/**
* list resources by ids
*
* @param resIds resIds
* @return resource list
*/
@Override
public List<Resource> listResourceByIds(Integer[] resIds) {
return resourceMapper.listResourceByIds(resIds);
}
/**
* format task app id in task instance
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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());
}
/**
* switch process definition version to process definition log version
*/
@Override
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
@Override
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 {
int result = 0;
for (ProcessTaskRelationLog taskRelationLog : processTaskRelationLogList) {
int switchResult = switchTaskDefinitionVersion(taskRelationLog.getPostTaskCode(), taskRelationLog.getPostTaskVersion());
if (switchResult != Constants.EXIT_CODE_FAILURE) {
result++;
}
}
return result;
}
}
@Override
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
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
* @return resource ids
*/
@Override
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(toSet());
}
if (CollectionUtils.isEmpty(resourceIds)) {
return "";
}
return Joiner.on(",").join(resourceIds); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
@Override
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) {
try {
taskDefinitionLog.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
return Constants.DEFINITION_FAILURE;
}
}
if (taskDefinitionLog.getVersion() == 0) {
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
}
TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper
.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion());
if (definitionCodeAndVersion == null) {
taskDefinitionLog.setUserId(operator.getId());
taskDefinitionLog.setCreateTime(now);
newTaskDefinitionLogs.add(taskDefinitionLog); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | continue;
}
if (taskDefinitionLog.equals(definitionCodeAndVersion)) {
continue;
}
taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
taskDefinitionLog.setVersion(version + 1);
taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
updateTaskDefinitionLogs.add(taskDefinitionLog);
}
int insertResult = 0;
int updateResult = 0;
for (TaskDefinitionLog taskDefinitionToUpdate : updateTaskDefinitionLogs) {
TaskDefinition task = taskDefinitionMapper.queryByCode(taskDefinitionToUpdate.getCode());
if (task == null) {
newTaskDefinitionLogs.add(taskDefinitionToUpdate);
} 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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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)
*/
@Override
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());
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);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return (insertLog & result) > 0 ? insertVersion : 0;
}
/**
* save task relations
*/
@Override
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);
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
}
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);
}
int resultLog = processTaskRelationLogMapper.batchInsert(taskRelationList);
return (insert & resultLog) > 0 ? Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE;
}
@Override
public boolean isTaskOnline(long taskCode) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByTaskCode(taskCode);
if (!processTaskRelationList.isEmpty()) {
Set<Long> processDefinitionCodes = processTaskRelationList
.stream() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | .map(ProcessTaskRelation::getProcessDefinitionCode)
.collect(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
*/
@Override
public DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> taskRelations = this.findRelationByCode(processDefinition.getCode(), processDefinition.getVersion());
List<TaskNode> taskNodeList = transformTask(taskRelations, Lists.newArrayList());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList, new ArrayList<>(taskRelations));
return DagHelper.buildDagGraph(processDag);
}
/**
* generate DagData
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
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);
}
@Override
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);
}
@Override
public List<TaskDefinitionLog> getTaskDefineLogListByRelation(List<ProcessTaskRelation> processTaskRelations) {
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
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
*/
@Override
public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersion) {
return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion);
}
/**
* find process task relation list by process
*/
@Override
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
*
* @param ownResources own resources
* @param userId userId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
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
*/
@Override
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));
List<TaskNode> taskNodeList = new ArrayList<>();
for (Entry<Long, List<Long>> code : taskCodeMap.entrySet()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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());
taskNode.setCpuQuota(taskDefinitionLog.getCpuQuota());
taskNode.setMemoryMax(taskDefinitionLog.getMemoryMax()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | taskNodeList.add(taskNode);
}
}
return taskNodeList;
}
@Override
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;
}
@Override
public DqExecuteResult getDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.getExecuteResultById(taskInstanceId);
}
@Override
public int updateDqExecuteResultUserId(int taskInstanceId) {
DqExecuteResult dqExecuteResult =
dqExecuteResultMapper.selectOne(new QueryWrapper<DqExecuteResult>().eq(TASK_INSTANCE_ID, taskInstanceId));
if (dqExecuteResult == null) {
return -1; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
ProcessInstance processInstance = processInstanceMapper.selectById(dqExecuteResult.getProcessInstanceId());
if (processInstance == null) {
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);
}
@Override
public int updateDqExecuteResultState(DqExecuteResult dqExecuteResult) {
return dqExecuteResultMapper.updateById(dqExecuteResult);
}
@Override
public int deleteDqExecuteResultByTaskInstanceId(int taskInstanceId) {
return dqExecuteResultMapper.delete(
new QueryWrapper<DqExecuteResult>()
.eq(TASK_INSTANCE_ID, taskInstanceId));
}
@Override
public int deleteTaskStatisticsValueByTaskInstanceId(int taskInstanceId) {
return dqTaskStatisticsValueMapper.delete(
new QueryWrapper<DqTaskStatisticsValue>()
.eq(TASK_INSTANCE_ID, taskInstanceId));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public DqRule getDqRule(int ruleId) {
return dqRuleMapper.selectById(ruleId);
}
@Override
public List<DqRuleInputEntry> getRuleInputEntry(int ruleId) {
return DqRuleUtils.transformInputEntry(dqRuleInputEntryMapper.getRuleInputEntryList(ruleId));
}
@Override
public List<DqRuleExecuteSql> getDqExecuteSql(int ruleId) {
return dqRuleExecuteSqlMapper.getExecuteSqlList(ruleId);
}
@Override
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
*/
@Override
public boolean acquireTaskGroup(int taskId,
String taskName, int groupId,
int processId, int priority) {
TaskGroup taskGroup = taskGroupMapper.selectById(groupId);
if (taskGroup == null) {
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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 {
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) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
public boolean robTaskGroupResouce(TaskGroupQueue taskGroupQueue) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskGroupQueue.getGroupId());
int affectedCount = taskGroupMapper.updateTaskGroupResource(taskGroup.getId(), taskGroupQueue.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode());
if (affectedCount > 0) {
taskGroupQueue.setStatus(TaskGroupQueueStatus.ACQUIRE_SUCCESS);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return true;
}
return false;
}
@Override
public boolean acquireTaskGroupAgain(TaskGroupQueue taskGroupQueue) {
return robTaskGroupResouce(taskGroupQueue);
}
@Override
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
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
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;
}
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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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());
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @param taskId task id
* @return the result code and msg
*/
@Override
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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@Override
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;
}
@Override
public int updateTaskGroupQueueStatus(Integer taskId, int status) {
return taskGroupQueueMapper.updateStatusByTaskId(taskId, status);
}
@Override
public int updateTaskGroupQueue(TaskGroupQueue taskGroupQueue) {
return taskGroupQueueMapper.updateById(taskGroupQueue);
}
@Override
public TaskGroupQueue loadTaskGroupQueue(int taskId) {
return this.taskGroupQueueMapper.queryByTaskId(taskId);
}
@Override
public void sendStartTask2Master(ProcessInstance processInstance, int taskId,
org.apache.dolphinscheduler.remote.command.CommandType taskType) {
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand(
processInstance.getId(), taskId
);
Host host = new Host(processInstance.getHost()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,916 | [BUG-BE][Complete Data] Under the serial strategy, the complement function is abnormal. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Under the serial strategy, the complement function is abnormal.
### What you expected to happen
normal execution
### How to reproduce
1. create shell task (sleep 60s)
2. select serial wait strategy
3. run shell task
4. run parallel complement (Choose 3 dates, choose 3 for parallelism)
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10916 | https://github.com/apache/dolphinscheduler/pull/10917 | 2a67866718a74a6abc30fb615c0e16978511e3eb | 2397423eb6893458cd13866dd16b2c2e92dda437 | 2022-07-12T19:10:14Z | java | 2022-07-13T03:23:47Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | stateEventCallbackService.sendResult(host, taskEventChangeCommand.convert2Command(taskType));
}
@Override
public ProcessInstance loadNextProcess4Serial(long code, int state, int id) {
return this.processInstanceMapper.loadNextProcess4Serial(code, state, id);
}
protected void deleteCommandWithCheck(int commandId) {
int delete = this.commandMapper.deleteById(commandId);
if (delete != 1) {
throw new ServiceException("delete command fail, id:" + commandId);
}
}
/**
* find k8s config yaml by clusterName
*
* @param clusterName clusterName
* @return datasource
*/
@Override
public String findConfigYamlByName(String clusterName) {
if (Strings.isNullOrEmpty(clusterName)) {
return null;
}
QueryWrapper<K8s> nodeWrapper = new QueryWrapper<>();
nodeWrapper.eq("k8s_name", clusterName);
K8s k8s = k8sMapper.selectOne(nodeWrapper);
return k8s.getK8sConfig();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | * (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;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.ResourceParametersHelper;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;
/**
* job params related class
*/
public abstract class AbstractParameters implements IParameters { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | @Override
public abstract boolean checkParameters();
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
/**
* local parameters
*/
public List<Property> localParams;
/**
* var pool
*/
public List<Property> varPool;
/**
* get local parameters list
*
* @return Property list
*/
public List<Property> getLocalParams() {
return localParams;
}
public void setLocalParams(List<Property> localParams) {
this.localParams = localParams;
}
/**
* get local parameters map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | * @return parameters map
*/
public Map<String, Property> getLocalParametersMap() {
Map<String, Property> localParametersMaps = new LinkedHashMap<>();
if (localParams != null) {
for (Property property : localParams) {
localParametersMaps.put(property.getProp(),property);
}
}
return localParametersMaps;
}
/**
* get input local parameters map if the param direct is IN
* @return parameters map
*/
public Map<String, Property> getInputLocalParametersMap() {
Map<String, Property> localParametersMaps = new LinkedHashMap<>();
if (localParams != null) {
for (Property property : localParams) {
if (property.getDirect().equals(Direct.IN)) {
localParametersMaps.put(property.getProp(), property);
}
}
}
return localParametersMaps;
}
/**
* get varPool map
*
* @return parameters map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | */
public Map<String, Property> getVarPoolMap() {
Map<String, Property> varPoolMap = new LinkedHashMap<>();
if (varPool != null) {
for (Property property : varPool) {
varPoolMap.put(property.getProp(), property);
}
}
return varPoolMap;
}
public List<Property> getVarPool() {
return varPool;
}
public void setVarPool(String varPool) {
if (org.apache.dolphinscheduler.spi.utils.StringUtils.isEmpty(varPool)) {
this.varPool = new ArrayList<>();
} else {
this.varPool = JSONUtils.toList(varPool, Property.class);
}
}
public void dealOutParam(String result) {
if (CollectionUtils.isEmpty(localParams)) {
return;
}
List<Property> outProperty = getOutProperty(localParams);
if (CollectionUtils.isEmpty(outProperty)) {
return;
}
if (StringUtils.isEmpty(result)) {
varPool.addAll(outProperty); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | return;
}
Map<String, String> taskResult = getMapByString(result);
if (taskResult.size() == 0) {
return;
}
for (Property info : outProperty) {
String propValue = taskResult.get(info.getProp());
if (StringUtils.isNotEmpty(propValue)) {
info.setValue(propValue);
addPropertyToValPool(info);
}
}
}
public List<Property> getOutProperty(List<Property> params) {
if (CollectionUtils.isEmpty(params)) {
return new ArrayList<>();
}
List<Property> result = new ArrayList<>();
for (Property info : params) {
if (info.getDirect() == Direct.OUT) {
result.add(info);
}
}
return result;
}
public List<Map<String, String>> getListMapByString(String json) {
List<Map<String, String>> allParams = new ArrayList<>();
ArrayNode paramsByJson = JSONUtils.parseArray(json);
for (JsonNode jsonNode : paramsByJson) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | Map<String, String> param = JSONUtils.toMap(jsonNode.toString());
allParams.add(param);
}
return allParams;
}
/**
* shell's result format is key=value$VarPool$key=value$VarPool$
* @param result
* @return
*/
public static Map<String, String> getMapByString(String result) {
String[] formatResult = result.split("\\$VarPool\\$");
Map<String, String> format = new HashMap<>();
for (String info : formatResult) {
if (StringUtils.isNotEmpty(info) && info.contains("=")) {
String[] keyValue = info.split("=");
format.put(keyValue[0], keyValue[1]);
}
}
return format;
}
public ResourceParametersHelper getResources() {
return new ResourceParametersHelper();
}
private void addPropertyToValPool(Property property) {
varPool.removeIf(p -> p.getProp().equals(property.getProp()));
varPool.add(property);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.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 | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.task.spark;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RWXR_XR_X;
import org.apache.dolphinscheduler.plugin.task.api.AbstractYarnTask;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.model.Property;
import org.apache.dolphinscheduler.plugin.task.api.model.ResourceInfo;
import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils;
import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.ArgsUtils;
import org.apache.dolphinscheduler.plugin.task.api.utils.MapUtils;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.lang3.SystemUtils;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardOpenOption;
import java.nio.file.attribute.FileAttribute;
import java.nio.file.attribute.PosixFilePermission;
import java.nio.file.attribute.PosixFilePermissions;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class SparkTask extends AbstractYarnTask { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | /**
* spark parameters
*/
private SparkParameters sparkParameters;
/**
* taskExecutionContext
*/
private TaskExecutionContext taskExecutionContext;
public SparkTask(TaskExecutionContext taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
}
@Override
public void init() {
logger.info("spark task params {}", taskExecutionContext.getTaskParams());
sparkParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SparkParameters.class);
if (null == sparkParameters) {
logger.error("Spark params is null");
return;
}
if (!sparkParameters.checkParameters()) {
throw new RuntimeException("spark task params is not valid");
}
sparkParameters.setQueue(taskExecutionContext.getQueue());
if (sparkParameters.getProgramType() != ProgramType.SQL) {
setMainJarName();
}
}
/**
* create command |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | *
* @return command
*/
@Override
protected String buildCommand() {
/**
* (1) spark-submit [options] <app jar | python file> [app arguments]
* (2) spark-sql [options] -f <filename>
*/
List<String> args = new ArrayList<>();
String sparkCommand = SparkVersion.SPARK2.getCommand();
if (SparkVersion.SPARK1.name().equals(sparkParameters.getSparkVersion())) {
sparkCommand = SparkVersion.SPARK1.getCommand();
}
if (sparkParameters.getProgramType() == ProgramType.SQL) {
sparkCommand = SparkVersion.SPARKSQL.getCommand();
}
args.add(sparkCommand);
args.addAll(populateSparkOptions());
Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap();
String command = ParameterUtils.convertParameterPlaceholders(String.join(" ", args), ParamUtils.convert(paramsMap));
logger.info("spark task command: {}", command);
return command;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | * build spark options
*
* @return argument list
*/
private List<String> populateSparkOptions() {
List<String> args = new ArrayList<>();
args.add(SparkConstants.MASTER);
String deployMode = StringUtils.isNotEmpty(sparkParameters.getDeployMode()) ? sparkParameters.getDeployMode() : SparkConstants.DEPLOY_MODE_LOCAL;
if (!SparkConstants.DEPLOY_MODE_LOCAL.equals(deployMode)) {
args.add(SparkConstants.SPARK_ON_YARN);
args.add(SparkConstants.DEPLOY_MODE);
}
args.add(deployMode);
ProgramType programType = sparkParameters.getProgramType();
String mainClass = sparkParameters.getMainClass();
if (programType != ProgramType.PYTHON && programType != ProgramType.SQL && StringUtils.isNotEmpty(mainClass)) {
args.add(SparkConstants.MAIN_CLASS);
args.add(mainClass);
}
populateSparkResourceDefinitions(args);
String appName = sparkParameters.getAppName();
if (StringUtils.isNotEmpty(appName)) {
args.add(SparkConstants.SPARK_NAME);
args.add(ArgsUtils.escape(appName));
}
String others = sparkParameters.getOthers();
if (!SparkConstants.DEPLOY_MODE_LOCAL.equals(deployMode) && (StringUtils.isEmpty(others) || !others.contains(SparkConstants.SPARK_QUEUE))) {
String queue = sparkParameters.getQueue();
if (StringUtils.isNotEmpty(queue)) {
args.add(SparkConstants.SPARK_QUEUE); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | args.add(queue);
}
}
if (StringUtils.isNotEmpty(others)) {
args.add(others);
}
ResourceInfo mainJar = sparkParameters.getMainJar();
if (programType != ProgramType.SQL) {
args.add(mainJar.getRes());
}
String mainArgs = sparkParameters.getMainArgs();
if (programType != ProgramType.SQL && StringUtils.isNotEmpty(mainArgs)) {
args.add(mainArgs);
}
if (ProgramType.SQL == programType) {
args.add(SparkConstants.SQL_FROM_FILE);
args.add(generateScriptFile());
}
return args;
}
private void populateSparkResourceDefinitions(List<String> args) {
int driverCores = sparkParameters.getDriverCores();
if (driverCores > 0) {
args.add(SparkConstants.DRIVER_CORES);
args.add(String.format("%d", driverCores));
}
String driverMemory = sparkParameters.getDriverMemory();
if (StringUtils.isNotEmpty(driverMemory)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | args.add(SparkConstants.DRIVER_MEMORY);
args.add(driverMemory);
}
int numExecutors = sparkParameters.getNumExecutors();
if (numExecutors > 0) {
args.add(SparkConstants.NUM_EXECUTORS);
args.add(String.format("%d", numExecutors));
}
int executorCores = sparkParameters.getExecutorCores();
if (executorCores > 0) {
args.add(SparkConstants.EXECUTOR_CORES);
args.add(String.format("%d", executorCores));
}
String executorMemory = sparkParameters.getExecutorMemory();
if (StringUtils.isNotEmpty(executorMemory)) {
args.add(SparkConstants.EXECUTOR_MEMORY);
args.add(executorMemory);
}
}
private String generateScriptFile() {
String scriptFileName = String.format("%s/%s_node.sql", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId());
File file = new File(scriptFileName);
Path path = file.toPath();
if (!Files.exists(path)) {
String script = sparkParameters.getRawScript().replaceAll("\\r\\n", "\n");
sparkParameters.setRawScript(script);
logger.info("raw script : {}", sparkParameters.getRawScript());
logger.info("task execute path : {}", taskExecutionContext.getExecutePath());
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(RWXR_XR_X);
FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,820 | [Bug] [plugin] spark sql causes npe when parameters are used, and parameters never work. | ### Search before 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="568" alt="image" src="https://user-images.githubusercontent.com/37766284/177677218-e22b022e-8938-432d-83ca-ca0e1c4e24b3.png">

CustomParams is missing type and direct.
when you use param,the master will npe because property.getDirect() is null.

But even if you fix the above problem, custom parameters still won't work because parameters are not replaced.
### What you expected to happen
spark sql can use custom params.
### How to reproduce
create a spark task, choose sql and add custom param.
### Anything else
none.
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10820 | https://github.com/apache/dolphinscheduler/pull/10821 | 2397423eb6893458cd13866dd16b2c2e92dda437 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 2022-07-07T02:25:03Z | java | 2022-07-13T03:44:13Z | dolphinscheduler-task-plugin/dolphinscheduler-task-spark/src/main/java/org/apache/dolphinscheduler/plugin/task/spark/SparkTask.java | try {
if (SystemUtils.IS_OS_WINDOWS) {
Files.createFile(path);
} else {
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
Files.createFile(path, attr);
}
Files.write(path, sparkParameters.getRawScript().getBytes(), StandardOpenOption.APPEND);
} catch (IOException e) {
throw new RuntimeException("generate spark sql script error", e);
}
}
return scriptFileName;
}
@Override
protected void setMainJarName() {
ResourceInfo mainJar = sparkParameters.getMainJar();
String resourceName = getResourceNameOfMainJar(mainJar);
mainJar.setRes(resourceName);
sparkParameters.setMainJar(mainJar);
}
@Override
public AbstractParameters getParameters() {
return sparkParameters;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertConfig.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.alert;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertConfig.java | @ConfigurationProperties("alert")
public final class AlertConfig {
private int port;
public int getPort() {
return port;
}
public void setPort(final int port) {
this.port = port;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.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 | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | * limitations under the License.
*/
package org.apache.dolphinscheduler.alert;
import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.AlertData;
import org.apache.dolphinscheduler.alert.api.AlertInfo;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AlertStatus;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.entity.Alert;
import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand;
import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseResult;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@Service
public final class AlertSenderService extends Thread {
private static final Logger logger = LoggerFactory.getLogger(AlertSenderService.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | private final AlertDao alertDao;
private final AlertPluginManager alertPluginManager;
public AlertSenderService(AlertDao alertDao, AlertPluginManager alertPluginManager) {
this.alertDao = alertDao;
this.alertPluginManager = alertPluginManager;
}
@Override
public synchronized void start() {
super.setName("AlertSenderService");
super.start();
}
@Override
public void run() {
logger.info("alert sender started");
while (Stopper.isRunning()) {
try {
List<Alert> alerts = alertDao.listPendingAlerts();
this.send(alerts);
ThreadUtils.sleep(Constants.SLEEP_TIME_MILLIS * 5L);
} catch (Exception e) {
logger.error("alert sender thread error", e);
}
}
}
public void send(List<Alert> alerts) {
for (Alert alert : alerts) {
int alertId = Optional.ofNullable(alert.getId()).orElse(0);
int alertGroupId = Optional.ofNullable(alert.getAlertGroupId()).orElse(0);
List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | if (CollectionUtils.isEmpty(alertInstanceList)) {
logger.error("send alert msg fail,no bind plugin instance.");
alertDao.updateAlert(AlertStatus.EXECUTION_FAILURE, "no bind plugin instance", alertId);
continue;
}
AlertData alertData = new AlertData();
alertData.setId(alertId)
.setContent(alert.getContent())
.setLog(alert.getLog())
.setTitle(alert.getTitle())
.setTitle(alert.getTitle())
.setWarnType(alert.getWarningType().getCode());
int sendSuccessCount = 0;
for (AlertPluginInstance instance : alertInstanceList) {
AlertResult alertResult = this.alertResultHandler(instance, alertData);
if (alertResult != null) {
AlertStatus sendStatus = Boolean.parseBoolean(String.valueOf(alertResult.getStatus())) ? AlertStatus.EXECUTION_SUCCESS : AlertStatus.EXECUTION_FAILURE;
alertDao.addAlertSendStatus(sendStatus,alertResult.getMessage(),alertId,instance.getId());
if (sendStatus.equals(AlertStatus.EXECUTION_SUCCESS)) {
sendSuccessCount++;
}
}
}
AlertStatus alertStatus = AlertStatus.EXECUTION_SUCCESS;
if (sendSuccessCount == 0) {
alertStatus = AlertStatus.EXECUTION_FAILURE;
} else if (sendSuccessCount < alertInstanceList.size()) {
alertStatus = AlertStatus.EXECUTION_PARTIAL_SUCCESS;
}
alertDao.updateAlert(alertStatus, "", alertId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | }
}
/**
* sync send alert handler
*
* @param alertGroupId alertGroupId
* @param title title
* @param content content
* @return AlertSendResponseCommand
*/
public AlertSendResponseCommand syncHandler(int alertGroupId, String title, String content, int warnType) {
List<AlertPluginInstance> alertInstanceList = alertDao.listInstanceByAlertGroupId(alertGroupId);
AlertData alertData = new AlertData();
alertData.setContent(content)
.setTitle(title)
.setWarnType(warnType);
boolean sendResponseStatus = true;
List<AlertSendResponseResult> sendResponseResults = new ArrayList<>();
if (CollectionUtils.isEmpty(alertInstanceList)) {
AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult();
String message = String.format("Alert GroupId %s send error : not found alert instance", alertGroupId);
alertSendResponseResult.setStatus(false);
alertSendResponseResult.setMessage(message);
sendResponseResults.add(alertSendResponseResult);
logger.error("Alert GroupId {} send error : not found alert instance", alertGroupId);
return new AlertSendResponseCommand(false, sendResponseResults);
}
for (AlertPluginInstance instance : alertInstanceList) {
AlertResult alertResult = this.alertResultHandler(instance, alertData);
if (alertResult != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | AlertSendResponseResult alertSendResponseResult = new AlertSendResponseResult(
Boolean.parseBoolean(String.valueOf(alertResult.getStatus())), alertResult.getMessage());
sendResponseStatus = sendResponseStatus && alertSendResponseResult.getStatus();
sendResponseResults.add(alertSendResponseResult);
}
}
return new AlertSendResponseCommand(sendResponseStatus, sendResponseResults);
}
/**
* alert result handler
*
* @param instance instance
* @param alertData alertData
* @return AlertResult
*/
private AlertResult alertResultHandler(AlertPluginInstance instance, AlertData alertData) {
Optional<AlertChannel> alertChannel = alertPluginManager.getAlertChannel(instance.getPluginDefineId());
AlertResult alertResultExtend = new AlertResult();
String pluginInstanceName = instance.getInstanceName();
if (!alertChannel.isPresent()) {
String message = String.format("Alert Plugin %s send error : return value is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.error("Alert Plugin {} send error : not found plugin {}", pluginInstanceName, instance.getPluginDefineId());
return alertResultExtend;
}
Map<String, String> paramsMap = JSONUtils.toMap(instance.getPluginInstanceParams());
String instanceWarnType = WarningType.ALL.getDescp();
if (paramsMap != null) {
instanceWarnType = paramsMap.getOrDefault(AlertConstants.NAME_WARNING_TYPE, WarningType.ALL.getDescp()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | }
WarningType warningType = WarningType.of(instanceWarnType);
if (warningType == null) {
String message = String.format("Alert Plugin %s send error : plugin warnType is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.error("Alert Plugin {} send error : plugin warnType is null", pluginInstanceName);
return alertResultExtend;
}
boolean sendWarning = false;
switch (warningType) {
case ALL:
sendWarning = true;
break;
case SUCCESS:
if (alertData.getWarnType() == WarningType.SUCCESS.getCode()) {
sendWarning = true;
}
break;
case FAILURE:
if (alertData.getWarnType() == WarningType.FAILURE.getCode()) {
sendWarning = true;
}
break;
default:
}
if (!sendWarning) {
logger.info("Alert Plugin {} send ignore warning type not match: plugin warning type is {}, alert data warning type is {}",
pluginInstanceName, warningType.getCode(), alertData.getWarnType());
return null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/java/org/apache/dolphinscheduler/alert/AlertSenderService.java | }
AlertInfo alertInfo = new AlertInfo();
alertInfo.setAlertData(alertData);
alertInfo.setAlertParams(paramsMap);
AlertResult alertResult;
try {
alertResult = alertChannel.get().process(alertInfo);
} catch (Exception e) {
alertResult = new AlertResult("false", e.getMessage());
logger.error("send alert error alert data id :{},", alertData.getId(), e);
}
if (alertResult == null) {
String message = String.format("Alert Plugin %s send error : return alertResult value is null", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(message);
logger.info("Alert Plugin {} send error : return alertResult value is null", pluginInstanceName);
} else if (!Boolean.parseBoolean(String.valueOf(alertResult.getStatus()))) {
alertResultExtend.setStatus(String.valueOf(false));
alertResultExtend.setMessage(alertResult.getMessage());
logger.info("Alert Plugin {} send error : {}", pluginInstanceName, alertResult.getMessage());
} else {
String message = String.format("Alert Plugin %s send success", pluginInstanceName);
alertResultExtend.setStatus(String.valueOf(true));
alertResultExtend.setMessage(message);
logger.info("Alert Plugin {} send success", pluginInstanceName);
}
return alertResultExtend;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderServiceTest.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.alert.runner;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.alert.AlertPluginManager;
import org.apache.dolphinscheduler.alert.AlertSenderService;
import org.apache.dolphinscheduler.alert.api.AlertChannel;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.dao.AlertDao;
import org.apache.dolphinscheduler.dao.PluginDao;
import org.apache.dolphinscheduler.dao.entity.Alert; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderServiceTest.java | import org.apache.dolphinscheduler.dao.entity.AlertPluginInstance;
import org.apache.dolphinscheduler.dao.entity.PluginDefine;
import org.apache.dolphinscheduler.remote.command.alert.AlertSendResponseCommand;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AlertSenderServiceTest {
private static final Logger logger = LoggerFactory.getLogger(AlertSenderServiceTest.class);
@Mock
private AlertDao alertDao;
@Mock
private PluginDao pluginDao;
@Mock
private AlertPluginManager alertPluginManager;
@InjectMocks
private AlertSenderService alertSenderService;
@Before
public void before() {
MockitoAnnotations.initMocks(this);
}
@Test |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderServiceTest.java | public void testSyncHandler() {
int alertGroupId = 1;
String title = "alert mail test title";
String content = "alert mail test content";
when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(null);
AlertSendResponseCommand alertSendResponseCommand = alertSenderService.syncHandler(alertGroupId, title, content, WarningType.ALL.getCode());
Assert.assertFalse(alertSendResponseCommand.getResStatus());
alertSendResponseCommand.getResResults().forEach(result ->
logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage()));
int pluginDefineId = 1;
String pluginInstanceParams = "alert-instance-mail-params";
String pluginInstanceName = "alert-instance-mail";
List<AlertPluginInstance> alertInstanceList = new ArrayList<>();
AlertPluginInstance alertPluginInstance = new AlertPluginInstance(
pluginDefineId, pluginInstanceParams, pluginInstanceName);
alertInstanceList.add(alertPluginInstance);
when(alertDao.listInstanceByAlertGroupId(1)).thenReturn(alertInstanceList);
String pluginName = "alert-plugin-mail";
PluginDefine pluginDefine = new PluginDefine(pluginName, "1", null);
when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine);
alertSendResponseCommand = alertSenderService.syncHandler(alertGroupId, title, content, WarningType.ALL.getCode());
Assert.assertFalse(alertSendResponseCommand.getResStatus());
alertSendResponseCommand.getResResults().forEach(result ->
logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage()));
AlertChannel alertChannelMock = mock(AlertChannel.class);
when(alertChannelMock.process(Mockito.any())).thenReturn(null);
when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderServiceTest.java | alertSendResponseCommand = alertSenderService.syncHandler(alertGroupId, title, content, WarningType.ALL.getCode());
Assert.assertFalse(alertSendResponseCommand.getResStatus());
alertSendResponseCommand.getResResults().forEach(result ->
logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage()));
AlertResult alertResult = new AlertResult();
alertResult.setStatus(String.valueOf(false));
alertResult.setMessage("Abnormal information inside the alert plug-in code");
when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult);
when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock));
alertSendResponseCommand = alertSenderService.syncHandler(alertGroupId, title, content, WarningType.ALL.getCode());
Assert.assertFalse(alertSendResponseCommand.getResStatus());
alertSendResponseCommand.getResResults().forEach(result ->
logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage()));
alertResult = new AlertResult();
alertResult.setStatus(String.valueOf(true));
alertResult.setMessage(String.format("Alert Plugin %s send success", pluginInstanceName));
when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult);
when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock));
alertSendResponseCommand = alertSenderService.syncHandler(alertGroupId, title, content, WarningType.ALL.getCode());
Assert.assertTrue(alertSendResponseCommand.getResStatus());
alertSendResponseCommand.getResResults().forEach(result ->
logger.info("alert send response result, status:{}, message:{}", result.getStatus(), result.getMessage()));
}
@Test
public void testRun() {
int alertGroupId = 1;
String title = "alert mail test title";
String content = "alert mail test content"; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,784 | [Bug] [ALERT-SERVER] FEISHU Plugin might block the whole alert process loop | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
FEISHU Plugin has no timeout, if the feishu alert block , it will block the whole alert process and lock the loop
### What you expected to happen
Feishu alert should have timeout trategy if the server cannot alert the feishu robot.
### How to reproduce
Make the server no communicate with the Feishu robot, and select Feishu alert instance to alert. The feishu alert process will block.
### 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/10784 | https://github.com/apache/dolphinscheduler/pull/10888 | 427c58546c93869e0bee7fb853319083c35c8bc4 | 7a15877fa412078a6d46b36ff07388ea491e95bb | 2022-07-05T03:45:51Z | java | 2022-07-13T06:27:44Z | dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/runner/AlertSenderServiceTest.java | List<Alert> alertList = new ArrayList<>();
Alert alert = new Alert();
alert.setAlertGroupId(alertGroupId);
alert.setTitle(title);
alert.setContent(content);
alert.setWarningType(WarningType.FAILURE);
alertList.add(alert);
int pluginDefineId = 1;
String pluginInstanceParams = "alert-instance-mail-params";
String pluginInstanceName = "alert-instance-mail";
List<AlertPluginInstance> alertInstanceList = new ArrayList<>();
AlertPluginInstance alertPluginInstance = new AlertPluginInstance(
pluginDefineId, pluginInstanceParams, pluginInstanceName);
alertInstanceList.add(alertPluginInstance);
when(alertDao.listInstanceByAlertGroupId(alertGroupId)).thenReturn(alertInstanceList);
String pluginName = "alert-plugin-mail";
PluginDefine pluginDefine = new PluginDefine(pluginName, "1", null);
when(pluginDao.getPluginDefineById(pluginDefineId)).thenReturn(pluginDefine);
AlertResult alertResult = new AlertResult();
alertResult.setStatus(String.valueOf(true));
alertResult.setMessage(String.format("Alert Plugin %s send success", pluginInstanceName));
AlertChannel alertChannelMock = mock(AlertChannel.class);
when(alertChannelMock.process(Mockito.any())).thenReturn(alertResult);
when(alertPluginManager.getAlertChannel(1)).thenReturn(Optional.of(alertChannelMock));
Assert.assertTrue(Boolean.parseBoolean(alertResult.getStatus()));
when(alertDao.listInstanceByAlertGroupId(1)).thenReturn(new ArrayList<>());
alertSenderService.send(alertList);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | package org.apache.dolphinscheduler.api.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.AccessTokenService;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.EncryptionUtils;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper;
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 static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*;
/**
* access token service impl
*/
@Service
public class AccessTokenServiceImpl extends BaseServiceImpl implements AccessTokenService { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceImpl.class);
@Autowired
private AccessTokenMapper accessTokenMapper;
/**
* query access token list
*
* @param loginUser login user
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return token list for page number and page size
*/
@Override
public Result queryAccessTokenList(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Result result = new Result();
PageInfo<AccessToken> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<AccessToken> page = new Page<>(pageNo, pageSize);
int userId = loginUser.getId();
if (loginUser.getUserType() == UserType.ADMIN_USER) {
userId = 0;
}
IPage<AccessToken> accessTokenList = accessTokenMapper.selectAccessTokenPage(page, searchVal, userId);
pageInfo.setTotal((int) accessTokenList.getTotal());
pageInfo.setTotalList(accessTokenList.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query access token for specified user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | *
* @param loginUser login user
* @param userId user id
* @return token list for specified user
*/
@Override
public Map<String, Object> queryAccessTokenByUser(User loginUser, Integer userId) {
Map<String, Object> result = new HashMap<>();
result.put(Constants.STATUS, false);
if (loginUser.getUserType().equals(UserType.GENERAL_USER) && loginUser.getId() != userId) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
userId = loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : userId;
List<AccessToken> accessTokenList = this.accessTokenMapper.queryAccessTokenByUser(userId);
result.put(Constants.DATA_LIST, accessTokenList);
this.putMsg(result, Status.SUCCESS);
return result;
}
/**
* create token
*
* @param loginUser
* @param userId token for user
* @param expireTime token expire time
* @param token token string (if it is absent, it will be automatically generated)
* @return create result code
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | @SuppressWarnings("checkstyle:WhitespaceAround")
@Override
public Result createToken(User loginUser, int userId, String expireTime, String token) {
Result result = new Result();
if (!(canOperatorPermissions(loginUser,null, AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_CREATE) || loginUser.getId() == userId)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (userId <= 0) {
String errorMsg = "User id should not less than or equals to 0.";
logger.error(errorMsg);
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, errorMsg);
return result;
}
if (StringUtils.isBlank(token)) {
token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
}
AccessToken accessToken = new AccessToken();
accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token);
accessToken.setCreateTime(new Date());
accessToken.setUpdateTime(new Date());
int insert = accessTokenMapper.insert(accessToken);
if (insert > 0) {
result.setData(accessToken); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | putMsg(result, Status.SUCCESS);
} else {
putMsg(result, Status.CREATE_ACCESS_TOKEN_ERROR);
}
return result;
}
/**
* generate token
*
* @param loginUser
* @param userId token for user
* @param expireTime token expire time
* @return token string
*/
@Override
public Map<String, Object> generateToken(User loginUser, int userId, String expireTime) {
Map<String, Object> result = new HashMap<>();
if (!(canOperatorPermissions(loginUser,null, AuthorizationType.ACCESS_TOKEN, ACCESS_TOKEN_CREATE) || loginUser.getId() == userId)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
String token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
result.put(Constants.DATA_LIST, token);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete access token
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | * @param id token id
* @return delete result code
*/
@Override
public Map<String, Object> delAccessTokenById(User loginUser, int id) {
Map<String, Object> result = new HashMap<>();
AccessToken accessToken = accessTokenMapper.selectById(id);
if (accessToken == null) {
logger.error("access token not exist, access token id {}", id);
putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST);
return result;
}
if (!canOperatorPermissions(loginUser,new Object[]{id},AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_DELETE)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
accessTokenMapper.deleteById(id);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* update token by id
*
* @param id token id
* @param userId token for user
* @param expireTime token expire time
* @param token token string (if it is absent, it will be automatically generated)
* @return updated access token entity
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AccessTokenServiceImpl.java | public Map<String, Object> updateToken(User loginUser, int id, int userId, String expireTime, String token) {
Map<String, Object> result = new HashMap<>();
if (!canOperatorPermissions(loginUser,new Object[]{id},AuthorizationType.ACCESS_TOKEN,ACCESS_TOKEN_UPDATE)) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
AccessToken accessToken = accessTokenMapper.selectById(id);
if (accessToken == null) {
logger.error("access token not exist, access token id {}", id);
putMsg(result, Status.ACCESS_TOKEN_NOT_EXIST);
return result;
}
if (StringUtils.isBlank(token)) {
token = EncryptionUtils.getMd5(userId + expireTime + System.currentTimeMillis());
}
accessToken.setUserId(userId);
accessToken.setExpireTime(DateUtils.stringToDate(expireTime));
accessToken.setToken(token);
accessToken.setUpdateTime(new Date());
accessTokenMapper.updateById(accessToken);
result.put(Constants.DATA_LIST, accessToken);
putMsg(result, Status.SUCCESS);
return result;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.*;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.impl.AccessTokenServiceImpl;
import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl;
import org.apache.dolphinscheduler.api.utils.PageInfo; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.AuthorizationType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.AccessTokenMapper;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService;
import org.assertj.core.util.Lists;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* access token service test
*/
@RunWith(MockitoJUnitRunner.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | public class AccessTokenServiceTest {
private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(AccessTokenServiceTest.class);
@InjectMocks
private AccessTokenServiceImpl accessTokenService;
@Mock
private AccessTokenMapper accessTokenMapper;
@Mock
private ResourcePermissionCheckService resourcePermissionCheckService;
@Test
@SuppressWarnings("unchecked")
public void testQueryAccessTokenList() {
IPage<AccessToken> tokenPage = new Page<>();
tokenPage.setRecords(getList());
tokenPage.setTotal(1L);
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
when(accessTokenMapper.selectAccessTokenPage(any(Page.class), eq("zhangsan"), eq(0))).thenReturn(tokenPage);
Result result = accessTokenService.queryAccessTokenList(user, "zhangsan", 1, 10);
PageInfo<AccessToken> pageInfo = (PageInfo<AccessToken>) result.getData();
logger.info(result.toString());
Assert.assertTrue(pageInfo.getTotal() > 0);
}
@Test
public void testQueryAccessTokenByUser() {
List<AccessToken> accessTokenList = Lists.newArrayList(this.getEntity()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | Mockito.when(this.accessTokenMapper.queryAccessTokenByUser(Mockito.anyInt())).thenReturn(accessTokenList);
User user = this.getLoginUser();
user.setUserType(UserType.GENERAL_USER);
Map<String, Object> result = this.accessTokenService.queryAccessTokenByUser(user, 3);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
user.setUserType(UserType.ADMIN_USER);
result = this.accessTokenService.queryAccessTokenByUser(user, 1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
}
@Test
public void testCreateToken() {
when(accessTokenMapper.insert(any(AccessToken.class))).thenReturn(2);
Result result = accessTokenService.createToken(getLoginUser(), 1, getDate(), "AccessTokenServiceTest");
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
result = this.accessTokenService.createToken(getLoginUser(), 1, getDate(), null);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue());
}
@Test
public void testGenerateToken() {
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.ACCESS_TOKEN, 1, ACCESS_TOKEN_CREATE, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, null, 0, baseServiceLogger)).thenReturn(true);
Map<String, Object> result = accessTokenService.generateToken(getLoginUser(), Integer.MAX_VALUE,getDate());
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
String token = (String) result.get(Constants.DATA_LIST);
Assert.assertNotNull(token);
}
@Test
public void testDelAccessTokenById() {
when(accessTokenMapper.selectById(1)).thenReturn(getEntity());
User userLogin = new User();
userLogin.setId(1);
userLogin.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.ACCESS_TOKEN, 1, ACCESS_TOKEN_DELETE, baseServiceLogger)).thenReturn(true);
Map<String, Object> result = accessTokenService.delAccessTokenById(userLogin, 0);
logger.info(result.toString());
Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS));
result = accessTokenService.delAccessTokenById(userLogin, 1);
logger.info(result.toString());
Assert.assertEquals(Status.USER_NO_OPERATION_PERM, result.get(Constants.STATUS));
userLogin.setId(1);
userLogin.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{1}, 0, baseServiceLogger)).thenReturn(true);
result = accessTokenService.delAccessTokenById(userLogin, 1);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | }
@Test
public void testUpdateToken() {
User user = new User();
user.setId(1);
user.setUserType(UserType.ADMIN_USER);
Mockito.when(resourcePermissionCheckService.operationPermissionCheck(AuthorizationType.ACCESS_TOKEN, 1, ACCESS_TOKEN_UPDATE, baseServiceLogger)).thenReturn(true);
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{1}, 0, baseServiceLogger)).thenReturn(true);
when(accessTokenMapper.selectById(1)).thenReturn(getEntity());
Map<String, Object> result = accessTokenService.updateToken(getLoginUser(), 1,Integer.MAX_VALUE,getDate(),"token");
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
result = accessTokenService.updateToken(getLoginUser(), 1, Integer.MAX_VALUE,getDate(),null);
logger.info(result.toString());
Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
Assert.assertNotNull(result.get(Constants.DATA_LIST));
Mockito.when(resourcePermissionCheckService.resourcePermissionCheck(AuthorizationType.ACCESS_TOKEN, new Object[]{2}, 0, baseServiceLogger)).thenReturn(true);
result = accessTokenService.updateToken(getLoginUser(), 2,Integer.MAX_VALUE,getDate(),"token");
logger.info(result.toString());
Assert.assertEquals(Status.ACCESS_TOKEN_NOT_EXIST, result.get(Constants.STATUS));
}
private User getLoginUser() {
User loginUser = new User();
loginUser.setId(1);
loginUser.setUserType(UserType.ADMIN_USER);
return loginUser; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/AccessTokenServiceTest.java | }
/**
* create entity
*/
private AccessToken getEntity() {
AccessToken accessToken = new AccessToken();
accessToken.setId(1);
accessToken.setUserId(1);
accessToken.setToken("AccessTokenServiceTest");
Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30);
accessToken.setExpireTime(date);
return accessToken;
}
/**
* entity list
*/
private List<AccessToken> getList() {
List<AccessToken> list = new ArrayList<>();
list.add(getEntity());
return list;
}
/**
* get dateStr
*/
private String getDate() {
Date date = DateUtils.add(new Date(), Calendar.DAY_OF_MONTH, 30);
return DateUtils.dateToString(date);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.mapper;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* accesstoken mapper interface
*/
public interface AccessTokenMapper extends BaseMapper<AccessToken> { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.java | /**
* access token page
*
* @param page page
* @param userName userName |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapper.java | * @param userId userId
* @return access token Ipage
*/
IPage<AccessToken> selectAccessTokenPage(Page page,
@Param("userName") String userName,
@Param("userId") int userId
);
/**
* Query access token for specified user
*
* @param userId userId
* @return access token for specified user
*/
List<AccessToken> queryAccessTokenByUser(@Param("userId") int userId);
/**
* delete by userId
*
* @param userId userId
* @return delete result
*/
int deleteAccessTokenByUserId(@Param("userId") int userId);
/**
* list authorized Projects
* @param userId
* @param accessTokensIds
* @return access token for specified user
*/
List<AccessToken> listAuthorizedAccessToken(@Param("userId") int userId, @Param("accessTokensIds")List<Integer> accessTokensIds);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.dao.mapper;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.greaterThan;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.dao.BaseDaoTest;
import org.apache.dolphinscheduler.dao.entity.AccessToken;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* AccessToken mapper test
*/
public class AccessTokenMapperTest extends BaseDaoTest {
@Autowired
private AccessTokenMapper accessTokenMapper;
@Autowired
private UserMapper userMapper;
/**
* test insert
*/
@Test
public void testInsert() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
assertThat(accessToken.getId(), greaterThan(0));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | /**
* test delete AccessToken By UserId
*/
@Test
public void testDeleteAccessTokenByUserId() {
Integer userId = 1;
int insertCount = 0;
for (int i = 0; i < 10; i++) {
try {
createAccessToken(userId);
insertCount++;
} catch (Exception e) {
e.printStackTrace();
}
}
int deleteCount = accessTokenMapper.deleteAccessTokenByUserId(userId);
Assert.assertEquals(insertCount, deleteCount);
}
/**
* test select by id
*
* @throws Exception
*/
@Test
public void testSelectById() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
assertEquals(accessToken, resultAccessToken);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | /**
* test hashCode method
*
* @throws Exception
*/
@Test
public void testHashCodeMethod() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
boolean flag = accessToken.equals(resultAccessToken);
assertTrue(flag);
}
/**
* test equals method
*
* @throws Exception
*/
@Test
public void testEqualsMethod() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
int result = accessToken.hashCode();
assertNotNull(result);
}
/**
* test page
*/
@Test
public void testSelectAccessTokenPage() throws Exception { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | Integer count = 4;
String userName = "zhangsan";
Integer offset = 2;
Integer size = 2;
Map<Integer, AccessToken> accessTokenMap = createAccessTokens(count, userName);
Page page = new Page(offset, size);
IPage<AccessToken> accessTokenPage = accessTokenMapper.selectAccessTokenPage(page, userName, 0);
assertEquals(Integer.valueOf(accessTokenPage.getRecords().size()), size);
for (AccessToken accessToken : accessTokenPage.getRecords()) {
AccessToken resultAccessToken = accessTokenMap.get(accessToken.getId());
assertEquals(accessToken, resultAccessToken);
}
}
/**
* test update
*/
@Test
public void testUpdate() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
accessToken.setToken("56789");
accessToken.setExpireTime(DateUtils.getCurrentDate());
accessToken.setUpdateTime(DateUtils.getCurrentDate());
int status = accessTokenMapper.updateById(accessToken);
if (status != 1) {
Assert.fail("update access token fail");
}
AccessToken resultAccessToken = accessTokenMapper.selectById(accessToken.getId());
assertEquals(accessToken, resultAccessToken); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | }
/**
* test delete
*/
@Test
public void testDelete() throws Exception {
Integer userId = 1;
AccessToken accessToken = createAccessToken(userId);
int status = accessTokenMapper.deleteById(accessToken.getId());
if (status != 1) {
Assert.fail("delete access token data fail");
}
AccessToken resultAccessToken =
accessTokenMapper.selectById(accessToken.getId());
assertNull(resultAccessToken);
}
/**
* create accessTokens
*
* @param count create accessToken count
* @param userName username
* @return accessToken map
* @throws Exception
*/
private Map<Integer, AccessToken> createAccessTokens(
Integer count, String userName) throws Exception {
User user = createUser(userName);
Map<Integer, AccessToken> accessTokenMap = new HashMap<>();
for (int i = 1; i <= count; i++) {
AccessToken accessToken = createAccessToken(user.getId(), userName); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | accessTokenMap.put(accessToken.getId(), accessToken);
}
return accessTokenMap;
}
/**
* create user
*
* @param userName userName
* @return user
*/
private User createUser(String userName) {
User user = new User();
user.setUserName(userName);
user.setUserPassword("123");
user.setUserType(UserType.GENERAL_USER);
user.setEmail("[email protected]");
user.setPhone("13102557272");
user.setTenantId(1);
user.setCreateTime(DateUtils.getCurrentDate());
user.setUpdateTime(DateUtils.getCurrentDate());
user.setQueue("default");
int status = userMapper.insert(user);
if (status != 1) {
Assert.fail("insert user data error");
}
return user;
}
/**
* create access token
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AccessTokenMapperTest.java | * @param userId userId
* @param userName userName
* @return accessToken
*/
private AccessToken createAccessToken(Integer userId, String userName) {
AccessToken accessToken = new AccessToken();
accessToken.setUserName(userName);
accessToken.setUserId(userId);
accessToken.setToken(String.valueOf(ThreadLocalRandom.current().nextLong()));
accessToken.setCreateTime(DateUtils.getCurrentDate());
accessToken.setUpdateTime(DateUtils.getCurrentDate());
accessToken.setExpireTime(DateUtils.getCurrentDate());
int status = accessTokenMapper.insert(accessToken);
if (status != 1) {
Assert.fail("insert data error");
}
return accessToken;
}
/**
* create access token
*
* @param userId userId
* @return accessToken
* @throws Exception
*/
private AccessToken createAccessToken(Integer userId) throws Exception {
return createAccessToken(userId, null);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | /*
* Lcensed to the Apache Software Foundaton (ASF) under one or more
* contrbutor lcense agreements. See the NOTICE fle dstrbuted wth
* ths work for addtonal nformaton regardng copyrght ownershp.
* The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0
* (the "Lcense"); you may not use ths fle except n complance wth
* the Lcense. You may obtan a copy of the Lcense at
*
* http://www.apache.org/lcenses/LICENSE-2.0
*
* Unless requred by applcable law or agreed to n wrtng, software
* dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled.
* See the Lcense for the specfc language governng permssons and
* lmtatons under the Lcense.
*/
package org.apache.dolphnscheduler.server.master.runner;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES;
mport statc org.apache.dolphnscheduler.common.Constants.COMMA;
mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP;
mport statc org.apache.dolphnscheduler.common.Constants.YYYY_MM_DD_HH_MM_SS;
mport statc org.apache.dolphnscheduler.plugn.task.ap.TaskConstants.TASK_TYPE_BLOCKING;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.DataType.VARCHAR;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.Drect.IN;
mport org.apache.dolphnscheduler.common.Constants;
mport org.apache.dolphnscheduler.common.enums.CommandType;
mport org.apache.dolphnscheduler.common.enums.FalureStrategy;
mport org.apache.dolphnscheduler.common.enums.Flag;
mport org.apache.dolphnscheduler.common.enums.Prorty;
mport org.apache.dolphnscheduler.common.enums.StateEventType;
mport org.apache.dolphnscheduler.common.enums.TaskDependType;
mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus;
mport org.apache.dolphnscheduler.common.graph.DAG;
mport org.apache.dolphnscheduler.common.model.TaskNode;
mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton;
mport org.apache.dolphnscheduler.common.process.ProcessDag;
mport org.apache.dolphnscheduler.common.thread.ThreadUtls; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.apache.dolphnscheduler.common.utls.DateUtls;
mport org.apache.dolphnscheduler.common.utls.JSONUtls;
mport org.apache.dolphnscheduler.common.utls.LoggerUtls;
mport org.apache.dolphnscheduler.common.utls.NetUtls;
mport org.apache.dolphnscheduler.dao.entty.Command;
mport org.apache.dolphnscheduler.dao.entty.Envronment;
mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton;
mport org.apache.dolphnscheduler.dao.entty.ProcessInstance;
mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton;
mport org.apache.dolphnscheduler.dao.entty.ProjectUser;
mport org.apache.dolphnscheduler.dao.entty.Schedule;
mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog;
mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue;
mport org.apache.dolphnscheduler.dao.entty.TaskInstance;
mport org.apache.dolphnscheduler.dao.utls.DagHelper;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.DependResult;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.Drect;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.ExecutonStatus;
mport org.apache.dolphnscheduler.plugn.task.ap.model.Property;
mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand;
mport org.apache.dolphnscheduler.remote.utls.Host;
mport org.apache.dolphnscheduler.server.master.confg.MasterConfg;
mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager;
mport org.apache.dolphnscheduler.server.master.event.StateEvent;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandleError;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandleExcepton;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandler;
mport org.apache.dolphnscheduler.server.master.event.StateEventHandlerManager;
mport org.apache.dolphnscheduler.server.master.metrcs.TaskMetrcs;
mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory;
mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager;
mport org.apache.dolphnscheduler.servce.cron.CronUtls;
mport org.apache.dolphnscheduler.servce.exceptons.CronParseExcepton;
mport org.apache.dolphnscheduler.servce.expand.CurngParamsServce;
mport org.apache.dolphnscheduler.servce.process.ProcessServce;
mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue;
mport org.apache.commons.collectons.CollectonUtls;
mport org.apache.commons.lang3.ArrayUtls;
mport org.apache.commons.lang3.StrngUtls;
mport org.apache.commons.lang3.math.NumberUtls;
mport java.utl.ArrayLst;
mport java.utl.Arrays;
mport java.utl.Collecton;
mport java.utl.Collectons;
mport java.utl.Date;
mport java.utl.HashMap;
mport java.utl.HashSet;
mport java.utl.Iterator;
mport java.utl.Lst;
mport java.utl.Map;
mport java.utl.Objects;
mport java.utl.Optonal;
mport java.utl.Set;
mport java.utl.concurrent.Callable;
mport java.utl.concurrent.ConcurrentHashMap;
mport java.utl.concurrent.ConcurrentLnkedQueue;
mport java.utl.concurrent.atomc.AtomcBoolean;
mport java.utl.stream.Collectors; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.slf4j.Logger;
mport org.slf4j.LoggerFactory;
mport org.sprngframework.beans.BeanUtls;
mport com.google.common.collect.Lsts;
mport lombok.NonNull;
/**
* Workflow execute task, used to execute a workflow nstance.
*/
publc class WorkflowExecuteRunnable mplements Callable<WorkflowSubmtStatue> {
prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteRunnable.class);
prvate fnal ProcessServce processServce;
prvate fnal ProcessAlertManager processAlertManager;
prvate fnal NettyExecutorManager nettyExecutorManager;
prvate fnal ProcessInstance processInstance;
prvate ProcessDefnton processDefnton;
prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag;
/**
* unque key of workflow
*/
prvate Strng key;
prvate WorkflowRunnableStatus workflowRunnableStatus = WorkflowRunnableStatus.CREATED;
/**
* submt falure nodes
*/
prvate boolean taskFaledSubmt = false;
/**
* task nstance hash map, taskId as key
*/
prvate fnal Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * runnng taskProcessor, taskCode as key, taskProcessor as value
* only on taskProcessor per taskCode
*/
prvate fnal Map<Long, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>();
/**
* vald task map, taskCode as key, taskId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> valdTaskMap = new ConcurrentHashMap<>();
/**
* error task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> errorTaskMap = new ConcurrentHashMap<>();
/**
* complete task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> completeTaskMap = new ConcurrentHashMap<>();
/**
* depend faled task map, taskCode as key, taskId as value
*/
prvate fnal Map<Long, Integer> dependFaledTaskMap = new ConcurrentHashMap<>();
/**
* forbdden task map, code as key
*/
prvate fnal Map<Long, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>();
/**
* skp task map, code as key
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | prvate fnal Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>();
/**
* complement date lst
*/
prvate Lst<Date> complementLstDate = Lsts.newLnkedLst();
/**
* state event queue
*/
prvate fnal ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>();
/**
* The StandBy task lst, wll be executed, need to know, the taskInstance n ths queue may doesn't have d.
*/
prvate fnal PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue();
/**
* wat to retry taskInstance map, taskCode as key, taskInstance as value
* before retry, the taskInstance d s 0
*/
prvate fnal Map<Long, TaskInstance> watToRetryTaskInstanceMap = new ConcurrentHashMap<>();
prvate fnal StateWheelExecuteThread stateWheelExecuteThread;
prvate fnal CurngParamsServce curngParamsServce;
prvate fnal Strng masterAddress;
/**
* @param processInstance processInstance
* @param processServce processServce
* @param nettyExecutorManager nettyExecutorManager
* @param processAlertManager processAlertManager
* @param masterConfg masterConfg
* @param stateWheelExecuteThread stateWheelExecuteThread
*/
publc WorkflowExecuteRunnable( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | @NonNull ProcessInstance processInstance,
@NonNull ProcessServce processServce,
@NonNull NettyExecutorManager nettyExecutorManager,
@NonNull ProcessAlertManager processAlertManager,
@NonNull MasterConfg masterConfg,
@NonNull StateWheelExecuteThread stateWheelExecuteThread,
@NonNull CurngParamsServce curngParamsServce) {
ths.processServce = processServce;
ths.processInstance = processInstance;
ths.nettyExecutorManager = nettyExecutorManager;
ths.processAlertManager = processAlertManager;
ths.stateWheelExecuteThread = stateWheelExecuteThread;
ths.curngParamsServce = curngParamsServce;
ths.masterAddress = NetUtls.getAddr(masterConfg.getLstenPort());
TaskMetrcs.regsterTaskPrepared(readyToSubmtTaskQueue::sze);
}
/**
* the process start nodes are submtted completely.
*/
publc boolean sStart() {
return WorkflowRunnableStatus.STARTED == workflowRunnableStatus;
}
/**
* handle event
*/
publc vod handleEvents() {
f (!sStart()) {
logger.nfo(
"The workflow nstance s not started, wll not handle ts state event, current state event sze: {}",
stateEvents); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | return;
}
StateEvent stateEvent = null;
whle (!ths.stateEvents.sEmpty()) {
try {
stateEvent = ths.stateEvents.peek();
LoggerUtls.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(),
stateEvent.getTaskInstanceId());
checkProcessInstance(stateEvent);
StateEventHandler stateEventHandler =
StateEventHandlerManager.getStateEventHandler(stateEvent.getType())
.orElseThrow(() -> new StateEventHandleError("Cannot fnd handler for the gven state event"));
logger.nfo("Begn to handle state event, {}", stateEvent);
f (stateEventHandler.handleStateEvent(ths, stateEvent)) {
ths.stateEvents.remove(stateEvent);
}
} catch (StateEventHandleError stateEventHandleError) {
logger.error("State event handle error, wll remove ths event: {}", stateEvent, stateEventHandleError);
ths.stateEvents.remove(stateEvent);
ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (StateEventHandleExcepton stateEventHandleExcepton) {
logger.error("State event handle error, wll retry ths event: {}",
stateEvent,
stateEventHandleExcepton);
ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} catch (Excepton e) {
logger.error("State event handle error, get a unknown excepton, wll retry ths event: {}", |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | stateEvent,
e);
ThreadUtls.sleep(Constants.SLEEP_TIME_MILLIS);
} fnally {
LoggerUtls.removeWorkflowAndTaskInstanceIdMDC();
}
}
}
publc Strng getKey() {
f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) {
return key;
}
key = Strng.format("%d_%d_%d",
ths.processDefnton.getCode(),
ths.processDefnton.getVerson(),
ths.processInstance.getId());
return key;
}
publc boolean addStateEvent(StateEvent stateEvent) {
f (processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.nfo("state event would be abounded :{}", stateEvent);
return false;
}
ths.stateEvents.add(stateEvent);
return true;
}
publc nt eventSze() {
return ths.stateEvents.sze();
}
publc ProcessInstance getProcessInstance() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | return ths.processInstance;
}
publc boolean checkForceStartAndWakeUp(StateEvent stateEvent) {
TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId());
f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getTaskId(),
TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
return true;
}
f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) {
boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue);
f (acqureTaskGroup) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
return true;
}
}
return false;
}
publc vod processTmeout() {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, projectUser);
}
publc vod taskTmeout(TaskInstance taskInstance) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, projectUser); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
publc vod taskFnshed(TaskInstance taskInstance) throws StateEventHandleExcepton {
logger.nfo("TaskInstance fnshed task code:{} state:{}", taskInstance.getTaskCode(), taskInstance.getState());
try {
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
stateWheelExecuteThread.removeTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4RetryCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance);
f (taskInstance.getState().typeIsSuccess()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
processInstance.setVarPool(taskInstance.getVarPool());
processServce.saveProcessInstance(processInstance);
f (!processInstance.sBlocked()) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
}
} else f (taskInstance.taskCanRetry() && processInstance.getState() != ExecutonStatus.READY_STOP) {
logger.nfo("Retry taskInstance taskInstance state: {}", taskInstance.getState());
retryTaskInstance(taskInstance);
} else f (taskInstance.getState().typeIsFalure()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE && DagHelper.haveAllNodeAfterNode(
Long.toStrng(taskInstance.getTaskCode()),
dag)) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
} else {
errorTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.END) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,909 | [Bug] Stop process instance state is incorrect. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Stop process instance state is incorrect.
### What you expected to happen
process instance state is correct.
### How to reproduce
Execute a process instance and stop it.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/10909 | https://github.com/apache/dolphinscheduler/pull/10922 | 2d7a48b0f059136e160f0a986265d02432701c66 | 9f34a837b8ff068dcc516cf68b140c1c2a3e3381 | 2022-07-12T11:07:21Z | java | 2022-07-13T12:45:52Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | kllAllTasks();
}
}
} else f (taskInstance.getState().typeIsFnshed()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
logger.nfo("TaskInstance fnshed wll try to update the workflow nstance state, task code:{} state:{}",
taskInstance.getTaskCode(),
taskInstance.getState());
ths.updateProcessInstanceState();
} catch (Excepton ex) {
logger.error("Task fnsh faled, get a excepton, wll remove ths taskInstance from completeTaskMap", ex);
completeTaskMap.remove(taskInstance.getTaskCode());
throw ex;
}
}
/**
* release task group
*
* @param taskInstance
*/
publc vod releaseTaskGroup(TaskInstance taskInstance) {
f (taskInstance.getTaskGroupId() > 0) {
TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(taskInstance);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == taskInstance.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId()); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.