status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | if (Objects.isNull(tenant)) {
return StringUtils.EMPTY;
}
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
*
* @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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | *
* @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
* @return process instance
*/
@Override
public ProcessInstance findLastRunningProcess(Long definitionCode, Date startTime, Date endTime) {
return processInstanceMapper.queryLastRunningProcess(definitionCode,
startTime,
endTime,
stateArray);
}
/**
* query user queue by process instance
*
* @param processInstance processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @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.
*
* @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
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @Override
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup();
if (StringUtils.isNotBlank(workerGroup)) {
return workerGroup;
}
int processInstanceId = taskInstance.getProcessInstanceId();
ProcessInstance processInstance = findProcessInstanceById(processInstanceId);
if (processInstance != null) {
return processInstance.getWorkerGroup();
}
logger.info("task : {} will use default worker group", taskInstance.getId());
return Constants.DEFAULT_WORKER_GROUP;
}
/**
* get have perm project list
*
* @param userId userId
* @return project list
*/
@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);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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:
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | originResSet.removeAll(authorizedDatasources);
break;
case UDF:
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet());
originResSet.removeAll(authorizedUdfs);
break;
default:
break;
}
resultList.addAll(originResSet);
}
return resultList;
}
/**
* get user by user id
*
* @param userId user id
* @return User
*/
@Override
public User getUserById(int userId) {
return userMapper.selectById(userId);
}
/**
* get resource by resource id
*
* @param resourceId resource id
* @return Resource
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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
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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | */
@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;
}
@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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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;
}
TaskDefinitionLog taskDefinitionUpdate = taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskVersion);
if (taskDefinitionUpdate == null) {
return Constants.EXIT_CODE_FAILURE;
}
taskDefinitionUpdate.setUpdateTime(new Date());
taskDefinitionUpdate.setId(taskDefinition.getId());
return taskDefinitionMapper.updateById(taskDefinitionUpdate);
}
/**
* get resource ids
*
* @param taskDefinition taskDefinition |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * @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(Collectors.toSet());
}
if (CollectionUtils.isEmpty(resourceIds)) {
return StringUtils.EMPTY;
}
return StringUtils.join(resourceIds, ",");
}
@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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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);
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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);
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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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);
}
}
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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());
}
}
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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()
.map(ProcessTaskRelation::getProcessDefinitionCode)
.collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefineMapper.queryByCodes(processDefinitionCodes);
for (ProcessDefinition processDefinition : processDefinitionList) {
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
return true;
}
}
}
return false;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | * 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
*/
@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())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
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());
}
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
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @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
*/
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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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()) {
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))); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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());
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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;
}
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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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));
}
@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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | }
/**
* 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;
}
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);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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)
*/
@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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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
*/
@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) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | return null;
}
taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
}
} catch (Exception e) {
logger.error("release the task group error", e);
}
logger.info("updateTask:{}", taskInstance.getName());
changeTaskGroupQueueStatus(taskInstance.getId(), TaskGroupQueueStatus.RELEASE);
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
while (this.taskGroupQueueMapper.updateInQueueCAS(Flag.NO.getCode(), Flag.YES.getCode(), taskGroupQueue.getId()) != 1) {
taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
}
return this.taskInstanceMapper.selectById(taskGroupQueue.getTaskId());
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @param taskId task id
* @return the result code and msg
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | 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
*/
@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);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java | @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) {
String host = processInstance.getHost();
String address = host.split(":")[0];
int port = Integer.parseInt(host.split(":")[1]);
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand(
processInstance.getId(), taskId
);
stateEventCallbackService.sendResult(address, port, taskEventChangeCommand.convert2Command(taskType));
}
@Override
public ProcessInstance loadNextProcess4Serial(long code, int state) {
return this.processInstanceMapper.loadNextProcess4Serial(code, state);
}
protected void deleteCommandWithCheck(int commandId) {
int delete = this.commandMapper.deleteById(commandId);
if (delete != 1) {
throw new ServiceException("delete command fail, id:" + commandId);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | 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
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | * 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.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 org.apache.commons.collections4.CollectionUtils;
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 {
@Override
public abstract boolean checkParameters();
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
/**
* local parameters |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | */
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
* @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;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | /**
* get varPool map
*
* @return parameters map
*/
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 (org.apache.commons.collections4.CollectionUtils.isEmpty(localParams)) {
return;
}
List<Property> outProperty = getOutProperty(localParams);
if (org.apache.commons.collections4.CollectionUtils.isEmpty(outProperty)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | return;
}
if (org.apache.dolphinscheduler.spi.utils.StringUtils.isEmpty(result)) {
varPool.addAll(outProperty);
return;
}
Map<String, String> taskResult = getMapByString(result);
if (taskResult.size() == 0) {
return;
}
for (Property info : outProperty) {
String propValue = taskResult.get(info.getProp());
if (org.apache.dolphinscheduler.spi.utils.StringUtils.isNotEmpty(propValue)) {
info.setValue(propValue);
varPool.add(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;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,396 | [Feature][Parameter Context] Support output parameters transfer from parent workflow to child work flow | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
We have supported global parameters transfer from parent workflow to sub-process, however, the transfer of output parameters is not supported.
### Use case
_No response_
### Related issues
_No response_
### Are you willing to submit a 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/9396 | https://github.com/apache/dolphinscheduler/pull/9410 | 14d71d1462508817f20d20a6274a0f52b89d126a | b285ccf9306cc5e402a184dd24da82ca7a08689c | 2022-04-08T02:56:49Z | java | 2022-04-11T12:03:16Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | public List<Map<String, String>> getListMapByString(String json) {
List<Map<String, String>> allParams = new ArrayList<>();
ArrayNode paramsByJson = JSONUtils.parseArray(json);
for (JsonNode jsonNode : paramsByJson) {
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();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | *
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.registry;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_MASTERS;
import static org.apache.dolphinscheduler.common.Constants.REGISTRY_DOLPHINSCHEDULER_NODE;
import static org.apache.dolphinscheduler.common.Constants.SLEEP_TIME_MILLIS;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.IStoppable;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.enums.StateEvent;
import org.apache.dolphinscheduler.common.enums.StateEventType;
import org.apache.dolphinscheduler.common.model.Server;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.registry.api.ConnectionState;
import org.apache.dolphinscheduler.remote.utils.NamedThreadFactory;
import org.apache.dolphinscheduler.server.builder.TaskExecutionContextBuilder;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.runner.WorkflowExecuteThreadPool; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | import org.apache.dolphinscheduler.server.registry.HeartBeatTask;
import org.apache.dolphinscheduler.server.utils.ProcessUtils;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import java.time.Duration;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.collect.Sets;
/**
* zookeeper master client
* <p>
* single instance
*/
@Component
public class MasterRegistryClient {
/**
* logger
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | private static final Logger logger = LoggerFactory.getLogger(MasterRegistryClient.class);
/**
* process service
*/
@Autowired
private ProcessService processService;
@Autowired
private RegistryClient registryClient;
/**
* master config
*/
@Autowired
private MasterConfig masterConfig;
/**
* heartbeat executor
*/
private ScheduledExecutorService heartBeatExecutor;
@Autowired
private WorkflowExecuteThreadPool workflowExecuteThreadPool;
/**
* master startup time, ms
*/
private long startupTime;
private String localNodePath;
public void init() {
this.startupTime = System.currentTimeMillis();
this.heartBeatExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HeartBeatExecutor"));
}
public void start() {
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | registry();
registryClient.subscribe(REGISTRY_DOLPHINSCHEDULER_NODE, new MasterRegistryDataListener());
} catch (Exception e) {
logger.error("master start up exception", e);
throw new RuntimeException("master start up error", e);
}
}
public void setRegistryStoppable(IStoppable stoppable) {
registryClient.setStoppable(stoppable);
}
public void closeRegistry() {
deregister();
}
/**
* remove master node path
*
* @param path node path
* @param nodeType node type
* @param failover is failover
*/
public void removeMasterNodePath(String path, NodeType nodeType, boolean failover) {
logger.info("{} node deleted : {}", nodeType, path);
if (StringUtils.isEmpty(path)) {
logger.error("server down error: empty path: {}, nodeType:{}", path, nodeType);
return;
}
String serverHost = registryClient.getHostByEventDataPath(path);
if (StringUtils.isEmpty(serverHost)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | logger.error("server down error: unknown path: {}, nodeType:{}", path, nodeType);
return;
}
String failoverPath = getFailoverLockPath(nodeType, serverHost);
try {
registryClient.getLock(failoverPath);
if (!registryClient.exists(path)) {
logger.info("path: {} not exists", path);
registryClient.handleDeadServer(Collections.singleton(path), nodeType, Constants.ADD_OP);
}
if (failover) {
failoverServerWhenDown(serverHost, nodeType);
}
} catch (Exception e) {
logger.error("{} server failover failed, host:{}", nodeType, serverHost, e);
} finally {
registryClient.releaseLock(failoverPath);
}
}
/**
* remove worker node path
*
* @param path node path
* @param nodeType node type
* @param failover is failover
*/
public void removeWorkerNodePath(String path, NodeType nodeType, boolean failover) {
logger.info("{} node deleted : {}", nodeType, path); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | try {
String serverHost = null;
if (!StringUtils.isEmpty(path)) {
serverHost = registryClient.getHostByEventDataPath(path);
if (StringUtils.isEmpty(serverHost)) {
logger.error("server down error: unknown path: {}", path);
return;
}
if (!registryClient.exists(path)) {
logger.info("path: {} not exists", path);
registryClient.handleDeadServer(Collections.singleton(path), nodeType, Constants.ADD_OP);
}
}
if (failover) {
failoverServerWhenDown(serverHost, nodeType);
}
} catch (Exception e) {
logger.error("{} server failover failed", nodeType, e);
}
}
private boolean isNeedToHandleDeadServer(String host, NodeType nodeType, Duration sessionTimeout) {
long sessionTimeoutMillis = Math.max(Constants.REGISTRY_SESSION_TIMEOUT, sessionTimeout.toMillis());
List<Server> serverList = registryClient.getServerList(nodeType);
if (CollectionUtils.isEmpty(serverList)) {
return true;
}
Date startupTime = getServerStartupTime(serverList, host);
if (startupTime == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | return true;
}
if (System.currentTimeMillis() - startupTime.getTime() > sessionTimeoutMillis) {
return true;
}
return false;
}
/**
* failover server when server down
*
* @param serverHost server host
* @param nodeType zookeeper node type
*/
private void failoverServerWhenDown(String serverHost, NodeType nodeType) {
switch (nodeType) {
case MASTER:
failoverMaster(serverHost);
break;
case WORKER:
failoverWorker(serverHost);
break;
default:
break;
}
}
/**
* get failover lock path
*
* @param nodeType zookeeper node type
* @return fail over lock path |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | */
public String getFailoverLockPath(NodeType nodeType, String host) {
switch (nodeType) {
case MASTER:
return Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS + "/" + host;
case WORKER:
return Constants.REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_WORKERS + "/" + host;
default:
return "";
}
}
/**
* task needs failover if task start before worker starts
*
* @param workerServers worker servers
* @param taskInstance task instance
* @return true if task instance need fail over
*/
private boolean checkTaskInstanceNeedFailover(List<Server> workerServers, TaskInstance taskInstance) {
boolean taskNeedFailover = true;
if (taskInstance.getHost() == null) {
return false;
}
if (checkTaskAfterWorkerStart(workerServers, taskInstance)) {
taskNeedFailover = false;
}
return taskNeedFailover;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | /**
* check task start after the worker server starts.
*
* @param taskInstance task instance
* @return true if task instance start time after worker server start date
*/
private boolean checkTaskAfterWorkerStart(List<Server> workerServers, TaskInstance taskInstance) {
if (StringUtils.isEmpty(taskInstance.getHost())) {
return false;
}
Date workerServerStartDate = getServerStartupTime(workerServers, taskInstance.getHost());
if (workerServerStartDate != null) {
if (taskInstance.getStartTime() == null) {
return taskInstance.getSubmitTime().after(workerServerStartDate);
} else {
return taskInstance.getStartTime().after(workerServerStartDate);
}
}
return false;
}
/**
* get server startup time
*/
private Date getServerStartupTime(List<Server> servers, String host) {
if (CollectionUtils.isEmpty(servers)) {
return null;
}
Date serverStartupTime = null;
for (Server server : servers) {
if (host.equals(server.getHost() + Constants.COLON + server.getPort())) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | serverStartupTime = server.getCreateTime();
break;
}
}
return serverStartupTime;
}
/**
* get server startup time
*/
private Date getServerStartupTime(NodeType nodeType, String host) {
if (StringUtils.isEmpty(host)) {
return null;
}
List<Server> servers = registryClient.getServerList(nodeType);
return getServerStartupTime(servers, host);
}
/**
* failover worker tasks
* <p>
* 1. kill yarn job if there are yarn jobs in tasks.
* 2. change task state from running to need failover.
* 3. failover all tasks when workerHost is null
*
* @param workerHost worker host
*/
private void failoverWorker(String workerHost) {
if (StringUtils.isEmpty(workerHost)) {
return;
}
List<Server> workerServers = registryClient.getServerList(NodeType.WORKER); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | long startTime = System.currentTimeMillis();
List<TaskInstance> needFailoverTaskInstanceList = processService.queryNeedFailoverTaskInstances(workerHost);
Map<Integer, ProcessInstance> processInstanceCacheMap = new HashMap<>();
logger.info("start worker[{}] failover, task list size:{}", workerHost, needFailoverTaskInstanceList.size());
for (TaskInstance taskInstance : needFailoverTaskInstanceList) {
ProcessInstance processInstance = processInstanceCacheMap.get(taskInstance.getProcessInstanceId());
if (processInstance == null) {
processInstance = processService.findProcessInstanceDetailById(taskInstance.getProcessInstanceId());
if (processInstance == null) {
logger.error("failover task instance error, processInstance {} of taskInstance {} is null",
taskInstance.getProcessInstanceId(), taskInstance.getId());
continue;
}
processInstanceCacheMap.put(processInstance.getId(), processInstance);
}
if (!checkTaskInstanceNeedFailover(workerServers, taskInstance)) {
continue;
}
if (!processInstance.getHost().equalsIgnoreCase(getLocalAddress())) {
continue;
}
logger.info("failover task instance id: {}, process instance id: {}", taskInstance.getId(), taskInstance.getProcessInstanceId());
failoverTaskInstance(processInstance, taskInstance);
}
logger.info("end worker[{}] failover, useTime:{}ms", workerHost, System.currentTimeMillis() - startTime);
}
/**
* failover master
* <p> |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | * failover process instance and associated task instance
*
* @param masterHost master host
*/
public void failoverMaster(String masterHost) {
if (StringUtils.isEmpty(masterHost)) {
return;
}
Date serverStartupTime = getServerStartupTime(NodeType.MASTER, masterHost);
List<Server> workerServers = registryClient.getServerList(NodeType.WORKER);
long startTime = System.currentTimeMillis();
List<ProcessInstance> needFailoverProcessInstanceList = processService.queryNeedFailoverProcessInstances(masterHost);
logger.info("start master[{}] failover, process list size:{}", masterHost, needFailoverProcessInstanceList.size());
for (ProcessInstance processInstance : needFailoverProcessInstanceList) {
if (Constants.NULL.equals(processInstance.getHost())) {
continue;
}
List<TaskInstance> validTaskInstanceList = processService.findValidTaskListByProcessId(processInstance.getId());
for (TaskInstance taskInstance : validTaskInstanceList) {
if (Constants.NULL.equals(taskInstance.getHost())) {
continue;
}
if (taskInstance.getState().typeIsFinished()) {
continue;
}
if (!checkTaskInstanceNeedFailover(workerServers, taskInstance)) {
continue;
}
logger.info("failover task instance id: {}, process instance id: {}", taskInstance.getId(), taskInstance.getProcessInstanceId());
failoverTaskInstance(processInstance, taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | }
if (serverStartupTime != null && processInstance.getRestartTime() != null
&& processInstance.getRestartTime().after(serverStartupTime)) {
continue;
}
logger.info("failover process instance id: {}", processInstance.getId());
processService.processNeedFailoverProcessInstances(processInstance);
}
logger.info("master[{}] failover end, useTime:{}ms", masterHost, System.currentTimeMillis() - startTime);
}
/**
* failover task instance
* <p>
* 1. kill yarn job if there are yarn jobs in tasks.
* 2. change task state from running to need failover.
* 3. try to notify local master
*/
private void failoverTaskInstance(ProcessInstance processInstance, TaskInstance taskInstance) {
if (taskInstance == null) {
logger.error("failover task instance error, taskInstance is null");
return;
}
if (processInstance == null) {
logger.error("failover task instance error, processInstance {} of taskInstance {} is null",
taskInstance.getProcessInstanceId(), taskInstance.getId());
return;
}
taskInstance.setProcessInstance(processInstance);
TaskExecutionContext taskExecutionContext = TaskExecutionContextBuilder.get() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | .buildTaskInstanceRelatedInfo(taskInstance)
.buildProcessInstanceRelatedInfo(processInstance)
.create();
if (masterConfig.isKillYarnJobWhenTaskFailover()) {
ProcessUtils.killYarnJob(taskExecutionContext);
}
taskInstance.setState(ExecutionStatus.NEED_FAULT_TOLERANCE);
processService.saveTaskInstance(taskInstance);
StateEvent stateEvent = new StateEvent();
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(processInstance.getId());
stateEvent.setExecutionStatus(taskInstance.getState());
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
/**
* registry
*/
public void registry() {
String address = NetUtils.getAddr(masterConfig.getListenPort());
localNodePath = getMasterPath();
int masterHeartbeatInterval = masterConfig.getHeartbeatInterval();
HeartBeatTask heartBeatTask = new HeartBeatTask(startupTime,
masterConfig.getMaxCpuLoadAvg(),
masterConfig.getReservedMemory(),
Sets.newHashSet(getMasterPath()),
Constants.MASTER_TYPE,
registryClient); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | registryClient.remove(localNodePath);
registryClient.persistEphemeral(localNodePath, heartBeatTask.getHeartBeatInfo());
while (!registryClient.checkNodeExists(NetUtils.getHost(), NodeType.MASTER)) {
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
}
ThreadUtils.sleep(SLEEP_TIME_MILLIS);
registryClient.handleDeadServer(Collections.singleton(localNodePath), NodeType.MASTER, Constants.DELETE_OP);
registryClient.addConnectionStateListener(this::handleConnectionState);
this.heartBeatExecutor.scheduleAtFixedRate(heartBeatTask, masterHeartbeatInterval, masterHeartbeatInterval, TimeUnit.SECONDS);
logger.info("master node : {} registry to ZK successfully with heartBeatInterval : {}s", address, masterHeartbeatInterval);
}
public void handleConnectionState(ConnectionState state) {
switch (state) {
case CONNECTED:
logger.debug("registry connection state is {}", state);
break;
case SUSPENDED:
logger.warn("registry connection state is {}, ready to retry connection", state);
break;
case RECONNECTED:
logger.debug("registry connection state is {}, clean the node info", state);
registryClient.persistEphemeral(localNodePath, "");
break;
case DISCONNECTED:
logger.warn("registry connection state is {}, ready to stop myself", state);
registryClient.getStoppable().stop("registry connection state is DISCONNECTED, stop myself");
break;
default: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryClient.java | }
}
public void deregister() {
try {
String address = getLocalAddress();
String localNodePath = getMasterPath();
registryClient.remove(localNodePath);
logger.info("master node : {} unRegistry to register center.", address);
heartBeatExecutor.shutdown();
logger.info("heartbeat executor shutdown");
registryClient.close();
} catch (Exception e) {
logger.error("remove registry path exception ", e);
}
}
/**
* get master path
*/
public String getMasterPath() {
String address = getLocalAddress();
return REGISTRY_DOLPHINSCHEDULER_MASTERS + "/" + address;
}
/**
* get local address
*/
public String getLocalAddress() {
return NetUtils.getAddr(masterConfig.getListenPort());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.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 | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.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.server.master.runner;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.NodeType;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.registry.MasterRegistryClient;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.registry.RegistryClient;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Iterator;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class FailoverExecuteThread extends Thread {
private static final Logger logger = LoggerFactory.getLogger(FailoverExecuteThread.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java | @Autowired
private MasterRegistryClient masterRegistryClient;
@Autowired
private RegistryClient registryClient;
@Autowired
private MasterConfig masterConfig;
/**
* process service
*/
@Autowired
private ProcessService processService;
@Override
public synchronized void start() {
super.setName("FailoverExecuteThread");
super.start();
}
@Override
public void run() {
logger.info("failover execute thread started");
while (Stopper.isRunning()) {
try {
List<String> hosts = getNeedFailoverMasterServers();
if (CollectionUtils.isEmpty(hosts)) {
continue;
}
logger.info("need failover hosts:{}", hosts);
for (String host : hosts) {
String failoverPath = masterRegistryClient.getFailoverLockPath(NodeType.MASTER, host);
try {
registryClient.getLock(failoverPath); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,263 | [Improvement][master] Optimize failover | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
Now Master server failover is mainly implemented by MasterRegistryClient and FailoverExecuteThread。Consider whether the failover code can be isolated。
This makes the responsibilities clearer:
MasterRegistryClient--Responsible for node registration、state listener、 removing dead server
FailoverExecuteThread--Responsible for executing failover
FailoverService--Responsible for failover
### Use case
The function of the refactored class is clearer
### Related issues
_No response_
### Are you willing to submit a PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9263 | https://github.com/apache/dolphinscheduler/pull/9281 | 9d7223b038999916ae16a72561d8e141590c1823 | 69923546a1586ceed97a2d013be6f5a8ee977529 | 2022-03-29T09:36:33Z | java | 2022-04-12T03:53:18Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/FailoverExecuteThread.java | masterRegistryClient.failoverMaster(host);
} catch (Exception e) {
logger.error("{} server failover failed, host:{}", NodeType.MASTER, host, e);
} finally {
registryClient.releaseLock(failoverPath);
}
}
} catch (Exception e) {
logger.error("failover execute error", e);
} finally {
ThreadUtils.sleep((long) Constants.SLEEP_TIME_MILLIS * masterConfig.getFailoverInterval() * 60);
}
}
}
private List<String> getNeedFailoverMasterServers() {
List<String> hosts = processService.queryNeedFailoverProcessInstanceHost();
Iterator<String> iterator = hosts.iterator();
while (iterator.hasNext()) {
String host = iterator.next();
if (registryClient.checkNodeExists(host, NodeType.MASTER)) {
if (!host.equals(masterRegistryClient.getLocalAddress())) {
iterator.remove();
}
}
}
return hosts;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | 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
* (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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | 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 org.apache.commons.collections4.CollectionUtils;
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 {
@Override
public abstract boolean checkParameters();
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
/**
* local parameters
*/
public List<Property> localParams;
/**
* var pool |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parameters/AbstractParameters.java | */
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
* @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 varPool map
*
* @return parameters map |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | 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 | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | 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 | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | 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 | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/ParamUtils.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 | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/ParamUtils.java | */
package org.apache.dolphinscheduler.plugin.task.api.parser;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_TASK_EXECUTE_PATH;
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.PARAMETER_TASK_INSTANCE_ID;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
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.parameters.AbstractParameters;
import org.apache.dolphinscheduler.spi.enums.CommandType;
import org.apache.dolphinscheduler.plugin.task.api.enums.DataType;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import com.google.common.base.Preconditions;
/**
* param utils
*/
public class ParamUtils {
/**
* parameter conversion
* Warning:
* When you first invoke the function of convert, the variables of localParams and varPool in the ShellParameters will be modified.
* But in the whole system the variables of localParams and varPool have been used in other functions. I'm not sure if this current
* situation is wrong. So I cannot modify the original logic.
*
* @param taskExecutionContext the context of this task instance
* @param parameters the parameters
* @return global params |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/ParamUtils.java | *
*/
public static Map<String, Property> convert(TaskExecutionContext taskExecutionContext, AbstractParameters parameters) {
Preconditions.checkNotNull(taskExecutionContext);
Preconditions.checkNotNull(parameters);
Map<String, Property> globalParams = getUserDefParamsMap(taskExecutionContext.getDefinedParams());
Map<String,String> globalParamsMap = taskExecutionContext.getDefinedParams();
CommandType commandType = CommandType.of(taskExecutionContext.getCmdTypeIfComplement());
Date scheduleTime = taskExecutionContext.getScheduleTime();
Map<String, Property> localParams = parameters.getLocalParametersMap();
Map<String, Property> varParams = parameters.getVarPoolMap();
if (globalParams.size() == 0 && localParams.size() == 0 && varParams.size() == 0) {
return null;
}
Map<String,String> params = BusinessTimeUtils
.getBusinessTime(commandType,
scheduleTime);
if (globalParamsMap != null) {
params.putAll(globalParamsMap);
}
if (StringUtils.isNotBlank(taskExecutionContext.getExecutePath())) {
params.put(PARAMETER_TASK_EXECUTE_PATH, taskExecutionContext.getExecutePath());
}
params.put(PARAMETER_TASK_INSTANCE_ID, Integer.toString(taskExecutionContext.getTaskInstanceId()));
if (varParams.size() != 0) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/ParamUtils.java | globalParams.putAll(varParams);
}
if (localParams.size() != 0) {
globalParams.putAll(localParams);
}
Iterator<Map.Entry<String, Property>> iter = globalParams.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, Property> en = iter.next();
Property property = en.getValue();
if (StringUtils.isNotEmpty(property.getValue())
&& property.getValue().startsWith("$")) {
/**
* local parameter refers to global parameter with the same name
* note: the global parameters of the process instance here are solidified parameters,
* and there are no variables in them.
*/
String val = property.getValue();
val = ParameterUtils.convertParameterPlaceholders(val, params);
property.setValue(val);
}
}
return globalParams;
}
/**
* format convert
*
* @param paramsMap params map
* @return Map of converted
*/
public static Map<String,String> convert(Map<String,Property> paramsMap) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,361 | [Bug-RD][UI Next][V1.0.0-Alpha]The output parameters should not be entered in the task | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
The output parameters should not be entered in the task
http://ds2:12345/dolphinscheduler/ui/projects/5092091953472/workflow/instances/9925?code=5092095909952
<img width="1919" alt="image" src="https://user-images.githubusercontent.com/76080484/161911825-1e12c1b6-b43e-4b23-a627-0413898a720c.png">
<img width="1793" alt="image" src="https://user-images.githubusercontent.com/76080484/161912157-49d97e60-11aa-4070-b0eb-79b83f424467.png">
### What you expected to happen
If the parameter type is in, the task can be passed in; if the parameter type is out, the task cannot be passed in
### How to reproduce
When the input parameter type is out, it is consistent with the parameter type being in, which is wrong
### 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/9361 | https://github.com/apache/dolphinscheduler/pull/9463 | 8440baa5e836d35dcebd22ef20b8d24c5e811d9e | 04d4e4e0c4912ccdbbe8aa857af95dcc397e9e4e | 2022-04-06T06:49:41Z | java | 2022-04-13T02:43:12Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/parser/ParamUtils.java | if (paramsMap == null) {
return null;
}
Map<String, String> map = new HashMap<>();
Iterator<Map.Entry<String, Property>> iter = paramsMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, Property> en = iter.next();
map.put(en.getKey(), en.getValue().getValue());
}
return map;
}
/**
* get parameters map
*
* @param definedParams definedParams
* @return parameters map
*/
public static Map<String, Property> getUserDefParamsMap(Map<String, String> definedParams) {
Map<String, Property> userDefParamsMaps = new HashMap<>();
if (definedParams != null) {
Iterator<Map.Entry<String, String>> iter = definedParams.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, String> en = iter.next();
Property property = new Property(en.getKey(), Direct.IN, DataType.VARCHAR, en.getValue());
userDefParamsMaps.put(property.getProp(),property);
}
}
return userDefParamsMaps;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/builder/TaskExecutionContextBuilder.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.builder;
import static org.apache.dolphinscheduler.common.Constants.SEC_2_MINUTES_TIME_UNIT;
import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.DataQualityTaskExecutionContext; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/builder/TaskExecutionContextBuilder.java | import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.ResourceParametersHelper;
/**
* TaskExecutionContext builder
*/
public class TaskExecutionContextBuilder {
public static TaskExecutionContextBuilder get() {
return new TaskExecutionContextBuilder();
}
private TaskExecutionContext taskExecutionContext = new TaskExecutionContext();
/**
* build taskInstance related info
*
* @param taskInstance taskInstance
* @return TaskExecutionContextBuilder
*/
public TaskExecutionContextBuilder buildTaskInstanceRelatedInfo(TaskInstance taskInstance) {
taskExecutionContext.setTaskInstanceId(taskInstance.getId());
taskExecutionContext.setTaskName(taskInstance.getName());
taskExecutionContext.setFirstSubmitTime(taskInstance.getFirstSubmitTime());
taskExecutionContext.setStartTime(taskInstance.getStartTime());
taskExecutionContext.setTaskType(taskInstance.getTaskType());
taskExecutionContext.setLogPath(taskInstance.getLogPath());
taskExecutionContext.setWorkerGroup(taskInstance.getWorkerGroup());
taskExecutionContext.setEnvironmentConfig(taskInstance.getEnvironmentConfig());
taskExecutionContext.setHost(taskInstance.getHost());
taskExecutionContext.setResources(taskInstance.getResources());
taskExecutionContext.setDelayTime(taskInstance.getDelayTime());
taskExecutionContext.setVarPool(taskInstance.getVarPool());
taskExecutionContext.setDryRun(taskInstance.getDryRun()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/builder/TaskExecutionContextBuilder.java | return this;
}
public TaskExecutionContextBuilder buildTaskDefinitionRelatedInfo(TaskDefinition taskDefinition) {
taskExecutionContext.setTaskTimeout(Integer.MAX_VALUE);
if (taskDefinition.getTimeoutFlag() == TimeoutFlag.OPEN) {
taskExecutionContext.setTaskTimeoutStrategy(taskDefinition.getTimeoutNotifyStrategy());
if (taskDefinition.getTimeoutNotifyStrategy() == TaskTimeoutStrategy.FAILED
|| taskDefinition.getTimeoutNotifyStrategy() == TaskTimeoutStrategy.WARNFAILED) {
taskExecutionContext.setTaskTimeout(Math.min(taskDefinition.getTimeout() * SEC_2_MINUTES_TIME_UNIT, Integer.MAX_VALUE));
}
}
taskExecutionContext.setTaskParams(taskDefinition.getTaskParams());
return this;
}
/**
* build processInstance related info
*
* @param processInstance processInstance
* @return TaskExecutionContextBuilder
*/
public TaskExecutionContextBuilder buildProcessInstanceRelatedInfo(ProcessInstance processInstance) {
taskExecutionContext.setProcessInstanceId(processInstance.getId());
taskExecutionContext.setScheduleTime(processInstance.getScheduleTime());
taskExecutionContext.setGlobalParams(processInstance.getGlobalParams());
taskExecutionContext.setExecutorId(processInstance.getExecutorId());
taskExecutionContext.setCmdTypeIfComplement(processInstance.getCmdTypeIfComplement().getCode());
taskExecutionContext.setTenantCode(processInstance.getTenantCode());
taskExecutionContext.setQueue(processInstance.getQueue());
return this;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/builder/TaskExecutionContextBuilder.java | /**
* build processDefinition related info
*
* @param processDefinition processDefinition
* @return TaskExecutionContextBuilder
*/
public TaskExecutionContextBuilder buildProcessDefinitionRelatedInfo(ProcessDefinition processDefinition) {
taskExecutionContext.setProcessDefineCode(processDefinition.getCode());
taskExecutionContext.setProcessDefineVersion(processDefinition.getVersion());
taskExecutionContext.setProjectCode(processDefinition.getProjectCode());
return this;
}
public TaskExecutionContextBuilder buildDataQualityTaskExecutionContext(DataQualityTaskExecutionContext dataQualityTaskExecutionContext) {
taskExecutionContext.setDataQualityTaskExecutionContext(dataQualityTaskExecutionContext);
return this;
}
public TaskExecutionContextBuilder buildResourceParametersInfo(ResourceParametersHelper parametersHelper) {
taskExecutionContext.setResourceParametersHelper(parametersHelper);
return this;
}
/**
* create
*
* @return taskExecutionContext
*/
public TaskExecutionContext create() {
return taskExecutionContext;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.processor;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.utils.CommonUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.FileUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.command.TaskExecuteRequestCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRemoteChannel;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.server.utils.LogUtils;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import org.apache.dolphinscheduler.service.alert.AlertClientService;
import org.apache.dolphinscheduler.service.task.TaskPluginManager;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
/**
* worker request processor
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | public class TaskExecuteProcessor implements NettyRequestProcessor {
private static final Logger logger = LoggerFactory.getLogger(TaskExecuteProcessor.class);
/**
* worker config
*/
@Autowired
private WorkerConfig workerConfig;
/**
* task callback service
*/
@Autowired
private TaskCallbackService taskCallbackService;
/**
* alert client service
*/
@Autowired
private AlertClientService alertClientService;
@Autowired
private TaskPluginManager taskPluginManager;
/**
* task execute manager
*/
@Autowired
private WorkerManagerThread workerManager;
/**
* Pre-cache task to avoid extreme situations when kill task. There is no such task in the cache
*
* @param taskExecutionContext task |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | */
private void setTaskCache(TaskExecutionContext taskExecutionContext) {
TaskExecutionContext preTaskCache = new TaskExecutionContext();
preTaskCache.setTaskInstanceId(taskExecutionContext.getTaskInstanceId());
TaskExecutionContextCacheManager.cacheTaskExecutionContext(preTaskCache);
}
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.TASK_EXECUTE_REQUEST == command.getType(),
String.format("invalid command type : %s", command.getType()));
TaskExecuteRequestCommand taskRequestCommand = JSONUtils.parseObject(
command.getBody(), TaskExecuteRequestCommand.class);
if (taskRequestCommand == null) {
logger.error("task execute request command is null");
return;
}
logger.info("task execute request command : {}", taskRequestCommand);
String contextJson = taskRequestCommand.getTaskExecutionContext();
TaskExecutionContext taskExecutionContext = JSONUtils.parseObject(contextJson, TaskExecutionContext.class);
if (taskExecutionContext == null) {
logger.error("task execution context is null");
return;
}
setTaskCache(taskExecutionContext);
taskExecutionContext.setHost(NetUtils.getAddr(workerConfig.getListenPort()));
taskExecutionContext.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext));
if (Constants.DRY_RUN_FLAG_NO == taskExecutionContext.getDryRun()) {
if (CommonUtils.isSudoEnable() && workerConfig.isTenantAutoCreate()) {
OSUtils.createUserIfAbsent(taskExecutionContext.getTenantCode()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | }
if (!OSUtils.getUserList().contains(taskExecutionContext.getTenantCode())) {
logger.error("tenantCode: {} does not exist, taskInstanceId: {}",
taskExecutionContext.getTenantCode(), taskExecutionContext.getTaskInstanceId());
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId());
taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.FAILURE);
taskExecutionContext.setEndTime(new Date());
taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext);
return;
}
String execLocalPath = getExecLocalPath(taskExecutionContext);
logger.info("task instance local execute path : {}", execLocalPath);
taskExecutionContext.setExecutePath(execLocalPath);
try {
FileUtils.createWorkDirIfAbsent(execLocalPath);
} catch (Throwable ex) {
logger.error("create execLocalPath fail, path: {}, taskInstanceId: {}", execLocalPath, taskExecutionContext.getTaskInstanceId());
logger.error("create executeLocalPath fail", ex);
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId());
taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.FAILURE);
taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext);
return;
}
}
taskCallbackService.addRemoteChannel(taskExecutionContext.getTaskInstanceId(),
new NettyRemoteChannel(channel, command.getOpaque()));
long remainTime = DateUtils.getRemainTime(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getDelayTime() * 60L); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java | if (remainTime > 0) {
logger.info("delay the execution of task instance {}, delay time: {} s", taskExecutionContext.getTaskInstanceId(), remainTime);
taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.DELAY_EXECUTION);
taskExecutionContext.setStartTime(null);
taskCallbackService.sendTaskExecuteDelayCommand(taskExecutionContext);
}
boolean offer = workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, alertClientService, taskPluginManager));
if (!offer) {
logger.error("submit task to manager error, queue is full, queue size is {}, taskInstanceId: {}",
workerManager.getDelayQueueSize(), taskExecutionContext.getTaskInstanceId());
taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.FAILURE);
taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext);
}
}
/**
* get execute local path
*
* @param taskExecutionContext taskExecutionContext
* @return execute local path
*/
private String getExecLocalPath(TaskExecutionContext taskExecutionContext) {
return FileUtils.getProcessExecDir(taskExecutionContext.getProjectCode(),
taskExecutionContext.getProcessDefineCode(),
taskExecutionContext.getProcessDefineVersion(),
taskExecutionContext.getProcessInstanceId(),
taskExecutionContext.getTaskInstanceId());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.processor;
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.plugin.task.api.TaskConstants;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.remote.command.Command;
import org.apache.dolphinscheduler.remote.command.CommandType;
import org.apache.dolphinscheduler.remote.command.TaskKillRequestCommand;
import org.apache.dolphinscheduler.remote.command.TaskKillResponseCommand;
import org.apache.dolphinscheduler.remote.processor.NettyRemoteChannel;
import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor;
import org.apache.dolphinscheduler.remote.utils.Host;
import org.apache.dolphinscheduler.remote.utils.Pair;
import org.apache.dolphinscheduler.server.utils.ProcessUtils;
import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread;
import org.apache.dolphinscheduler.service.log.LogClientService;
import org.apache.commons.lang.StringUtils;
import java.util.Collections;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.google.common.base.Preconditions;
import io.netty.channel.Channel;
/**
* task kill processor
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | public class TaskKillProcessor implements NettyRequestProcessor {
private final Logger logger = LoggerFactory.getLogger(TaskKillProcessor.class);
/**
* task callback service
*/
@Autowired
private TaskCallbackService taskCallbackService;
/**
* task execute manager
*/
@Autowired
private WorkerManagerThread workerManager;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | * task kill process
*
* @param channel channel channel
* @param command command command
*/
@Override
public void process(Channel channel, Command command) {
Preconditions.checkArgument(CommandType.TASK_KILL_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType()));
TaskKillRequestCommand killCommand = JSONUtils.parseObject(command.getBody(), TaskKillRequestCommand.class);
if (killCommand == null) {
logger.error("task kill request command is null");
return;
}
logger.info("task kill command : {}", killCommand);
Pair<Boolean, List<String>> result = doKill(killCommand);
taskCallbackService.addRemoteChannel(killCommand.getTaskInstanceId(),
new NettyRemoteChannel(channel, command.getOpaque()));
TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(killCommand.getTaskInstanceId());
if (taskExecutionContext == null) {
logger.error("taskRequest cache is null, taskInstanceId: {}", killCommand.getTaskInstanceId());
return;
}
taskExecutionContext.setCurrentExecutionStatus(result.getLeft() ? ExecutionStatus.SUCCESS : ExecutionStatus.FAILURE);
taskExecutionContext.setAppIds(String.join(TaskConstants.COMMA, result.getRight()));
taskCallbackService.sendTaskKillResponseCommand(taskExecutionContext);
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId());
logger.info("remove REMOTE_CHANNELS, task instance id:{}", killCommand.getTaskInstanceId());
}
/**
* do kill |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | *
* @return kill result
*/
private Pair<Boolean, List<String>> doKill(TaskKillRequestCommand killCommand) {
boolean processFlag = true;
List<String> appIds = Collections.emptyList();
int taskInstanceId = killCommand.getTaskInstanceId();
TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId);
try {
Integer processId = taskExecutionContext.getProcessId();
if (processId.equals(0)) {
workerManager.killTaskBeforeExecuteByInstanceId(taskInstanceId);
TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId);
logger.info("the task has not been executed and has been cancelled, task id:{}", taskInstanceId);
return Pair.of(true, appIds);
}
String pidsStr = ProcessUtils.getPidsStr(taskExecutionContext.getProcessId());
if (!StringUtils.isEmpty(pidsStr)) {
String cmd = String.format("kill -9 %s", pidsStr);
cmd = OSUtils.getSudoCmd(taskExecutionContext.getTenantCode(), cmd);
logger.info("process id:{}, cmd:{}", taskExecutionContext.getProcessId(), cmd);
OSUtils.exeCmd(cmd);
}
} catch (Exception e) {
processFlag = false;
logger.error("kill task error", e);
}
Pair<Boolean, List<String>> yarnResult = killYarnJob(Host.of(taskExecutionContext.getHost()),
taskExecutionContext.getLogPath(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | taskExecutionContext.getExecutePath(),
taskExecutionContext.getTenantCode());
return Pair.of(processFlag && yarnResult.getLeft(), yarnResult.getRight());
}
/**
* build TaskKillResponseCommand
*
* @param killCommand kill command
* @param result exe result
* @return build TaskKillResponseCommand
*/
private TaskKillResponseCommand buildKillTaskResponseCommand(TaskKillRequestCommand killCommand,
Pair<Boolean, List<String>> result) {
TaskKillResponseCommand taskKillResponseCommand = new TaskKillResponseCommand();
taskKillResponseCommand.setStatus(result.getLeft() ? ExecutionStatus.SUCCESS.getCode() : ExecutionStatus.FAILURE.getCode());
taskKillResponseCommand.setAppIds(result.getRight());
TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(killCommand.getTaskInstanceId());
if (taskExecutionContext == null) {
return taskKillResponseCommand;
}
if (taskExecutionContext != null) {
taskKillResponseCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId());
taskKillResponseCommand.setHost(taskExecutionContext.getHost());
taskKillResponseCommand.setProcessId(taskExecutionContext.getProcessId());
}
return taskKillResponseCommand;
}
/**
* kill yarn job
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskKillProcessor.java | * @param host host
* @param logPath logPath
* @param executePath executePath
* @param tenantCode tenantCode
* @return Pair<Boolean, List < String>> yarn kill result
*/
private Pair<Boolean, List<String>> killYarnJob(Host host, String logPath, String executePath, String tenantCode) {
try (LogClientService logClient = new LogClientService();) {
logger.info("log host : {} , logPath : {} , port : {}", host.getIp(), logPath,
host.getPort());
String log = logClient.viewLog(host.getIp(), host.getPort(), logPath);
List<String> appIds = Collections.emptyList();
if (!StringUtils.isEmpty(log)) {
appIds = LoggerUtils.getAppIds(log, logger);
if (StringUtils.isEmpty(executePath)) {
logger.error("task instance execute path is empty");
throw new RuntimeException("task instance execute path is empty");
}
if (appIds.size() > 0) {
ProcessUtils.cancelApplication(appIds, logger, tenantCode, executePath);
}
}
return Pair.of(true, appIds);
} catch (Exception e) {
logger.error("kill yarn job error", e);
}
return Pair.of(false, Collections.emptyList());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.worker.runner;
import org.apache.dolphinscheduler.common.enums.Event;
import org.apache.dolphinscheduler.common.storage.StorageOperate;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext;
import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContextCacheManager;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.remote.command.TaskExecuteResponseCommand;
import org.apache.dolphinscheduler.server.worker.cache.ResponseCache;
import org.apache.dolphinscheduler.server.worker.config.WorkerConfig;
import org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.concurrent.DelayQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
/**
* Manage tasks
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | public class WorkerManagerThread implements Runnable {
private final Logger logger = LoggerFactory.getLogger(WorkerManagerThread.class);
/**
* task queue
*/
private final DelayQueue<TaskExecuteThread> workerExecuteQueue = new DelayQueue<>();
@Autowired(required = false)
private StorageOperate storageOperate;
/**
* thread executor service
*/
private final ExecutorService workerExecService;
/**
* task callback service
*/
@Autowired
private TaskCallbackService taskCallbackService;
public WorkerManagerThread(WorkerConfig workerConfig) {
workerExecService = ThreadUtils.newDaemonFixedThreadExecutor("Worker-Execute-Thread", workerConfig.getExecThreads());
}
/**
* get delay queue size
*
* @return queue size
*/
public int getDelayQueueSize() {
return workerExecuteQueue.size();
}
/**
* get thread pool queue size |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | *
* @return queue size
*/
public int getThreadPoolQueueSize() {
return ((ThreadPoolExecutor) workerExecService).getQueue().size();
}
/**
* Kill tasks that have not been executed, like delay task
* then send Response to Master, update the execution status of task instance
*/
public void killTaskBeforeExecuteByInstanceId(Integer taskInstanceId) {
workerExecuteQueue.stream()
.filter(taskExecuteThread -> taskExecuteThread.getTaskExecutionContext().getTaskInstanceId() == taskInstanceId)
.forEach(workerExecuteQueue::remove);
sendTaskKillResponse(taskInstanceId);
}
/**
* kill task before execute , like delay task
*/
private void sendTaskKillResponse(Integer taskInstanceId) {
TaskExecutionContext taskExecutionContext = TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId);
if (taskExecutionContext == null) {
return;
}
TaskExecuteResponseCommand responseCommand = new TaskExecuteResponseCommand(taskExecutionContext.getTaskInstanceId(), taskExecutionContext.getProcessInstanceId());
responseCommand.setStatus(ExecutionStatus.KILL.getCode());
ResponseCache.get().cache(taskExecutionContext.getTaskInstanceId(), responseCommand.convert2Command(), Event.RESULT);
taskCallbackService.sendTaskExecuteResponseCommand(taskExecutionContext);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,501 | [Bug] [Task] kill task error | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
when i killed a processInstance in ui "workflow" -> "Workflow Instance", it showed that the task had been killed,
but in fact the task is running , and the log is :
java.lang.NullPointerException: null
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.buildTaskExecuteResponseCommand(TaskCallbackService.java:196)
at org.apache.dolphinscheduler.server.worker.processor.TaskCallbackService.sendTaskExecuteResponseCommand(TaskCallbackService.java:250)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.sendTaskKillResponse(WorkerManagerThread.java:111)
at org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread.killTaskBeforeExecuteByInstanceId(WorkerManagerThread.java:97)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.doKill(TaskKillProcessor.java:122)
at org.apache.dolphinscheduler.server.worker.processor.TaskKillProcessor.process(TaskKillProcessor.java:89)
at org.apache.dolphinscheduler.remote.handler.NettyServerHandler.lambda$processReceived$0(NettyServerHandler.java:129)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
### What you expected to happen
please closed it
### How to reproduce
check more
### 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/9501 | https://github.com/apache/dolphinscheduler/pull/9509 | 7b907b854d6bcd648aa58fdce6f91a8886fdbbe3 | 66d148872d120f708542ae029e62917e0ac369ef | 2022-04-14T07:20:22Z | java | 2022-04-14T13:34:02Z | dolphinscheduler-worker/src/main/java/org/apache/dolphinscheduler/server/worker/runner/WorkerManagerThread.java | * submit task
*
* @param taskExecuteThread taskExecuteThread
* @return submit result
*/
public boolean offer(TaskExecuteThread taskExecuteThread) {
return workerExecuteQueue.offer(taskExecuteThread);
}
public void start() {
Thread thread = new Thread(this, this.getClass().getName());
thread.setDaemon(true);
thread.start();
}
@Override
public void run() {
Thread.currentThread().setName("Worker-Execute-Manager-Thread");
TaskExecuteThread taskExecuteThread;
while (Stopper.isRunning()) {
try {
taskExecuteThread = workerExecuteQueue.take();
taskExecuteThread.setStorageOperate(storageOperate);
workerExecService.submit(taskExecuteThread);
} catch (Exception e) {
logger.error("An unexpected interrupt is happened, "
+ "the exception will be ignored and this thread will continue to run", e);
}
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.email;
import static java.util.Objects.requireNonNull;
import org.apache.dolphinscheduler.alert.api.AlertConstants;
import org.apache.dolphinscheduler.alert.api.AlertResult;
import org.apache.dolphinscheduler.alert.api.ShowType;
import org.apache.dolphinscheduler.plugin.alert.email.exception.AlertEmailException; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate;
import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.mail.EmailException;
import org.apache.commons.mail.HtmlEmail;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import javax.activation.CommandMap;
import javax.activation.MailcapCommandMap;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import javax.mail.internet.MimeUtility;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.mail.smtp.SMTPProvider;
public final class MailSender { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | private static final Logger logger = LoggerFactory.getLogger(MailSender.class);
private final List<String> receivers;
private final List<String> receiverCcs;
private final String mailProtocol = "SMTP";
private final String mailSmtpHost;
private final String mailSmtpPort;
private final String mailSenderEmail;
private final String enableSmtpAuth;
private final String mailUser;
private final String mailPasswd;
private final String mailUseStartTLS;
private final String mailUseSSL;
private final String sslTrust;
private final String showType;
private final AlertTemplate alertTemplate;
private final String mustNotNull = " must not be null";
private String xlsFilePath;
public MailSender(Map<String, String> config) {
String receiversConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | if (receiversConfig == null || "".equals(receiversConfig)) {
throw new AlertEmailException(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS + mustNotNull);
}
receivers = Arrays.asList(receiversConfig.split(","));
String receiverCcsConfig = config.get(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS);
receiverCcs = new ArrayList<>();
if (receiverCcsConfig != null && !"".equals(receiverCcsConfig)) {
receiverCcs.addAll(Arrays.asList(receiverCcsConfig.split(",")));
}
mailSmtpHost = config.get(MailParamsConstants.NAME_MAIL_SMTP_HOST);
requireNonNull(mailSmtpHost, MailParamsConstants.NAME_MAIL_SMTP_HOST + mustNotNull);
mailSmtpPort = config.get(MailParamsConstants.NAME_MAIL_SMTP_PORT);
requireNonNull(mailSmtpPort, MailParamsConstants.NAME_MAIL_SMTP_PORT + mustNotNull);
mailSenderEmail = config.get(MailParamsConstants.NAME_MAIL_SENDER);
requireNonNull(mailSenderEmail, MailParamsConstants.NAME_MAIL_SENDER + mustNotNull);
enableSmtpAuth = config.get(MailParamsConstants.NAME_MAIL_SMTP_AUTH);
mailUser = config.get(MailParamsConstants.NAME_MAIL_USER);
requireNonNull(mailUser, MailParamsConstants.NAME_MAIL_USER + mustNotNull);
mailPasswd = config.get(MailParamsConstants.NAME_MAIL_PASSWD);
requireNonNull(mailPasswd, MailParamsConstants.NAME_MAIL_PASSWD + mustNotNull);
mailUseStartTLS = config.get(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE);
requireNonNull(mailUseStartTLS, MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE + mustNotNull);
mailUseSSL = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE);
requireNonNull(mailUseSSL, MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE + mustNotNull);
sslTrust = config.get(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST);
requireNonNull(sslTrust, MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST + mustNotNull);
showType = config.get(AlertConstants.NAME_SHOW_TYPE);
requireNonNull(showType, AlertConstants.NAME_SHOW_TYPE + mustNotNull);
xlsFilePath = config.get(EmailConstants.XLS_FILE_PATH);
if (StringUtils.isBlank(xlsFilePath)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | xlsFilePath = "/tmp/xls";
}
alertTemplate = new DefaultHTMLTemplate();
}
/**
* send mail to receivers
*
* @param title title
* @param content content
*/
public AlertResult sendMails(String title, String content) {
return sendMails(this.receivers, this.receiverCcs, title, content);
}
/**
* send mail
*
* @param receivers receivers
* @param receiverCcs receiverCcs
* @param title title
* @param content content
*/
public AlertResult sendMails(List<String> receivers, List<String> receiverCcs, String title, String content) {
AlertResult alertResult = new AlertResult();
alertResult.setStatus("false");
if (CollectionUtils.isEmpty(receivers) && CollectionUtils.isEmpty(receiverCcs)) {
return alertResult;
}
receivers.removeIf(StringUtils::isEmpty);
Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | if (showType.equals(ShowType.TABLE.getDescp()) || showType.equals(ShowType.TEXT.getDescp())) {
HtmlEmail email = new HtmlEmail();
try {
Session session = getSession();
email.setMailSession(session);
email.setFrom(mailSenderEmail);
email.setCharset(EmailConstants.UTF_8);
if (CollectionUtils.isNotEmpty(receivers)) {
for (String receiver : receivers) {
email.addTo(receiver);
}
}
if (CollectionUtils.isNotEmpty(receiverCcs)) {
for (String receiverCc : receiverCcs) {
email.addCc(receiverCc);
}
}
return getStringObjectMap(title, content, alertResult, email);
} catch (Exception e) {
handleException(alertResult, e);
}
} else if (showType.equals(ShowType.ATTACHMENT.getDescp()) || showType.equals(ShowType.TABLE_ATTACHMENT.getDescp())) {
try {
String partContent = (showType.equals(ShowType.ATTACHMENT.getDescp())
? "Please see the attachment " + title + EmailConstants.EXCEL_SUFFIX_XLSX
: htmlTable(content, false)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | attachment(title, content, partContent);
alertResult.setStatus("true");
return alertResult;
} catch (Exception e) {
handleException(alertResult, e);
return alertResult;
}
}
return alertResult;
}
/**
* html table content
*
* @param content the content
* @param showAll if show the whole content
* @return the html table form
*/
private String htmlTable(String content, boolean showAll) {
return alertTemplate.getMessageFromTemplate(content, ShowType.TABLE, showAll);
}
/**
* html table content
*
* @param content the content
* @return the html table form
*/
private String htmlTable(String content) {
return htmlTable(content, true);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | * html text content
*
* @param content the content
* @return text in html form
*/
private String htmlText(String content) {
return alertTemplate.getMessageFromTemplate(content, ShowType.TEXT);
}
/**
* send mail as Excel attachment
*/
private void attachment(String title, String content, String partContent) throws Exception {
MimeMessage msg = getMimeMessage();
attachContent(title, content, partContent, msg);
}
/**
* get MimeMessage
*/
private MimeMessage getMimeMessage() throws MessagingException {
Session session = getSession();
session.setDebug(false);
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress(mailSenderEmail));
for (String receiver : receivers) {
msg.addRecipients(Message.RecipientType.TO, InternetAddress.parse(receiver)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | }
return msg;
}
/**
* get session
*
* @return the new Session
*/
private Session getSession() {
MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap();
mc.addMailcap("text/html;; x-java-content-handler=com.sun.mail.handlers.text_html");
mc.addMailcap("text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml");
mc.addMailcap("text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain");
mc.addMailcap("multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed");
mc.addMailcap("message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822");
CommandMap.setDefaultCommandMap(mc);
Properties props = new Properties();
props.setProperty(MailParamsConstants.MAIL_SMTP_HOST, mailSmtpHost);
props.setProperty(MailParamsConstants.MAIL_SMTP_PORT, mailSmtpPort);
props.setProperty(MailParamsConstants.MAIL_SMTP_AUTH, enableSmtpAuth);
props.setProperty(EmailConstants.MAIL_TRANSPORT_PROTOCOL, mailProtocol);
props.setProperty(MailParamsConstants.MAIL_SMTP_STARTTLS_ENABLE, mailUseStartTLS);
props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_ENABLE, mailUseSSL);
props.setProperty(MailParamsConstants.MAIL_SMTP_SSL_TRUST, sslTrust);
Authenticator auth = new Authenticator() {
@Override
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(mailUser, mailPasswd); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | }
};
Session session = Session.getInstance(props, auth);
session.addProvider(new SMTPProvider());
return session;
}
/**
* attach content
*/
private void attachContent(String title, String content, String partContent, MimeMessage msg) throws MessagingException, IOException {
/*
* set receiverCc
*/
if (CollectionUtils.isNotEmpty(receiverCcs)) {
for (String receiverCc : receiverCcs) {
msg.addRecipients(Message.RecipientType.CC, InternetAddress.parse(receiverCc));
}
}
msg.setSubject(title);
MimeMultipart partList = new MimeMultipart();
MimeBodyPart part1 = new MimeBodyPart();
part1.setContent(partContent, EmailConstants.TEXT_HTML_CHARSET_UTF_8);
MimeBodyPart part2 = new MimeBodyPart();
File file = new File(xlsFilePath + EmailConstants.SINGLE_SLASH + title + EmailConstants.EXCEL_SUFFIX_XLSX);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | ExcelUtils.genExcelFile(content, title, xlsFilePath);
part2.attachFile(file);
part2.setFileName(MimeUtility.encodeText(title + EmailConstants.EXCEL_SUFFIX_XLSX, EmailConstants.UTF_8, "B"));
partList.addBodyPart(part1);
partList.addBodyPart(part2);
msg.setContent(partList);
Transport.send(msg);
deleteFile(file);
}
/**
* the string object map
*/
private AlertResult getStringObjectMap(String title, String content, AlertResult alertResult, HtmlEmail email) throws EmailException {
/*
* the subject of the message to be sent
*/
email.setSubject(title);
/*
* to send information, you can use HTML tags in mail content because of the use of HtmlEmail
*/
if (showType.equals(ShowType.TABLE.getDescp())) {
email.setMsg(htmlTable(content));
} else if (showType.equals(ShowType.TEXT.getDescp())) {
email.setMsg(htmlText(content));
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 9,487 | [Bug] [ALERT] EMAIL attachment write to the same file | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### What you expected to happen
Due to the result title always be `start process failed`, and DS use the title to decide the file, it will always write the excel data to the same file, which will cause problems.
### How to reproduce
check the email attachment code in MailSender.java.
### Anything else
_No response_
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/9487 | https://github.com/apache/dolphinscheduler/pull/9498 | 46c0c18ec741a2d23a6b45cab5beec43059d4a1e | 51d47de6deec9990c03d5a373064cb3a61355abf | 2022-04-14T01:58:59Z | java | 2022-04-15T02:13:13Z | dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailSender.java | email.setDebug(true);
email.send();
alertResult.setStatus("true");
return alertResult;
}
/**
* file delete
*
* @param file the file to delete
*/
public void deleteFile(File file) {
if (file.exists()) {
if (file.delete()) {
logger.info("delete success: {}", file.getAbsolutePath());
} else {
logger.info("delete fail: {}", file.getAbsolutePath());
}
} else {
logger.info("file not exists: {}", file.getAbsolutePath());
}
}
/**
* handle exception
*/
private void handleException(AlertResult alertResult, Exception e) {
logger.error("Send email to {} failed", receivers, e);
alertResult.setMessage("Send email to {" + String.join(",", receivers) + "} failed," + e.toString());
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.