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 | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @param userId userId
* @return project list
*/
public List<Project> getProjectListHavePerm(int userId) {
List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId);
List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId);
if (createProjects == null) {
createProjects = new ArrayList<>();
}
if (authedProjects != null) {
createProjects.addAll(authedProjects);
}
return createProjects;
}
/**
* list unauthorized udf function
*
* @param userId user id
* @param needChecks data source id array
* @return unauthorized udf function list
*/
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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | Set<Integer> authorizedResourceFiles = ownUdfResources.stream().map(Resource::getId).collect(toSet());
originResSet.removeAll(authorizedResourceFiles);
break;
case RESOURCE_FILE_NAME:
List<Resource> ownResources = resourceMapper.listAuthorizedResource(userId, needChecks);
addAuthorizedResources(ownResources, userId);
Set<String> authorizedResources = ownResources.stream().map(Resource::getFullName).collect(toSet());
originResSet.removeAll(authorizedResources);
break;
case DATASOURCE:
Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId, needChecks).stream().map(DataSource::getId).collect(toSet());
originResSet.removeAll(authorizedDatasources);
break;
case UDF:
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet());
originResSet.removeAll(authorizedUdfs);
break;
default:
break;
}
resultList.addAll(originResSet);
}
return resultList;
}
/**
* get user by user id
*
* @param userId user id
* @return User
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public User getUserById(int userId) {
return userMapper.selectById(userId);
}
/**
* get resource by resource id
*
* @param resourceId resource id
* @return Resource
*/
public Resource getResourceById(int resourceId) {
return resourceMapper.selectById(resourceId);
}
/**
* list resources by ids
*
* @param resIds resIds
* @return resource list
*/
public List<Resource> listResourceByIds(Integer[] resIds) {
return resourceMapper.listResourceByIds(resIds);
}
/**
* format task app id in task instance
*/
public String formatTaskAppId(TaskInstance taskInstance) {
ProcessInstance processInstance = findProcessInstanceById(taskInstance.getProcessInstanceId());
if (processInstance == null) {
return "";
}
ProcessDefinition definition = findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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
*/
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.DEFINITION_FAILURE;
}
}
return result;
}
public int switchProcessTaskRelationVersion(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
if (!processTaskRelationList.isEmpty()) {
processTaskRelationMapper.deleteByCode(processDefinition.getProjectCode(), processDefinition.getCode());
}
List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | return processTaskRelationMapper.batchInsert(processTaskRelationLogList);
}
/**
* get resource ids
*
* @param taskDefinition taskDefinition
* @return resource ids
*/
public String getResourceIds(TaskDefinition taskDefinition) {
Set<Integer> resourceIds = null;
AbstractParameters params = TaskParametersUtils.getParameters(taskDefinition.getTaskType(), taskDefinition.getTaskParams());
if (params != null && CollectionUtils.isNotEmpty(params.getResourceFilesList())) {
resourceIds = params.getResourceFilesList().
stream()
.filter(t -> t.getId() != 0)
.map(ResourceInfo::getId)
.collect(Collectors.toSet());
}
if (CollectionUtils.isEmpty(resourceIds)) {
return StringUtils.EMPTY;
}
return StringUtils.join(resourceIds, ",");
}
public int saveTaskDefine(User operator, long projectCode, List<TaskDefinitionLog> taskDefinitionLogs) {
Date now = new Date();
List<TaskDefinitionLog> newTaskDefinitionLogs = new ArrayList<>();
List<TaskDefinitionLog> updateTaskDefinitionLogs = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUpdateTime(now); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskDefinitionLog.setOperateTime(now);
taskDefinitionLog.setOperator(operator.getId());
taskDefinitionLog.setResourceIds(getResourceIds(taskDefinitionLog));
if (taskDefinitionLog.getCode() > 0 && taskDefinitionLog.getVersion() > 0) {
TaskDefinitionLog definitionCodeAndVersion = taskDefinitionLogMapper
.queryByDefinitionCodeAndVersion(taskDefinitionLog.getCode(), taskDefinitionLog.getVersion());
if (definitionCodeAndVersion != null) {
if (!taskDefinitionLog.equals(definitionCodeAndVersion)) {
taskDefinitionLog.setUserId(definitionCodeAndVersion.getUserId());
Integer version = taskDefinitionLogMapper.queryMaxVersionForDefinition(taskDefinitionLog.getCode());
taskDefinitionLog.setVersion(version + 1);
taskDefinitionLog.setCreateTime(definitionCodeAndVersion.getCreateTime());
updateTaskDefinitionLogs.add(taskDefinitionLog);
}
continue;
}
}
taskDefinitionLog.setUserId(operator.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST);
taskDefinitionLog.setCreateTime(now);
if (taskDefinitionLog.getCode() == 0) {
try {
taskDefinitionLog.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
return Constants.DEFINITION_FAILURE;
}
}
newTaskDefinitionLogs.add(taskDefinitionLog);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | int insertResult = 0;
int updateResult = 0;
for (TaskDefinitionLog taskDefinitionToUpdate : updateTaskDefinitionLogs) {
TaskDefinition task = taskDefinitionMapper.queryByCode(taskDefinitionToUpdate.getCode());
if (task == null) {
newTaskDefinitionLogs.add(taskDefinitionToUpdate);
} else {
insertResult += taskDefinitionLogMapper.insert(taskDefinitionToUpdate);
taskDefinitionToUpdate.setId(task.getId());
updateResult += taskDefinitionMapper.updateById(taskDefinitionToUpdate);
}
}
if (!newTaskDefinitionLogs.isEmpty()) {
updateResult += taskDefinitionMapper.batchInsert(newTaskDefinitionLogs);
insertResult += taskDefinitionLogMapper.batchInsert(newTaskDefinitionLogs);
}
return (insertResult & updateResult) > 0 ? 1 : Constants.EXIT_CODE_SUCCESS;
}
/**
* save processDefinition (including create or update processDefinition)
*/
public int saveProcessDefine(User operator, ProcessDefinition processDefinition, Boolean isFromProcessDefine) {
ProcessDefinitionLog processDefinitionLog = new ProcessDefinitionLog(processDefinition);
Integer version = processDefineLogMapper.queryMaxVersionForDefinition(processDefinition.getCode());
int insertVersion = version == null || version == 0 ? Constants.VERSION_FIRST : version + 1;
processDefinitionLog.setVersion(insertVersion);
processDefinitionLog.setReleaseState(isFromProcessDefine ? ReleaseState.OFFLINE : ReleaseState.ONLINE);
processDefinitionLog.setOperator(operator.getId());
processDefinitionLog.setOperateTime(processDefinition.getUpdateTime());
int insertLog = processDefineLogMapper.insert(processDefinitionLog); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | int result;
if (0 == processDefinition.getId()) {
result = processDefineMapper.insert(processDefinitionLog);
} else {
processDefinitionLog.setId(processDefinition.getId());
result = processDefineMapper.updateById(processDefinitionLog);
}
return (insertLog & result) > 0 ? insertVersion : 0;
}
/**
* save task relations
*/
public int saveTaskRelation(User operator, long projectCode, long processDefinitionCode, int processDefinitionVersion,
List<ProcessTaskRelationLog> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) {
if (taskRelationList.isEmpty()) {
return Constants.EXIT_CODE_SUCCESS;
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = null;
if (CollectionUtils.isNotEmpty(taskDefinitionLogs)) {
taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinition::getCode, taskDefinitionLog -> taskDefinitionLog));
}
Date now = new Date();
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
processTaskRelationLog.setProjectCode(projectCode);
processTaskRelationLog.setProcessDefinitionCode(processDefinitionCode);
processTaskRelationLog.setProcessDefinitionVersion(processDefinitionVersion);
if (taskDefinitionLogMap != null) {
TaskDefinitionLog taskDefinitionLog = taskDefinitionLogMap.get(processTaskRelationLog.getPreTaskCode());
if (taskDefinitionLog != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | processTaskRelationLog.setPreTaskVersion(taskDefinitionLog.getVersion());
}
processTaskRelationLog.setPostTaskVersion(taskDefinitionLogMap.get(processTaskRelationLog.getPostTaskCode()).getVersion());
}
processTaskRelationLog.setCreateTime(now);
processTaskRelationLog.setUpdateTime(now);
processTaskRelationLog.setOperator(operator.getId());
processTaskRelationLog.setOperateTime(now);
}
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
if (!processTaskRelationList.isEmpty()) {
Set<Integer> processTaskRelationSet = processTaskRelationList.stream().map(ProcessTaskRelation::hashCode).collect(toSet());
Set<Integer> taskRelationSet = taskRelationList.stream().map(ProcessTaskRelationLog::hashCode).collect(toSet());
boolean result = CollectionUtils.isEqualCollection(processTaskRelationSet, taskRelationSet);
if (result) {
return Constants.EXIT_CODE_SUCCESS;
}
processTaskRelationMapper.deleteByCode(projectCode, processDefinitionCode);
}
int result = processTaskRelationMapper.batchInsert(taskRelationList);
int resultLog = processTaskRelationLogMapper.batchInsert(taskRelationList);
return (result & resultLog) > 0 ? Constants.EXIT_CODE_SUCCESS : Constants.EXIT_CODE_FAILURE;
}
public boolean isTaskOnline(long taskCode) {
List<ProcessTaskRelation> processTaskRelationList = processTaskRelationMapper.queryByTaskCode(taskCode);
if (!processTaskRelationList.isEmpty()) {
Set<Long> processDefinitionCodes = processTaskRelationList
.stream()
.map(ProcessTaskRelation::getProcessDefinitionCode)
.collect(Collectors.toSet()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | List<ProcessDefinition> processDefinitionList = processDefineMapper.queryByCodes(processDefinitionCodes);
for (ProcessDefinition processDefinition : processDefinitionList) {
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
return true;
}
}
}
return false;
}
/**
* Generate the DAG Graph based on the process definition id
*
* @param processDefinition process definition
* @return dag graph
*/
public DAG<String, TaskNode, TaskNodeRelation> genDagGraph(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<TaskNode> taskNodeList = transformTask(processTaskRelations, Lists.newArrayList());
ProcessDag processDag = DagHelper.getProcessDag(taskNodeList, new ArrayList<>(processTaskRelations));
return DagHelper.buildDagGraph(processDag);
}
/**
* generate DagData
*/
public DagData genDagData(ProcessDefinition processDefinition) {
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<TaskDefinitionLog> taskDefinitionLogList = genTaskDefineList(processTaskRelations);
List<TaskDefinition> taskDefinitions = taskDefinitionLogList.stream() |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | .map(taskDefinitionLog -> JSONUtils.parseObject(JSONUtils.toJsonString(taskDefinitionLog), TaskDefinition.class))
.collect(Collectors.toList());
return new DagData(processDefinition, processTaskRelations, taskDefinitions);
}
public List<TaskDefinitionLog> genTaskDefineList(List<ProcessTaskRelation> processTaskRelations) {
Set<TaskDefinition> taskDefinitionSet = new HashSet<>();
for (ProcessTaskRelation processTaskRelation : processTaskRelations) {
if (processTaskRelation.getPreTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPreTaskCode(), processTaskRelation.getPreTaskVersion()));
}
if (processTaskRelation.getPostTaskCode() > 0) {
taskDefinitionSet.add(new TaskDefinition(processTaskRelation.getPostTaskCode(), processTaskRelation.getPostTaskVersion()));
}
}
if (taskDefinitionSet.isEmpty()) {
return Lists.newArrayList();
}
return taskDefinitionLogMapper.queryByTaskDefinitions(taskDefinitionSet);
}
public List<TaskDefinitionLog> getTaskDefineLogListByRelation(List<ProcessTaskRelation> processTaskRelations) {
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());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskCodeVersionMap.forEach((code,version) -> {
taskDefinitionLogs.add((TaskDefinitionLog) this.findTaskDefinition(code, version));
});
return taskDefinitionLogs;
}
/**
* find task definition by code and version
*/
public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersion) {
return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion);
}
/**
* find process task relation list by projectCode and processDefinitionCode
*/
public List<ProcessTaskRelation> findRelationByCode(long projectCode, long processDefinitionCode) {
return processTaskRelationMapper.queryByProcessCode(projectCode, processDefinitionCode);
}
/**
* 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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
public List<TaskNode> transformTask(List<ProcessTaskRelation> taskRelationList, List<TaskDefinitionLog> taskDefinitionLogs) {
Map<Long, List<Long>> taskCodeMap = new HashMap<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
taskCodeMap.compute(processTaskRelation.getPostTaskCode(), (k, v) -> {
if (v == null) {
v = new ArrayList<>();
}
if (processTaskRelation.getPreTaskCode() != 0L) {
v.add(processTaskRelation.getPreTaskCode());
}
return v;
});
}
if (CollectionUtils.isEmpty(taskDefinitionLogs)) {
taskDefinitionLogs = genTaskDefineList(taskRelationList);
}
Map<Long, TaskDefinitionLog> taskDefinitionLogMap = taskDefinitionLogs.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
List<TaskNode> taskNodeList = new ArrayList<>();
for (Entry<Long, List<Long>> code : taskCodeMap.entrySet()) {
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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskNode.setMaxRetryTimes(taskDefinitionLog.getFailRetryTimes());
taskNode.setRetryInterval(taskDefinitionLog.getFailRetryInterval());
Map<String, Object> taskParamsMap = taskNode.taskParamsToJsonObj(taskDefinitionLog.getTaskParams());
taskNode.setConditionResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.CONDITION_RESULT)));
taskNode.setSwitchResult(JSONUtils.toJsonString(taskParamsMap.get(Constants.SWITCH_RESULT)));
taskNode.setDependence(JSONUtils.toJsonString(taskParamsMap.get(Constants.DEPENDENCE)));
taskParamsMap.remove(Constants.CONDITION_RESULT);
taskParamsMap.remove(Constants.DEPENDENCE);
taskNode.setParams(JSONUtils.toJsonString(taskParamsMap));
taskNode.setTaskInstancePriority(taskDefinitionLog.getTaskPriority());
taskNode.setWorkerGroup(taskDefinitionLog.getWorkerGroup());
taskNode.setEnvironmentCode(taskDefinitionLog.getEnvironmentCode());
taskNode.setTimeout(JSONUtils.toJsonString(new TaskTimeoutParameter(taskDefinitionLog.getTimeoutFlag() == TimeoutFlag.OPEN,
taskDefinitionLog.getTimeoutNotifyStrategy(),
taskDefinitionLog.getTimeout())));
taskNode.setDelayTime(taskDefinitionLog.getDelayTime());
taskNode.setPreTasks(JSONUtils.toJsonString(code.getValue().stream().map(taskDefinitionLogMap::get).map(TaskDefinition::getCode).collect(Collectors.toList())));
taskNode.setTaskGroupId(taskDefinitionLog.getTaskGroupId());
taskNode.setTaskGroupPriority(taskDefinitionLog.getTaskGroupPriority());
taskNodeList.add(taskNode);
}
}
return taskNodeList;
}
public Map<ProcessInstance, TaskInstance> notifyProcessList(int processId) {
HashMap<ProcessInstance, TaskInstance> processTaskMap = new HashMap<>();
ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(processId);
if (processInstanceMap == null) {
return processTaskMap; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
ProcessInstance fatherProcess = this.findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
TaskInstance fatherTask = this.findTaskInstanceById(processInstanceMap.getParentTaskInstanceId());
if (fatherProcess != null) {
processTaskMap.put(fatherProcess, fatherTask);
}
return processTaskMap;
}
/**
* the first time (when submit the task ) get the resource of the task group
* @param taskId task id
* @param taskName
* @param groupId
* @param processId
* @param priority
* @return
*/
public boolean acquireTaskGroup(int taskId,
String taskName, int groupId,
int processId, int priority) {
TaskGroup taskGroup = taskGroupMapper.selectById(groupId);
if (taskGroup == null) {
return true;
}
if (taskGroup.getStatus() == Flag.NO.getCode()) {
return true;
}
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskId);
if (taskGroupQueue == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | taskGroupQueue = insertIntoTaskGroupQueue(taskId, taskName, groupId, processId, priority, TaskGroupQueueStatus.WAIT_QUEUE);
} else {
if (taskGroupQueue.getStatus() == TaskGroupQueueStatus.ACQUIRE_SUCCESS) {
return true;
}
taskGroupQueue.setInQueue(Flag.NO.getCode());
taskGroupQueue.setStatus(TaskGroupQueueStatus.WAIT_QUEUE);
this.taskGroupQueueMapper.updateById(taskGroupQueue);
}
List<TaskGroupQueue> highPriorityTasks = taskGroupQueueMapper.queryHighPriorityTasks(groupId, priority, TaskGroupQueueStatus.WAIT_QUEUE.getCode());
if (CollectionUtils.isNotEmpty(highPriorityTasks)) {
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
int count = taskGroupMapper.selectAvailableCountById(groupId);
if (count == 1 && robTaskGroupResouce(taskGroupQueue)) {
return true;
}
this.taskGroupQueueMapper.updateInQueue(Flag.NO.getCode(), taskGroupQueue.getId());
return false;
}
/**
* try to get the task group resource(when other task release the resource)
* @param taskGroupQueue
* @return
*/
public boolean robTaskGroupResouce(TaskGroupQueue taskGroupQueue) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskGroupQueue.getGroupId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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;
}
public boolean acquireTaskGroupAgain(TaskGroupQueue taskGroupQueue) {
return robTaskGroupResouce(taskGroupQueue);
}
public void releaseAllTaskGroup(int processInstanceId) {
List<TaskInstance> taskInstances = this.taskInstanceMapper.loadAllInfosNoRelease(processInstanceId, TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
for (TaskInstance info : taskInstances) {
releaseTaskGroup(info);
}
}
/**
* release the TGQ resource when the corresponding task is finished.
*
* @return the result code and msg
*/
public TaskInstance releaseTaskGroup(TaskInstance taskInstance) {
TaskGroup taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
if (taskGroup == null) {
return null;
}
TaskGroupQueue thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null;
}
try {
while (taskGroupMapper.releaseTaskGroupResource(taskGroup.getId(), taskGroup.getUseSize()
, thisTaskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode()) != 1) {
thisTaskGroupQueue = this.taskGroupQueueMapper.queryByTaskId(taskInstance.getId());
if (thisTaskGroupQueue.getStatus() == TaskGroupQueueStatus.RELEASE) {
return null;
}
taskGroup = taskGroupMapper.selectById(taskInstance.getTaskGroupId());
}
} catch (Exception e) {
logger.error("release the task group error",e);
}
logger.info("updateTask:{}",taskInstance.getName());
changeTaskGroupQueueStatus(taskInstance.getId(), TaskGroupQueueStatus.RELEASE);
TaskGroupQueue taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
while (this.taskGroupQueueMapper.updateInQueueCAS(Flag.NO.getCode(), Flag.YES.getCode(), taskGroupQueue.getId()) != 1) {
taskGroupQueue = this.taskGroupQueueMapper.queryTheHighestPriorityTasks(taskGroup.getId(),
TaskGroupQueueStatus.WAIT_QUEUE.getCode(), Flag.NO.getCode(), Flag.NO.getCode());
if (taskGroupQueue == null) {
return null;
}
}
return this.taskInstanceMapper.selectById(taskGroupQueue.getTaskId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* release the TGQ resource when the corresponding task is finished.
*
* @param taskId task id
* @return the result code and msg
*/
public void changeTaskGroupQueueStatus(int taskId, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.queryByTaskId(taskId);
taskGroupQueue.setStatus(status);
taskGroupQueue.setUpdateTime(new Date(System.currentTimeMillis()));
taskGroupQueueMapper.updateById(taskGroupQueue);
}
/**
* insert into task group queue
*
* @param taskId task id
* @param taskName task name
* @param groupId group id
* @param processId process id
* @param priority priority
* @return result and msg code
*/
public TaskGroupQueue insertIntoTaskGroupQueue(Integer taskId,
String taskName, Integer groupId,
Integer processId, Integer priority, TaskGroupQueueStatus status) {
TaskGroupQueue taskGroupQueue = new TaskGroupQueue(taskId, taskName, groupId, processId, priority, status);
taskGroupQueueMapper.insert(taskGroupQueue);
return taskGroupQueue;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,658 | [Bug] [ApiServer] workflow copy 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
copy workflow error
### What you expected to happen
can copy workflow successfully
### How to reproduce
create a easy workflow with a shell task, then copy.
### 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/7658 | https://github.com/apache/dolphinscheduler/pull/7659 | b2e2de7a5e7c172cc5d4923783f6e5e53a83da44 | d75f22781be2bc33a399ded7aac5fb2665de8bcf | 2021-12-28T02:59:22Z | java | 2021-12-28T03:25:18Z | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public int updateTaskGroupQueueStatus(Integer taskId, int status) {
return taskGroupQueueMapper.updateStatusByTaskId(taskId, status);
}
public int updateTaskGroupQueue(TaskGroupQueue taskGroupQueue) {
return taskGroupQueueMapper.updateById(taskGroupQueue);
}
public TaskGroupQueue loadTaskGroupQueue(int taskId) {
return this.taskGroupQueueMapper.queryByTaskId(taskId);
}
public void sendStartTask2Master(ProcessInstance processInstance,int taskId,
org.apache.dolphinscheduler.remote.command.CommandType taskType) {
String host = processInstance.getHost();
String address = host.split(":")[0];
int port = Integer.parseInt(host.split(":")[1]);
TaskEventChangeCommand taskEventChangeCommand = new TaskEventChangeCommand(
processInstance.getId(), taskId
);
stateEventCallbackService.sendResult(address, port, taskEventChangeCommand.convert2Command(taskType));
}
public ProcessInstance loadNextProcess4Serial(long code, int state) {
return this.processInstanceMapper.loadNextProcess4Serial(code, state);
}
private void deleteCommandWithCheck(int commandId) {
int delete = this.commandMapper.deleteById(commandId);
if (delete != 1) {
throw new ServiceException("delete command fail, id:" + commandId);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /*
* Lcensed to the Apache Software Foundaton (ASF) under one or more
* contrbutor lcense agreements. See the NOTICE fle dstrbuted wth
* ths work for addtonal nformaton regardng copyrght ownershp.
* The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0
* (the "Lcense"); you may not use ths fle except n complance wth
* the Lcense. You may obtan a copy of the Lcense at
*
* http://www.apache.org/lcenses/LICENSE-2.0
*
* Unless requred by applcable law or agreed to n wrtng, software
* dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled.
* See the Lcense for the specfc language governng permssons and
* lmtatons under the Lcense.
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | package org.apache.dolphnscheduler.server.master.runner;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES;
mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP;
mport org.apache.dolphnscheduler.common.Constants;
mport org.apache.dolphnscheduler.common.enums.CommandType;
mport org.apache.dolphnscheduler.common.enums.DependResult;
mport org.apache.dolphnscheduler.common.enums.Drect;
mport org.apache.dolphnscheduler.common.enums.ExecutonStatus;
mport org.apache.dolphnscheduler.common.enums.FalureStrategy;
mport org.apache.dolphnscheduler.common.enums.Flag;
mport org.apache.dolphnscheduler.common.enums.Prorty;
mport org.apache.dolphnscheduler.common.enums.StateEvent;
mport org.apache.dolphnscheduler.common.enums.StateEventType;
mport org.apache.dolphnscheduler.common.enums.TaskDependType;
mport org.apache.dolphnscheduler.common.enums.TaskGroupQueueStatus;
mport org.apache.dolphnscheduler.common.enums.TaskTmeoutStrategy;
mport org.apache.dolphnscheduler.common.enums.TmeoutFlag;
mport org.apache.dolphnscheduler.common.graph.DAG;
mport org.apache.dolphnscheduler.common.model.TaskNode;
mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton;
mport org.apache.dolphnscheduler.common.process.ProcessDag;
mport org.apache.dolphnscheduler.common.process.Property;
mport org.apache.dolphnscheduler.common.utls.DateUtls;
mport org.apache.dolphnscheduler.common.utls.JSONUtls;
mport org.apache.dolphnscheduler.common.utls.NetUtls;
mport org.apache.dolphnscheduler.common.utls.ParameterUtls; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | mport org.apache.dolphnscheduler.dao.entty.Command;
mport org.apache.dolphnscheduler.dao.entty.Envronment;
mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton;
mport org.apache.dolphnscheduler.dao.entty.ProcessInstance;
mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton;
mport org.apache.dolphnscheduler.dao.entty.ProjectUser;
mport org.apache.dolphnscheduler.dao.entty.Schedule;
mport org.apache.dolphnscheduler.dao.entty.TaskDefnton;
mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog;
mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue;
mport org.apache.dolphnscheduler.dao.entty.TaskInstance;
mport org.apache.dolphnscheduler.dao.utls.DagHelper;
mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand;
mport org.apache.dolphnscheduler.remote.utls.Host;
mport org.apache.dolphnscheduler.server.master.confg.MasterConfg;
mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager;
mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon;
mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory;
mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager;
mport org.apache.dolphnscheduler.servce.process.ProcessServce;
mport org.apache.dolphnscheduler.servce.quartz.cron.CronUtls;
mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue;
mport org.apache.commons.collectons.CollectonUtls;
mport org.apache.commons.lang.StrngUtls;
mport java.utl.ArrayLst;
mport java.utl.Arrays;
mport java.utl.Collecton;
mport java.utl.Date;
mport java.utl.HashMap; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | mport java.utl.Iterator;
mport java.utl.Lst;
mport java.utl.Map;
mport java.utl.Objects;
mport java.utl.Set;
mport java.utl.concurrent.ConcurrentHashMap;
mport java.utl.concurrent.ConcurrentLnkedQueue;
mport java.utl.concurrent.atomc.AtomcBoolean;
mport org.slf4j.Logger;
mport org.slf4j.LoggerFactory;
mport com.google.common.collect.Lsts;
/**
* master exec thread,splt dag
*/
publc class WorkflowExecuteThread {
/**
* logger of WorkflowExecuteThread
*/
prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteThread.class);
/**
* master confg
*/
prvate MasterConfg masterConfg;
/**
* process servce
*/
prvate ProcessServce processServce;
/**
* alert manager
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | prvate ProcessAlertManager processAlertManager;
/**
* netty executor manager
*/
prvate NettyExecutorManager nettyExecutorManager;
/**
* process nstance
*/
prvate ProcessInstance processInstance;
/**
* process defnton
*/
prvate ProcessDefnton processDefnton;
/**
* the object of DAG
*/
prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag;
/**
* key of workflow
*/
prvate Strng key;
/**
* start flag, true: start nodes submt completely
*/
prvate boolean sStart = false;
/**
* submt falure nodes
*/
prvate boolean taskFaledSubmt = false;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * task nstance hash map, taskId as key
*/
prvate Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
/**
* runnng TaskNode, taskId as key
*/
prvate fnal Map<Integer, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>();
/**
* vald task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> valdTaskMap = new ConcurrentHashMap<>();
/**
* error task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> errorTaskMap = new ConcurrentHashMap<>();
/**
* complete task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> completeTaskMap = new ConcurrentHashMap<>();
/**
* depend faled task map, taskCode as key, taskId as value
*/
prvate Map<Strng, Integer> dependFaledTaskMap = new ConcurrentHashMap<>();
/**
* forbdden task map, code as key
*/
prvate Map<Strng, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>();
/**
* skp task map, code as key
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | prvate Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>();
/**
* complement date lst
*/
prvate Lst<Date> complementLstDate = Lsts.newLnkedLst();
/**
* state event queue
*/
prvate ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>();
/**
* ready to submt task queue
*/
prvate PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue();
/**
* state wheel execute thread
*/
prvate StateWheelExecuteThread stateWheelExecuteThread;
/**
* constructor of WorkflowExecuteThread
*
* @param processInstance processInstance
* @param processServce processServce
* @param nettyExecutorManager nettyExecutorManager
* @param processAlertManager processAlertManager
* @param masterConfg masterConfg
* @param stateWheelExecuteThread stateWheelExecuteThread
*/
publc WorkflowExecuteThread(ProcessInstance processInstance
, ProcessServce processServce
, NettyExecutorManager nettyExecutorManager |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | , ProcessAlertManager processAlertManager
, MasterConfg masterConfg
, StateWheelExecuteThread stateWheelExecuteThread) {
ths.processServce = processServce;
ths.processInstance = processInstance;
ths.masterConfg = masterConfg;
ths.nettyExecutorManager = nettyExecutorManager;
ths.processAlertManager = processAlertManager;
ths.stateWheelExecuteThread = stateWheelExecuteThread;
}
/**
* the process start nodes are submtted completely.
*/
publc boolean sStart() {
return ths.sStart;
}
/**
* handle event
*/
publc vod handleEvents() {
f (!sStart) {
return;
}
whle (!ths.stateEvents.sEmpty()) {
try {
StateEvent stateEvent = ths.stateEvents.peek();
f (stateEventHandler(stateEvent)) {
ths.stateEvents.remove(stateEvent);
}
} catch (Excepton e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | logger.error("state handle error:", e);
}
}
}
publc Strng getKey() {
f (StrngUtls.sNotEmpty(key)
|| ths.processDefnton == null) {
return key;
}
key = Strng.format("%d_%d_%d",
ths.processDefnton.getCode(),
ths.processDefnton.getVerson(),
ths.processInstance.getId());
return key;
}
publc boolean addStateEvent(StateEvent stateEvent) {
f (processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.nfo("state event would be abounded :{}", stateEvent.toStrng());
return false;
}
ths.stateEvents.add(stateEvent);
return true;
}
publc nt eventSze() {
return ths.stateEvents.sze();
}
publc ProcessInstance getProcessInstance() {
return ths.processInstance;
}
prvate boolean stateEventHandler(StateEvent stateEvent) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | logger.nfo("process event: {}", stateEvent.toStrng());
f (!checkProcessInstance(stateEvent)) {
return false;
}
boolean result = false;
swtch (stateEvent.getType()) {
case PROCESS_STATE_CHANGE:
result = processStateChangeHandler(stateEvent);
break;
case TASK_STATE_CHANGE:
result = taskStateChangeHandler(stateEvent);
break;
case PROCESS_TIMEOUT:
result = processTmeout();
break;
case TASK_TIMEOUT:
result = taskTmeout(stateEvent);
break;
case WAIT_TASK_GROUP:
result = checkForceStartAndWakeUp(stateEvent);
break;
default:
break;
}
f (result) {
ths.stateEvents.remove(stateEvent);
}
return result;
}
prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId());
f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId());
taskProcessor.dspatch(taskInstance, processInstance);
ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
return true;
}
f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) {
boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue);
f (acqureTaskGroup) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(taskInstance.getProcessInstanceId());
taskProcessor.dspatch(taskInstance, processInstance);
return true;
}
}
return false;
}
prvate boolean taskTmeout(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
TaskInstance taskInstance = taskInstanceMap.get(stateEvent.getTaskInstanceId());
f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) {
return true;
}
TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
taskProcessor.acton(TaskActon.TIMEOUT);
} else {
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, taskInstance.getTaskDefne());
}
return true;
}
prvate boolean processTmeout() {
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, ths.processDefnton);
return true;
}
prvate boolean taskStateChangeHandler(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
TaskInstance task = getTaskInstance(stateEvent.getTaskInstanceId());
f (task.getState() == null) {
logger.error("task state s null, state handler error: {}", stateEvent);
return true;
}
f (task.getState().typeIsFnshed() && !completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) {
taskFnshed(task);
f (task.getTaskGroupId() > 0) {
TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(task);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == task.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | nextEvent.setTaskInstanceId(nextTaskInstance.getId());
nextEvent.setType(StateEventType.WAIT_TASK_GROUP);
ths.stateEvents.add(nextEvent);
} else {
ProcessInstance processInstance = ths.processServce.fndProcessInstanceById(nextTaskInstance.getProcessInstanceId());
ths.processServce.sendStartTask2Master(processInstance, nextTaskInstance.getId(),
org.apache.dolphnscheduler.remote.command.CommandType.TASK_WAKEUP_EVENT_REQUEST);
}
}
}
} else f (actveTaskProcessorMaps.contansKey(stateEvent.getTaskInstanceId())) {
ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
TaskProcessor.run();
f (TaskProcessor.taskState().typeIsFnshed()) {
task = processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
taskFnshed(task);
}
} else {
logger.error("state handler error: {}", stateEvent);
}
return true;
}
prvate vod taskFnshed(TaskInstance task) {
logger.nfo("work flow {} task {} state:{} ",
processInstance.getId(),
task.getId(),
task.getState());
f (task.taskCanRetry()) {
addTaskToStandByLst(task);
f (!task.retryTaskIntervalOverTme()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | logger.nfo("falure task wll be submtted: process d: {}, task nstance d: {} state:{} retry tmes:{} / {}, nterval:{}",
processInstance.getId(),
task.getId(),
task.getState(),
task.getRetryTmes(),
task.getMaxRetryTmes(),
task.getRetryInterval());
stateWheelExecuteThread.addTask4TmeoutCheck(task);
stateWheelExecuteThread.addTask4RetryCheck(task);
} else {
submtStandByTask();
stateWheelExecuteThread.removeTask4TmeoutCheck(task);
stateWheelExecuteThread.removeTask4RetryCheck(task);
}
return;
}
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
actveTaskProcessorMaps.remove(task.getId());
stateWheelExecuteThread.removeTask4TmeoutCheck(task);
stateWheelExecuteThread.removeTask4RetryCheck(task);
f (task.getState().typeIsSuccess()) {
processInstance.setVarPool(task.getVarPool());
processServce.saveProcessInstance(processInstance);
submtPostNode(Long.toStrng(task.getTaskCode()));
} else f (task.getState().typeIsFalure()) {
f (task.sCondtonsTask()
|| DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
submtPostNode(Long.toStrng(task.getTaskCode()));
} else {
errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (processInstance.getFalureStrategy() == FalureStrategy.END) {
kllAllTasks();
}
}
}
ths.updateProcessInstanceState();
}
/**
* update process nstance
*/
publc vod refreshProcessInstance(nt processInstanceId) {
logger.nfo("process nstance update: {}", processInstanceId);
processInstance = processServce.fndProcessInstanceById(processInstanceId);
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
}
/**
* update task nstance
*/
publc vod refreshTaskInstance(nt taskInstanceId) {
logger.nfo("task nstance update: {} ", taskInstanceId);
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskInstanceId);
f (taskInstance == null) {
logger.error("can not fnd task nstance, d:{}", taskInstanceId);
return;
}
processServce.packageTaskInstance(taskInstance, processInstance);
taskInstanceMap.put(taskInstance.getId(), taskInstance);
valdTaskMap.remove(Long.toStrng(taskInstance.getTaskCode())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (Flag.YES == taskInstance.getFlag()) {
valdTaskMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance.getId());
}
}
/**
* check process nstance by state event
*/
publc boolean checkProcessInstance(StateEvent stateEvent) {
f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.error("msmatch process nstance d: {}, state event:{}",
ths.processInstance.getId(),
stateEvent);
return false;
}
return true;
}
/**
* check f task nstance exst by state event
*/
publc boolean checkTaskInstanceByStateEvent(StateEvent stateEvent) {
f (stateEvent.getTaskInstanceId() == 0) {
logger.error("task nstance d null, state event:{}", stateEvent);
return false;
}
f (!taskInstanceMap.contansKey(stateEvent.getTaskInstanceId())) {
logger.error("msmatch task nstance d, event:{}", stateEvent);
return false;
}
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* check f task nstance exst by task code
*/
publc boolean checkTaskInstanceByCode(long taskCode) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
}
for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return true;
}
}
return false;
}
/**
* check f task nstance exst by d
*/
publc boolean checkTaskInstanceById(nt taskInstanceId) {
f (taskInstanceMap == null || taskInstanceMap.sze() == 0) {
return false;
}
return taskInstanceMap.contansKey(taskInstanceId);
}
/**
* get task nstance from memory
*/
publc TaskInstance getTaskInstance(nt taskInstanceId) {
f (taskInstanceMap.contansKey(taskInstanceId)) {
return taskInstanceMap.get(taskInstanceId);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return null;
}
prvate boolean processStateChangeHandler(StateEvent stateEvent) {
try {
logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus());
f (processComplementData()) {
return true;
}
f (stateEvent.getExecutonStatus().typeIsFnshed()) {
endProcess();
}
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
kllAllTasks();
}
return true;
} catch (Excepton e) {
logger.error("process state change error:", e);
}
return true;
}
prvate boolean processComplementData() throws Excepton {
f (!needComplementProcess()) {
return false;
}
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
return false;
}
Date scheduleDate = processInstance.getScheduleTme();
f (scheduleDate == null) {
scheduleDate = complementLstDate.get(0); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | } else f (processInstance.getState().typeIsFnshed()) {
endProcess();
f (complementLstDate.sze() <= 0) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
nt ndex = complementLstDate.ndexOf(scheduleDate);
f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) {
logger.nfo("process complement end. process d:{}", processInstance.getId());
return true;
}
logger.nfo("process complement contnue. process d:{}, schedule tme:{} complementLstDate:{}",
processInstance.getId(),
processInstance.getScheduleTme(),
complementLstDate.toStrng());
scheduleDate = complementLstDate.get(ndex + 1);
processInstance.setId(0);
}
processInstance.setScheduleTme(scheduleDate);
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) {
cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);
processInstance.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
}
processInstance.setState(ExecutonStatus.RUNNING_EXECUTION);
processInstance.setGlobalParams(ParameterUtls.curngGlobalParams(
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme()));
processInstance.setStartTme(new Date());
processInstance.setEndTme(null);
processServce.saveProcessInstance(processInstance);
ths.taskInstanceMap.clear();
startProcess();
return true;
}
prvate boolean needComplementProcess() {
f (processInstance.sComplementData()
&& Flag.NO == processInstance.getIsSubProcess()) {
return true;
}
return false;
}
/**
* process start handle
*/
publc vod startProcess() {
f (ths.taskInstanceMap.sze() > 0) {
return;
}
try {
sStart = false;
buldFlowDag();
ntTaskQueue();
submtPostNode(null);
sStart = true;
} catch (Excepton e) {
logger.error("start process error, process nstance d:{}", processInstance.getId(), e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
/**
* process end handle
*/
prvate vod endProcess() {
ths.stateEvents.clear();
f (processDefnton.getExecutonType().typeIsSeralWat()) {
checkSeralProcess(processDefnton);
}
f (processInstance.getState().typeIsWatngThread()) {
processServce.createRecoveryWatngThreadCommand(null, processInstance);
}
f (processAlertManager.sNeedToSendWarnng(processInstance)) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendAlertProcessInstance(processInstance, getValdTaskLst(), projectUser);
}
f (checkTaskQueue()) {
processServce.releaseAllTaskGroup(processInstance.getId());
}
}
publc vod checkSeralProcess(ProcessDefnton processDefnton) {
nt nextInstanceId = processInstance.getNextProcessInstanceId();
f (nextInstanceId == 0) {
ProcessInstance nextProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.SERIAL_WAIT.getCode());
f (nextProcessInstance == null) {
return;
}
nextInstanceId = nextProcessInstance.getId(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
ProcessInstance nextProcessInstance = ths.processServce.fndProcessInstanceById(nextInstanceId);
f (nextProcessInstance.getState().typeIsFnshed() || nextProcessInstance.getState().typeIsRunnng()) {
return;
}
Map<Strng, Object> cmdParam = new HashMap<>();
cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, nextInstanceId);
Command command = new Command();
command.setCommandType(CommandType.RECOVER_SERIAL_WAIT);
command.setProcessDefntonCode(processDefnton.getCode());
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
processServce.createCommand(command);
}
/**
* generate process dag
*
* @throws Excepton excepton
*/
prvate vod buldFlowDag() throws Excepton {
f (ths.dag != null) {
return;
}
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(),
processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam());
Lst<ProcessTaskRelaton> processTaskRelatons = processServce.fndRelatonByCode(processDefnton.getProjectCode(), processDefnton.getCode());
Lst<TaskDefntonLog> taskDefntonLogs = processServce.getTaskDefneLogLstByRelaton(processTaskRelatons);
Lst<TaskNode> taskNodeLst = processServce.transformTask(processTaskRelatons, taskDefntonLogs);
forbddenTaskMap.clear(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskNodeLst.forEach(taskNode -> {
f (taskNode.sForbdden()) {
forbddenTaskMap.put(Long.toStrng(taskNode.getCode()), taskNode);
}
});
Lst<Strng> recoveryNodeCodeLst = getRecoveryNodeCodeLst(recoverNodeLst);
Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam());
ProcessDag processDag = generateFlowDag(taskNodeLst,
startNodeNameLst, recoveryNodeCodeLst, processInstance.getTaskDependType());
f (processDag == null) {
logger.error("processDag s null");
return;
}
dag = DagHelper.buldDagGraph(processDag);
}
/**
* nt task queue
*/
prvate vod ntTaskQueue() {
taskFaledSubmt = false;
actveTaskProcessorMaps.clear();
dependFaledTaskMap.clear();
completeTaskMap.clear();
errorTaskMap.clear();
f (!sNewProcessInstance()) {
Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId());
for (TaskInstance task : valdTaskInstanceLst) {
valdTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskInstanceMap.put(task.getId(), task);
f (task.sTaskComplete()) {
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
}
f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
contnue;
}
f (task.getState().typeIsFalure() && !task.taskCanRetry()) {
errorTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
}
}
}
f (processInstance.sComplementData() && complementLstDate.sze() == 0) {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
f (cmdParam != null && cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) {
Date start = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
Date end = DateUtls.strngToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode());
f (complementLstDate.sze() == 0 && needComplementProcess()) {
complementLstDate = CronUtls.getSelfFreDateLst(start, end, schedules);
logger.nfo(" process defnton code:{} complement data: {}",
processInstance.getProcessDefntonCode(), complementLstDate.toStrng());
f (complementLstDate.sze() > 0 && Flag.NO == processInstance.getIsSubProcess()) {
processInstance.setScheduleTme(complementLstDate.get(0));
processInstance.setGlobalParams(ParameterUtls.curngGlobalParams(
processDefnton.getGlobalParamMap(),
processDefnton.getGlobalParamLst(),
CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme()));
processServce.updateProcessInstance(processInstance);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
}
}
/**
* submt task to execute
*
* @param taskInstance task nstance
* @return TaskInstance
*/
prvate TaskInstance submtTaskExec(TaskInstance taskInstance) {
try {
ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType());
f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION
&& taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) {
notfyProcessHostUpdate(taskInstance);
}
processServce.packageTaskInstance(taskInstance, processInstance);
boolean submt = taskProcessor.submt(taskInstance, processInstance, masterConfg.getTaskCommtRetryTmes(), masterConfg.getTaskCommtInterval(), masterConfg.sTaskLogger());
f (!submt) {
logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!",
processInstance.getId(), processInstance.getName(),
taskInstance.getId(), taskInstance.getName());
return null;
}
valdTaskMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance.getId());
taskInstanceMap.put(taskInstance.getId(), taskInstance);
actveTaskProcessorMaps.put(taskInstance.getId(), taskProcessor);
taskProcessor.run(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | stateWheelExecuteThread.addTask4TmeoutCheck(taskInstance);
stateWheelExecuteThread.addTask4RetryCheck(taskInstance);
f (taskProcessor.taskState().typeIsFnshed()) {
StateEvent stateEvent = new StateEvent();
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setExecutonStatus(taskProcessor.taskState());
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
ths.stateEvents.add(stateEvent);
}
return taskInstance;
} catch (Excepton e) {
logger.error("submt standby task error", e);
return null;
}
}
prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) {
f (StrngUtls.sEmpty(taskInstance.getHost())) {
return;
}
try {
HostUpdateCommand hostUpdateCommand = new HostUpdateCommand();
hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort()));
hostUpdateCommand.setTaskInstanceId(taskInstance.getId());
Host host = new Host(taskInstance.getHost());
nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command());
} catch (Excepton e) {
logger.error("notfy process host update", e);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | /**
* fnd task nstance n db.
* n case submt more than one same name task n the same tme.
*
* @param taskCode task code
* @param taskVerson task verson
* @return TaskInstance
*/
prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) {
Lst<TaskInstance> valdTaskInstanceLst = getValdTaskLst();
for (TaskInstance taskInstance : valdTaskInstanceLst) {
f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) {
return taskInstance;
}
}
return null;
}
/**
* encapsulaton task
*
* @param processInstance process nstance
* @param taskNode taskNode
* @return TaskInstance
*/
prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) {
TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson());
f (taskInstance == null) {
taskInstance = new TaskInstance();
taskInstance.setTaskCode(taskNode.getCode());
taskInstance.setTaskDefntonVerson(taskNode.getVerson()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | taskInstance.setName(taskNode.getName());
taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS);
taskInstance.setProcessInstanceId(processInstance.getId());
taskInstance.setTaskType(taskNode.getType().toUpperCase());
taskInstance.setAlertFlag(Flag.NO);
taskInstance.setStartTme(null);
taskInstance.setFlag(Flag.YES);
taskInstance.setDryRun(processInstance.getDryRun());
taskInstance.setRetryTmes(0);
taskInstance.setMaxRetryTmes(taskNode.getMaxRetryTmes());
taskInstance.setRetryInterval(taskNode.getRetryInterval());
taskInstance.setTaskParams(taskNode.getTaskParams());
taskInstance.setTaskGroupId(taskNode.getTaskGroupId());
taskInstance.setTaskGroupProrty(taskNode.getTaskGroupProrty());
f (taskNode.getTaskInstanceProrty() == null) {
taskInstance.setTaskInstanceProrty(Prorty.MEDIUM); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | } else {
taskInstance.setTaskInstanceProrty(taskNode.getTaskInstanceProrty());
}
Strng processWorkerGroup = processInstance.getWorkerGroup();
processWorkerGroup = StrngUtls.sBlank(processWorkerGroup) ? DEFAULT_WORKER_GROUP : processWorkerGroup;
Strng taskWorkerGroup = StrngUtls.sBlank(taskNode.getWorkerGroup()) ? processWorkerGroup : taskNode.getWorkerGroup();
Long processEnvronmentCode = Objects.sNull(processInstance.getEnvronmentCode()) ? -1 : processInstance.getEnvronmentCode();
Long taskEnvronmentCode = Objects.sNull(taskNode.getEnvronmentCode()) ? processEnvronmentCode : taskNode.getEnvronmentCode();
f (!processWorkerGroup.equals(DEFAULT_WORKER_GROUP) && taskWorkerGroup.equals(DEFAULT_WORKER_GROUP)) {
taskInstance.setWorkerGroup(processWorkerGroup);
taskInstance.setEnvronmentCode(processEnvronmentCode);
} else {
taskInstance.setWorkerGroup(taskWorkerGroup);
taskInstance.setEnvronmentCode(taskEnvronmentCode);
}
f (!taskInstance.getEnvronmentCode().equals(-1L)) {
Envronment envronment = processServce.fndEnvronmentByCode(taskInstance.getEnvronmentCode());
f (Objects.nonNull(envronment) && StrngUtls.sNotEmpty(envronment.getConfg())) {
taskInstance.setEnvronmentConfg(envronment.getConfg());
}
}
taskInstance.setDelayTme(taskNode.getDelayTme());
}
return taskInstance;
}
publc vod getPreVarPool(TaskInstance taskInstance, Set<Strng> preTask) {
Map<Strng, Property> allProperty = new HashMap<>();
Map<Strng, TaskInstance> allTaskInstance = new HashMap<>();
f (CollectonUtls.sNotEmpty(preTask)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | for (Strng preTaskCode : preTask) {
Integer taskId = completeTaskMap.get(preTaskCode);
f (taskId == null) {
contnue;
}
TaskInstance preTaskInstance = taskInstanceMap.get(taskId);
f (preTaskInstance == null) {
contnue;
}
Strng preVarPool = preTaskInstance.getVarPool();
f (StrngUtls.sNotEmpty(preVarPool)) {
Lst<Property> propertes = JSONUtls.toLst(preVarPool, Property.class);
for (Property nfo : propertes) {
setVarPoolValue(allProperty, allTaskInstance, preTaskInstance, nfo);
}
}
}
f (allProperty.sze() > 0) {
taskInstance.setVarPool(JSONUtls.toJsonStrng(allProperty.values()));
}
}
}
prvate vod setVarPoolValue(Map<Strng, Property> allProperty, Map<Strng, TaskInstance> allTaskInstance, TaskInstance preTaskInstance, Property thsProperty) {
thsProperty.setDrect(Drect.IN);
Strng proName = thsProperty.getProp();
f (allProperty.contansKey(proName)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | Property otherPro = allProperty.get(proName);
f (StrngUtls.sEmpty(thsProperty.getValue())) {
allProperty.put(proName, otherPro);
} else f (StrngUtls.sNotEmpty(otherPro.getValue())) {
TaskInstance otherTask = allTaskInstance.get(proName);
f (otherTask.getEndTme().getTme() > preTaskInstance.getEndTme().getTme()) {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
} else {
allProperty.put(proName, otherPro);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
} else {
allProperty.put(proName, thsProperty);
allTaskInstance.put(proName, preTaskInstance);
}
}
/**
* get complete task nstance map, taskCode as key
*/
prvate Map<Strng, TaskInstance> getCompleteTaskInstanceMap() {
Map<Strng, TaskInstance> completeTaskInstanceMap = new HashMap<>();
for (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
completeTaskInstanceMap.put(Long.toStrng(taskInstance.getTaskCode()), taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
return completeTaskInstanceMap;
}
/**
* get vald task lst
*/
prvate Lst<TaskInstance> getValdTaskLst() {
Lst<TaskInstance> valdTaskInstanceLst = new ArrayLst<>();
for (Integer taskInstanceId : valdTaskMap.values()) {
valdTaskInstanceLst.add(taskInstanceMap.get(taskInstanceId));
}
return valdTaskInstanceLst;
}
prvate vod submtPostNode(Strng parentNodeCode) {
Set<Strng> submtTaskNodeLst = DagHelper.parsePostNodes(parentNodeCode, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
Lst<TaskInstance> taskInstances = new ArrayLst<>();
for (Strng taskNode : submtTaskNodeLst) {
TaskNode taskNodeObject = dag.getNode(taskNode);
f (checkTaskInstanceByCode(taskNodeObject.getCode())) {
contnue;
}
TaskInstance task = createTaskInstance(processInstance, taskNodeObject);
taskInstances.add(task);
}
for (TaskInstance task : taskInstances) {
f (readyToSubmtTaskQueue.contans(task)) {
contnue;
}
f (completeTaskMap.contansKey(Long.toStrng(task.getTaskCode()))) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | logger.nfo("task {} has already run success", task.getName());
contnue;
}
f (task.getState().typeIsPause() || task.getState().typeIsCancel()) {
logger.nfo("task {} stopped, the state s {}", task.getName(), task.getState());
contnue;
}
addTaskToStandByLst(task);
}
submtStandByTask();
updateProcessInstanceState();
}
/**
* determne whether the dependences of the task node are complete
*
* @return DependResult
*/
prvate DependResult sTaskDepsComplete(Strng taskCode) {
Collecton<Strng> startNodes = dag.getBegnNode();
f (startNodes.contans(taskCode)) {
return DependResult.SUCCESS;
}
TaskNode taskNode = dag.getNode(taskCode);
Lst<Strng> depCodeLst = taskNode.getDepLst();
for (Strng depsNode : depCodeLst) {
f (!dag.contansNode(depsNode)
|| forbddenTaskMap.contansKey(depsNode)
|| skpTaskNodeMap.contansKey(depsNode)) {
contnue; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
f (!completeTaskMap.contansKey(depsNode)) {
return DependResult.WAITING;
}
Integer depsTaskId = completeTaskMap.get(depsNode);
ExecutonStatus depTaskState = taskInstanceMap.get(depsTaskId).getState();
f (depTaskState.typeIsPause() || depTaskState.typeIsCancel()) {
return DependResult.NON_EXEC;
}
f (taskNode.sCondtonsTask()) {
contnue;
}
f (!dependTaskSuccess(depsNode, taskCode)) {
return DependResult.FAILED;
}
}
logger.nfo("taskCode: {} completeDependTaskLst: {}", taskCode, Arrays.toStrng(completeTaskMap.keySet().toArray()));
return DependResult.SUCCESS;
}
/**
* depend node s completed, but here need check the condton task branch s the next node
*/
prvate boolean dependTaskSuccess(Strng dependNodeName, Strng nextNodeName) {
f (dag.getNode(dependNodeName).sCondtonsTask()) {
Lst<Strng> nextTaskLst = DagHelper.parseCondtonTask(dependNodeName, skpTaskNodeMap, dag, getCompleteTaskInstanceMap());
f (!nextTaskLst.contans(nextNodeName)) {
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
} else {
Integer taskInstanceId = completeTaskMap.get(dependNodeName);
ExecutonStatus depTaskState = taskInstanceMap.get(taskInstanceId).getState();
f (depTaskState.typeIsFalure()) {
return false;
}
}
return true;
}
/**
* query task nstance by complete state
*
* @param state state
* @return task nstance lst
*/
prvate Lst<TaskInstance> getCompleteTaskByState(ExecutonStatus state) {
Lst<TaskInstance> resultLst = new ArrayLst<>();
for (Integer taskInstanceId : completeTaskMap.values()) {
TaskInstance taskInstance = taskInstanceMap.get(taskInstanceId);
f (taskInstance != null && taskInstance.getState() == state) {
resultLst.add(taskInstance);
}
}
return resultLst;
}
/**
* where there are ongong tasks
*
* @param state state |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * @return ExecutonStatus
*/
prvate ExecutonStatus runnngState(ExecutonStatus state) {
f (state == ExecutonStatus.READY_STOP
|| state == ExecutonStatus.READY_PAUSE
|| state == ExecutonStatus.WAITING_THREAD
|| state == ExecutonStatus.DELAY_EXECUTION) {
return state;
} else {
return ExecutonStatus.RUNNING_EXECUTION;
}
}
/**
* exsts falure task,contans submt falure、dependency falure,execute falure(retry after)
*
* @return Boolean whether has faled task
*/
prvate boolean hasFaledTask() {
f (ths.taskFaledSubmt) {
return true;
}
f (ths.errorTaskMap.sze() > 0) {
return true;
}
return ths.dependFaledTaskMap.sze() > 0;
}
/**
* process nstance falure
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * @return Boolean whether process nstance faled
*/
prvate boolean processFaled() {
f (hasFaledTask()) {
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
return true;
}
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE) {
return readyToSubmtTaskQueue.sze() == 0 && actveTaskProcessorMaps.sze() == 0;
}
}
return false;
}
/**
* whether task for watng thread
*
* @return Boolean whether has watng thread task
*/
prvate boolean hasWatngThreadTask() {
Lst<TaskInstance> watngLst = getCompleteTaskByState(ExecutonStatus.WAITING_THREAD);
return CollectonUtls.sNotEmpty(watngLst);
}
/**
* prepare for pause
* 1,faled retry task n the preparaton queue , returns to falure drectly
* 2,exsts pause task,complement not completed, pendng submsson of tasks, return to suspenson
* 3,success
*
* @return ExecutonStatus
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | prvate ExecutonStatus processReadyPause() {
f (hasRetryTaskInStandBy()) {
return ExecutonStatus.FAILURE;
}
Lst<TaskInstance> pauseLst = getCompleteTaskByState(ExecutonStatus.PAUSE);
f (CollectonUtls.sNotEmpty(pauseLst)
|| !sComplementEnd()
|| readyToSubmtTaskQueue.sze() > 0) {
return ExecutonStatus.PAUSE;
} else {
return ExecutonStatus.SUCCESS;
}
}
/**
* generate the latest process nstance status by the tasks state
*
* @return process nstance executon status
*/
prvate ExecutonStatus getProcessInstanceState(ProcessInstance nstance) {
ExecutonStatus state = nstance.getState();
f (actveTaskProcessorMaps.sze() > 0 || hasRetryTaskInStandBy()) {
// actve
return runnngState(state);
}
// process falure
f (processFaled()) {
return ExecutonStatus.FAILURE;
}
// watng thread
f (hasWatngThreadTask()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | return ExecutonStatus.WAITING_THREAD;
}
// pause
f (state == ExecutonStatus.READY_PAUSE) {
return processReadyPause();
}
// stop
f (state == ExecutonStatus.READY_STOP) {
Lst<TaskInstance> stopLst = getCompleteTaskByState(ExecutonStatus.STOP);
Lst<TaskInstance> kllLst = getCompleteTaskByState(ExecutonStatus.KILL);
f (CollectonUtls.sNotEmpty(stopLst)
|| CollectonUtls.sNotEmpty(kllLst)
|| !sComplementEnd()) {
return ExecutonStatus.STOP;
} else {
return ExecutonStatus.SUCCESS;
}
}
// success
f (state == ExecutonStatus.RUNNING_EXECUTION) {
Lst<TaskInstance> kllTasks = getCompleteTaskByState(ExecutonStatus.KILL);
f (readyToSubmtTaskQueue.sze() > 0) {
//tasks cu
return ExecutonStatus.RUNNING_EXECUTION;
} else f (CollectonUtls.sNotEmpty(kllTasks)) {
// tasks m
return ExecutonStatus.FAILURE;
} else {
// f the
return ExecutonStatus.SUCCESS; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
return state;
}
/**
* whether complement end
*
* @return Boolean whether s complement end
*/
prvate boolean sComplementEnd() {
f (!processInstance.sComplementData()) {
return true;
}
try {
Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam());
Date endTme = DateUtls.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
return processInstance.getScheduleTme().equals(endTme);
} catch (Excepton e) {
logger.error("complement end faled ", e);
return false;
}
}
/**
* updateProcessInstance process nstance state
* after each batch of tasks s executed, the status of the process nstance s updated
*/
prvate vod updateProcessInstanceState() {
ExecutonStatus state = getProcessInstanceState(processInstance);
f (processInstance.getState() != state) {
logger.nfo( |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | "work flow process nstance [d: {}, name:{}], state change from {} to {}, cmd type: {}",
processInstance.getId(), processInstance.getName(),
processInstance.getState(), state,
processInstance.getCommandType());
processInstance.setState(state);
f (state.typeIsFnshed()) {
processInstance.setEndTme(new Date());
}
processServce.updateProcessInstance(processInstance);
StateEvent stateEvent = new StateEvent();
stateEvent.setExecutonStatus(processInstance.getState());
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setType(StateEventType.PROCESS_STATE_CHANGE);
ths.processStateChangeHandler(stateEvent);
}
}
/**
* get task dependency result
*
* @param taskInstance task nstance
* @return DependResult
*/
prvate DependResult getDependResultForTask(TaskInstance taskInstance) {
return sTaskDepsComplete(Long.toStrng(taskInstance.getTaskCode()));
}
/**
* add task to standby lst
*
* @param taskInstance task nstance
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | prvate vod addTaskToStandByLst(TaskInstance taskInstance) {
logger.nfo("add task to stand by lst: {}", taskInstance.getName());
try {
f (!readyToSubmtTaskQueue.contans(taskInstance)) {
readyToSubmtTaskQueue.put(taskInstance);
}
} catch (Excepton e) {
logger.error("add task nstance to readyToSubmtTaskQueue error, taskName: {}", taskInstance.getName(), e);
}
}
/**
* remove task from stand by lst
*
* @param taskInstance task nstance
*/
prvate vod removeTaskFromStandbyLst(TaskInstance taskInstance) {
logger.nfo("remove task from stand by lst, d: {} name:{}",
taskInstance.getId(),
taskInstance.getName());
try {
readyToSubmtTaskQueue.remove(taskInstance);
} catch (Excepton e) {
logger.error("remove task nstance from readyToSubmtTaskQueue error, task d:{}, Name: {}",
taskInstance.getId(),
taskInstance.getName(), e);
}
}
/**
* has retry task n standby
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | * @return Boolean whether has retry task n standby
*/
prvate boolean hasRetryTaskInStandBy() {
for (Iterator<TaskInstance> ter = readyToSubmtTaskQueue.terator(); ter.hasNext(); ) {
f (ter.next().getState().typeIsFalure()) {
return true;
}
}
return false;
}
/**
* close the on gong tasks
*/
prvate vod kllAllTasks() {
logger.nfo("kll called on process nstance d: {}, num: {}", processInstance.getId(),
actveTaskProcessorMaps.sze());
for (nt taskId : actveTaskProcessorMaps.keySet()) {
TaskInstance taskInstance = processServce.fndTaskInstanceById(taskId);
f (taskInstance == null || taskInstance.getState().typeIsFnshed()) {
contnue;
}
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskId);
taskProcessor.acton(TaskActon.STOP);
f (taskProcessor.taskState().typeIsFnshed()) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(ths.processInstance.getId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setExecutonStatus(taskProcessor.taskState());
ths.addStateEvent(stateEvent); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
}
}
publc boolean workFlowFnsh() {
return ths.processInstance.getState().typeIsFnshed();
}
/**
* handlng the lst of tasks to be submtted
*/
prvate vod submtStandByTask() {
try {
nt length = readyToSubmtTaskQueue.sze();
for (nt = 0; < length; ++) {
TaskInstance task = readyToSubmtTaskQueue.peek();
f (task == null) {
contnue;
}
// stop ta
f (task.taskCanRetry()) {
TaskInstance retryTask = processServce.fndTaskInstanceById(task.getId());
f (retryTask != null && retryTask.getState().equals(ExecutonStatus.FORCED_SUCCESS)) {
task.setState(retryTask.getState());
logger.nfo("task: {} has been forced success, put t nto complete task lst and stop retryng", task.getName());
removeTaskFromStandbyLst(task);
completeTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
taskInstanceMap.put(task.getId(), task);
submtPostNode(Long.toStrng(task.getTaskCode()));
contnue;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | //nt var
f (task.sFrstRun()) {
//get pre
Set<Strng> preTask = dag.getPrevousNodes(Long.toStrng(task.getTaskCode()));
getPreVarPool(task, preTask);
}
DependResult dependResult = getDependResultForTask(task);
f (DependResult.SUCCESS == dependResult) {
f (task.retryTaskIntervalOverTme()) {
nt orgnalId = task.getId();
TaskInstance taskInstance = submtTaskExec(task);
f (taskInstance == null) {
ths.taskFaledSubmt = true;
} else {
removeTaskFromStandbyLst(task);
f (taskInstance.getId() != orgnalId) {
actveTaskProcessorMaps.remove(orgnalId);
}
}
}
} else f (DependResult.FAILED == dependResult) {
// f the
dependFaledTaskMap.put(Long.toStrng(task.getTaskCode()), task.getId());
removeTaskFromStandbyLst(task);
logger.nfo("task {},d:{} depend result : {}", task.getName(), task.getId(), dependResult);
} else f (DependResult.NON_EXEC == dependResult) {
// for som
removeTaskFromStandbyLst(task);
logger.nfo("remove task {},d:{} , because depend result : {}", task.getName(), task.getId(), dependResult);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | }
} catch (Excepton e) {
logger.error("submt standby task error", e);
}
}
/**
* get recovery task nstance
*
* @param taskId task d
* @return recovery task nstance
*/
prvate TaskInstance getRecoveryTaskInstance(Strng taskId) {
f (!StrngUtls.sNotEmpty(taskId)) {
return null;
}
try {
Integer ntId = Integer.valueOf(taskId);
TaskInstance task = processServce.fndTaskInstanceById(ntId);
f (task == null) {
logger.error("start node d cannot be found: {}", taskId);
} else {
return task;
}
} catch (Excepton e) {
logger.error("get recovery task nstance faled ", e);
}
return null;
}
/**
* get start task nstance lst |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | *
* @param cmdParam command param
* @return task nstance lst
*/
prvate Lst<TaskInstance> getStartTaskInstanceLst(Strng cmdParam) {
Lst<TaskInstance> nstanceLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap != null && paramMap.contansKey(CMD_PARAM_RECOVERY_START_NODE_STRING)) {
Strng[] dLst = paramMap.get(CMD_PARAM_RECOVERY_START_NODE_STRING).splt(Constants.COMMA);
for (Strng nodeId : dLst) {
TaskInstance task = getRecoveryTaskInstance(nodeId);
f (task != null) {
nstanceLst.add(task);
}
}
}
return nstanceLst;
}
/**
* parse "StartNodeNameLst" from cmd param
*
* @param cmdParam command param
* @return start node name lst
*/
prvate Lst<Strng> parseStartNodeName(Strng cmdParam) {
Lst<Strng> startNodeNameLst = new ArrayLst<>();
Map<Strng, Strng> paramMap = JSONUtls.toMap(cmdParam);
f (paramMap == null) {
return startNodeNameLst;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | f (paramMap.contansKey(CMD_PARAM_START_NODES)) {
startNodeNameLst = Arrays.asLst(paramMap.get(CMD_PARAM_START_NODES).splt(Constants.COMMA));
}
return startNodeNameLst;
}
/**
* generate start node code lst from parsng command param;
* f "StartNodeIdLst" exsts n command param, return StartNodeIdLst
*
* @return recovery node code lst
*/
prvate Lst<Strng> getRecoveryNodeCodeLst(Lst<TaskInstance> recoverNodeLst) {
Lst<Strng> recoveryNodeCodeLst = new ArrayLst<>();
f (CollectonUtls.sNotEmpty(recoverNodeLst)) {
for (TaskInstance task : recoverNodeLst) {
recoveryNodeCodeLst.add(Long.toStrng(task.getTaskCode()));
}
}
return recoveryNodeCodeLst;
}
/**
* generate flow dag
*
* @param totalTaskNodeLst total task node lst
* @param startNodeNameLst start node name lst
* @param recoveryNodeCodeLst recovery node code lst
* @param depNodeType depend node type
* @return ProcessDag process dag
* @throws Excepton excepton
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,538 | [Bug] [server] when there is a forbidden node in dag, the execution flow is abnormal | ### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
In a dag, after the node is forbidden to execute, there is a problem with the judgment of the execution of the node that depends on the forbidden node.
### What you expected to happen
When a node depends on a forbidden node, it should be judged whether the parent node of the forbidden node has finished running.
### How to reproduce

As shown in the figure, test1_stop and test2_stop are forbidden nodes. The test3 node depends on test1_stop and test2_stop. In my opinion, whether test3 is executed depends on whether test1 and test2 are executed. But in my test, although the test1 node has been executed, but test2 is being executed, I think test3 should not be executed at this time, but he was executed. Is this a special design? If this is a bug, I would be happy to contribute my code, thank you.
### Anything else
_No response_
### Version
2.0.1
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/7538 | https://github.com/apache/dolphinscheduler/pull/7613 | 605767e47b29f7dc6f2c1c69e13848a8268fcd1c | 3af4d765c254b1ef72d1d3aeefd9b4a427cb281d | 2021-12-22T02:56:03Z | java | 2021-12-28T10:37:59Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java | publc ProcessDag generateFlowDag(Lst<TaskNode> totalTaskNodeLst,
Lst<Strng> startNodeNameLst,
Lst<Strng> recoveryNodeCodeLst,
TaskDependType depNodeType) throws Excepton {
return DagHelper.generateFlowDag(totalTaskNodeLst, startNodeNameLst, recoveryNodeCodeLst, depNodeType);
}
/**
* check task queue
*/
prvate boolean checkTaskQueue() {
AtomcBoolean result = new AtomcBoolean(false);
taskInstanceMap.forEach((d, taskInstance) -> {
f (taskInstance != null && taskInstance.getTaskGroupId() > 0) {
result.set(true);
}
});
return result.get();
}
/**
* s new process nstance
*/
prvate boolean sNewProcessInstance() {
f (ExecutonStatus.RUNNING_EXECUTION == processInstance.getState() && processInstance.getRunTmes() == 1) {
return true;
} else {
return false;
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractTaskExecutor.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;
import org.apache.dolphinscheduler.spi.task.AbstractTask;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import java.util.StringJoiner;
import java.util.concurrent.LinkedBlockingQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Marker;
import org.slf4j.MarkerFactory;
public abstract class AbstractTaskExecutor extends AbstractTask { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractTaskExecutor.java | public static final Marker FINALIZE_SESSION_MARKER = MarkerFactory.getMarker("FINALIZE_SESSION");
protected Logger logger;
/**
* constructor
*
* @param taskRequest taskRequest
*/
protected AbstractTaskExecutor(TaskRequest taskRequest) {
super(taskRequest);
logger = LoggerFactory.getLogger(taskRequest.getTaskLogName());
}
/**
* log handle
*
* @param logs log list
*/
public void logHandle(LinkedBlockingQueue<String> logs) {
if (logs.contains(FINALIZE_SESSION_MARKER.toString())) {
logger.info(FINALIZE_SESSION_MARKER, FINALIZE_SESSION_MARKER.toString());
} else {
StringJoiner joiner = new StringJoiner("\n\t");
while (!logs.isEmpty()) {
joiner.add(logs.poll());
}
logger.info(" -> {}", joiner);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureParameters.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.procedure;
import org.apache.dolphinscheduler.spi.task.AbstractParameters;
import org.apache.dolphinscheduler.spi.task.ResourceInfo;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import java.util.ArrayList;
import java.util.List;
/**
* procedure parameter
*/
public class ProcedureParameters extends AbstractParameters { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureParameters.java | /**
* data source type,eg MYSQL, POSTGRES, HIVE ...
*/
private String type;
/**
* data source id
*/
private int datasource;
/**
* procedure name
*/
private String method;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureParameters.java | public int getDatasource() {
return datasource;
}
public void setDatasource(int datasource) {
this.datasource = datasource;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
@Override
public boolean checkParameters() {
return datasource != 0 && StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(method);
}
@Override
public List<ResourceInfo> getResourceFilesList() {
return new ArrayList<>();
}
@Override
public String toString() {
return "ProcessdureParam{"
+ "type='" + type + '\''
+ ", datasource=" + datasource
+ ", method='" + method + '\''
+ '}';
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.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.procedure;
import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_FAILURE;
import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_SUCCESS;
import static org.apache.dolphinscheduler.spi.task.TaskConstants.TASK_LOG_INFO_FORMAT;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | import org.apache.dolphinscheduler.spi.datasource.ConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DataType;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.spi.task.AbstractParameters;
import org.apache.dolphinscheduler.spi.task.Direct;
import org.apache.dolphinscheduler.spi.task.Property;
import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils;
import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Types;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* procedure task
*/
public class ProcedureTask extends AbstractTaskExecutor {
/**
* procedure parameters
*/
private ProcedureParameters procedureParameters;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | * taskExecutionContext
*/
private TaskRequest taskExecutionContext;
/**
* constructor
*
* @param taskExecutionContext taskExecutionContext
*/
public ProcedureTask(TaskRequest taskExecutionContext) {
super(taskExecutionContext);
this.taskExecutionContext = taskExecutionContext;
logger.info("procedure task params {}", taskExecutionContext.getTaskParams());
this.procedureParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), ProcedureParameters.class);
if (!procedureParameters.checkParameters()) {
throw new RuntimeException("procedure task params is not valid");
}
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format(TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
logger.info("procedure type : {}, datasource : {}, method : {} , localParams : {}",
procedureParameters.getType(),
procedureParameters.getDatasource(),
procedureParameters.getMethod(),
procedureParameters.getLocalParams());
Connection connection = null;
CallableStatement stmt = null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | try {
DbType dbType = DbType.valueOf(procedureParameters.getType());
ConnectionParam connectionParam = DataSourceUtils.buildConnectionParams(DbType.valueOf(procedureParameters.getType()),
taskExecutionContext.getProcedureTaskExecutionContext().getConnectionParams());
connection = DataSourceClientProvider.getInstance().getConnection(dbType, connectionParam);
Map<String, Property> paramsMap = ParamUtils.convert(taskExecutionContext,getParameters());
stmt = connection.prepareCall(procedureParameters.getMethod());
setTimeout(stmt);
Map<Integer, Property> outParameterMap = getOutParameterMap(stmt, paramsMap);
stmt.executeUpdate();
printOutParameter(stmt, outParameterMap);
setExitStatusCode(EXIT_CODE_SUCCESS);
} catch (Exception e) {
setExitStatusCode(EXIT_CODE_FAILURE);
logger.error("procedure task error", e);
throw e;
} finally {
close(stmt, connection);
}
}
/**
* print outParameter |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | *
* @param stmt CallableStatement
* @param outParameterMap outParameterMap
* @throws SQLException SQLException
*/
private void printOutParameter(CallableStatement stmt,
Map<Integer, Property> outParameterMap) throws SQLException {
for (Map.Entry<Integer, Property> en : outParameterMap.entrySet()) {
int index = en.getKey();
Property property = en.getValue();
String prop = property.getProp();
DataType dataType = property.getType();
getOutputParameter(stmt, index, prop, dataType);
}
}
/**
* get output parameter
*
* @param stmt CallableStatement
* @param paramsMap paramsMap
* @return outParameterMap
* @throws Exception Exception
*/
private Map<Integer, Property> getOutParameterMap(CallableStatement stmt, Map<String, Property> paramsMap) throws Exception {
Map<Integer, Property> outParameterMap = new HashMap<>();
if (procedureParameters.getLocalParametersMap() == null) {
return outParameterMap;
}
Collection<Property> userDefParamsList = procedureParameters.getLocalParametersMap().values(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | if (CollectionUtils.isEmpty(userDefParamsList)) {
return outParameterMap;
}
int index = 1;
for (Property property : userDefParamsList) {
logger.info("localParams : prop : {} , dirct : {} , type : {} , value : {}"
, property.getProp(),
property.getDirect(),
property.getType(),
property.getValue());
if (property.getDirect().equals(Direct.IN)) {
ParameterUtils.setInParameter(index, stmt, property.getType(), paramsMap.get(property.getProp()).getValue());
} else if (property.getDirect().equals(Direct.OUT)) {
setOutParameter(index, stmt, property.getType(), paramsMap.get(property.getProp()).getValue());
property.setValue(paramsMap.get(property.getProp()).getValue());
outParameterMap.put(index, property);
}
index++;
}
return outParameterMap;
}
/**
* set timeout
*
* @param stmt CallableStatement
*/
private void setTimeout(CallableStatement stmt) throws SQLException {
Boolean failed = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED;
Boolean warnFailed = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | if (failed || warnFailed) {
stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
}
}
/**
* close jdbc resource
*
* @param stmt stmt
* @param connection connection
*/
private void close(PreparedStatement stmt, Connection connection) {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
logger.error("close prepared statement error : {}", e.getMessage(), e);
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
logger.error("close connection error : {}", e.getMessage(), e);
}
}
}
/**
* get output parameter
*
* @param stmt stmt |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | * @param index index
* @param prop prop
* @param dataType dataType
* @throws SQLException SQLException
*/
private void getOutputParameter(CallableStatement stmt, int index, String prop, DataType dataType) throws SQLException {
switch (dataType) {
case VARCHAR:
logger.info("out prameter varchar key : {} , value : {}", prop, stmt.getString(index));
break;
case INTEGER:
logger.info("out prameter integer key : {} , value : {}", prop, stmt.getInt(index));
break;
case LONG:
logger.info("out prameter long key : {} , value : {}", prop, stmt.getLong(index));
break;
case FLOAT:
logger.info("out prameter float key : {} , value : {}", prop, stmt.getFloat(index));
break;
case DOUBLE:
logger.info("out prameter double key : {} , value : {}", prop, stmt.getDouble(index));
break;
case DATE:
logger.info("out prameter date key : {} , value : {}", prop, stmt.getDate(index));
break;
case TIME:
logger.info("out prameter time key : {} , value : {}", prop, stmt.getTime(index));
break;
case TIMESTAMP:
logger.info("out prameter timestamp key : {} , value : {}", prop, stmt.getTimestamp(index)); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | break;
case BOOLEAN:
logger.info("out prameter boolean key : {} , value : {}", prop, stmt.getBoolean(index));
break;
default:
break;
}
}
@Override
public AbstractParameters getParameters() {
return procedureParameters;
}
/**
* set out parameter
*
* @param index index
* @param stmt stmt
* @param dataType dataType
* @param value value
* @throws Exception exception
*/
private void setOutParameter(int index, CallableStatement stmt, DataType dataType, String value) throws Exception {
int sqlType;
switch (dataType) {
case VARCHAR:
sqlType = Types.VARCHAR;
break;
case INTEGER:
case LONG:
sqlType = Types.INTEGER; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-procedure/src/main/java/org/apache/dolphinscheduler/plugin/task/procedure/ProcedureTask.java | break;
case FLOAT:
sqlType = Types.FLOAT;
break;
case DOUBLE:
sqlType = Types.DOUBLE;
break;
case DATE:
sqlType = Types.DATE;
break;
case TIME:
sqlType = Types.TIME;
break;
case TIMESTAMP:
sqlType = Types.TIMESTAMP;
break;
case BOOLEAN:
sqlType = Types.BOOLEAN;
break;
default:
throw new IllegalStateException("Unexpected value: " + dataType);
}
if (StringUtils.isEmpty(value)) {
stmt.registerOutParameter(index, sqlType);
} else {
stmt.registerOutParameter(index, sqlType, value);
}
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.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.sql;
import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;
import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor;
import org.apache.dolphinscheduler.plugin.task.api.TaskException;
import org.apache.dolphinscheduler.plugin.task.util.MapUtils;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
import org.apache.dolphinscheduler.spi.enums.DbType;
import org.apache.dolphinscheduler.spi.enums.TaskTimeoutStrategy;
import org.apache.dolphinscheduler.spi.task.AbstractParameters;
import org.apache.dolphinscheduler.spi.task.Direct;
import org.apache.dolphinscheduler.spi.task.Property;
import org.apache.dolphinscheduler.spi.task.TaskAlertInfo; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | import org.apache.dolphinscheduler.spi.task.TaskConstants;
import org.apache.dolphinscheduler.spi.task.paramparser.ParamUtils;
import org.apache.dolphinscheduler.spi.task.paramparser.ParameterUtils;
import org.apache.dolphinscheduler.spi.task.request.SQLTaskExecutionContext;
import org.apache.dolphinscheduler.spi.task.request.TaskRequest;
import org.apache.dolphinscheduler.spi.task.request.UdfFuncRequest;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import org.apache.dolphinscheduler.spi.utils.StringUtils;
import org.apache.commons.collections.CollectionUtils;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
public class SqlTask extends AbstractTaskExecutor { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | /**
* taskExecutionContext
*/
private TaskRequest taskExecutionContext; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | /**
* sql parameters
*/
private SqlParameters sqlParameters;
/**
* base datasource
*/
private BaseConnectionParam baseConnectionParam;
/**
* create function format
*/
private static final String CREATE_FUNCTION_FORMAT = "create temporary function {0} as ''{1}''";
/**
* default query sql limit
*/
private static final int QUERY_LIMIT = 10000;
/**
* Abstract Yarn Task
*
* @param taskRequest taskRequest
*/
public SqlTask(TaskRequest taskRequest) {
super(taskRequest);
this.taskExecutionContext = taskRequest;
this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class);
assert sqlParameters != null;
if (!sqlParameters.checkParameters()) {
throw new RuntimeException("sql task params is not valid");
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | @Override
public AbstractParameters getParameters() {
return sqlParameters;
}
@Override
public void handle() throws Exception {
String threadLoggerInfoName = String.format(TaskConstants.TASK_LOG_INFO_FORMAT, taskExecutionContext.getTaskAppId());
Thread.currentThread().setName(threadLoggerInfoName);
logger.info("Full sql parameters: {}", sqlParameters);
logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {},varPool : {} ,query max result limit {}",
sqlParameters.getType(),
sqlParameters.getDatasource(),
sqlParameters.getSql(),
sqlParameters.getLocalParams(),
sqlParameters.getUdfs(),
sqlParameters.getShowType(),
sqlParameters.getConnParams(),
sqlParameters.getVarPool(),
sqlParameters.getLimit());
try {
SQLTaskExecutionContext sqlTaskExecutionContext = taskExecutionContext.getSqlTaskExecutionContext();
baseConnectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams(
DbType.valueOf(sqlParameters.getType()),
sqlTaskExecutionContext.getConnectionParams());
SqlBinds mainSqlBinds = getSqlAndSqlParamsMap(sqlParameters.getSql());
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements())
.orElse(new ArrayList<>()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | .stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements())
.orElse(new ArrayList<>())
.stream()
.map(this::getSqlAndSqlParamsMap)
.collect(Collectors.toList());
List<String> createFuncs = createFuncs(sqlTaskExecutionContext.getUdfFuncTenantCodeMap(),
sqlTaskExecutionContext.getDefaultFS(), logger);
executeFuncAndSql(mainSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs);
setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS);
} catch (Exception e) {
setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE);
logger.error("sql task error: {}", e.toString());
throw e;
}
}
/**
* execute function and sql
*
* @param mainSqlBinds main sql binds
* @param preStatementsBinds pre statements binds
* @param postStatementsBinds post statements binds
* @param createFuncs create functions
*/
public void executeFuncAndSql(SqlBinds mainSqlBinds,
List<SqlBinds> preStatementsBinds,
List<SqlBinds> postStatementsBinds, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | List<String> createFuncs) throws Exception {
Connection connection = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
try {
connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam);
if (CollectionUtils.isNotEmpty(createFuncs)) {
createTempFunction(connection, createFuncs);
}
preSql(connection, preStatementsBinds);
stmt = prepareStatementAndBind(connection, mainSqlBinds);
String result = null;
if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) {
resultSet = stmt.executeQuery();
result = resultProcess(resultSet);
} else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) {
String updateResult = String.valueOf(stmt.executeUpdate());
result = setNonQuerySqlReturn(updateResult, sqlParameters.getLocalParams());
}
sqlParameters.dealOutParam(result);
postSql(connection, postStatementsBinds);
} catch (Exception e) {
logger.error("execute sql error: {}", e.getMessage()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | throw e;
} finally {
close(resultSet, stmt, connection);
}
}
private String setNonQuerySqlReturn(String updateResult, List<Property> properties) {
String result = null;
for (Property info : properties) {
if (Direct.OUT == info.getDirect()) {
List<Map<String, String>> updateRL = new ArrayList<>();
Map<String, String> updateRM = new HashMap<>();
updateRM.put(info.getProp(), updateResult);
updateRL.add(updateRM);
result = JSONUtils.toJsonString(updateRL);
break;
}
}
return result;
}
/**
* result process
*
* @param resultSet resultSet
* @throws Exception Exception
*/
private String resultProcess(ResultSet resultSet) throws Exception {
ArrayNode resultJSONArray = JSONUtils.createArrayNode();
if (resultSet != null) {
ResultSetMetaData md = resultSet.getMetaData();
int num = md.getColumnCount(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | int rowCount = 0;
int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit();
while (rowCount < limit && resultSet.next()) {
ObjectNode mapOfColValues = JSONUtils.createObjectNode();
for (int i = 1; i <= num; i++) {
mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i)));
}
resultJSONArray.add(mapOfColValues);
rowCount++;
}
int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS;
displayRows = Math.min(displayRows, resultJSONArray.size());
logger.info("display sql result {} rows as follows:", displayRows);
for (int i = 0; i < displayRows; i++) {
String row = JSONUtils.toJsonString(resultJSONArray.get(i));
logger.info("row {} : {}", i + 1, row);
}
if (resultSet.next()) {
logger.info("sql result limit : {} exceeding results are filtered", limit);
String log = String.format("sql result limit : %d exceeding results are filtered", limit);
resultJSONArray.add(JSONUtils.toJsonNode(log));
}
}
String result = JSONUtils.toJsonString(resultJSONArray);
if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) {
sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle())
? sqlParameters.getTitle()
: taskExecutionContext.getTaskName() + " query result sets", result);
}
logger.debug("execute sql result : {}", result); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | return result;
}
/**
* send alert as an attachment
*
* @param title title
* @param content content
*/
private void sendAttachment(int groupId, String title, String content) {
setNeedAlert(Boolean.TRUE);
TaskAlertInfo taskAlertInfo = new TaskAlertInfo();
taskAlertInfo.setAlertGroupId(groupId);
taskAlertInfo.setContent(content);
taskAlertInfo.setTitle(title);
setTaskAlertInfo(taskAlertInfo);
}
/**
* pre sql
*
* @param connection connection
* @param preStatementsBinds preStatementsBinds
*/
private void preSql(Connection connection,
List<SqlBinds> preStatementsBinds) throws Exception {
for (SqlBinds sqlBind : preStatementsBinds) {
try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)) {
int result = pstmt.executeUpdate();
logger.info("pre statement execute result: {}, for sql: {}", result, sqlBind.getSql());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | }
/**
* post sql
*
* @param connection connection
* @param postStatementsBinds postStatementsBinds
*/
private void postSql(Connection connection,
List<SqlBinds> postStatementsBinds) throws Exception {
for (SqlBinds sqlBind : postStatementsBinds) {
try (PreparedStatement pstmt = prepareStatementAndBind(connection, sqlBind)) {
int result = pstmt.executeUpdate();
logger.info("post statement execute result: {},for sql: {}", result, sqlBind.getSql());
}
}
}
/**
* create temp function
*
* @param connection connection
* @param createFuncs createFuncs
*/
private void createTempFunction(Connection connection,
List<String> createFuncs) throws Exception {
try (Statement funcStmt = connection.createStatement()) {
for (String createFunc : createFuncs) {
logger.info("hive create function sql: {}", createFunc);
funcStmt.execute(createFunc);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | }
/**
* close jdbc resource
*
* @param resultSet resultSet
* @param pstmt pstmt
* @param connection connection
*/
private void close(ResultSet resultSet,
PreparedStatement pstmt,
Connection connection) {
if (resultSet != null) {
try {
resultSet.close();
} catch (SQLException e) {
logger.error("close result set error : {}", e.getMessage(), e);
}
}
if (pstmt != null) {
try {
pstmt.close();
} catch (SQLException e) {
logger.error("close prepared statement error : {}", e.getMessage(), e);
}
}
if (connection != null) {
try {
connection.close();
} catch (SQLException e) {
logger.error("close connection error : {}", e.getMessage(), e); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | }
}
}
/**
* preparedStatement bind
*
* @param connection connection
* @param sqlBinds sqlBinds
* @return PreparedStatement
* @throws Exception Exception
*/
private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) {
boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED
|| taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED;
try {
PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql());
if (timeoutFlag) {
stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout());
}
Map<Integer, Property> params = sqlBinds.getParamsMap();
if (params != null) {
for (Map.Entry<Integer, Property> entry : params.entrySet()) {
Property prop = entry.getValue();
ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue());
}
}
logger.info("prepare statement replace sql : {} ", stmt);
return stmt;
} catch (Exception exception) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | throw new TaskException("SQL task prepareStatementAndBind error", exception);
}
}
/**
* regular expressions match the contents between two specified strings
*
* @param content content
* @param rgex rgex
* @param sqlParamsMap sql params map
* @param paramsPropsMap params props map
*/
public void setSqlParamsMap(String content, String rgex, Map<Integer, Property> sqlParamsMap, Map<String, Property> paramsPropsMap) {
Pattern pattern = Pattern.compile(rgex);
Matcher m = pattern.matcher(content);
int index = 1;
while (m.find()) {
String paramName = m.group(1);
Property prop = paramsPropsMap.get(paramName);
if (prop == null) {
logger.error("setSqlParamsMap: No Property with paramName: {} is found in paramsPropsMap of task instance"
+ " with id: {}. So couldn't put Property in sqlParamsMap.", paramName, taskExecutionContext.getTaskInstanceId());
} else {
sqlParamsMap.put(index, prop);
index++;
logger.info("setSqlParamsMap: Property with paramName: {} put in sqlParamsMap of content {} successfully.", paramName, content);
}
}
}
/**
* print replace sql |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | *
* @param content content
* @param formatSql format sql
* @param rgex rgex
* @param sqlParamsMap sql params map
*/
private void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) {
logger.info("after replace sql , preparing : {}", formatSql);
StringBuilder logPrint = new StringBuilder("replaced sql , parameters:");
if (sqlParamsMap == null) {
logger.info("printReplacedSql: sqlParamsMap is null.");
} else {
for (int i = 1; i <= sqlParamsMap.size(); i++) {
logPrint.append(sqlParamsMap.get(i).getValue()).append("(").append(sqlParamsMap.get(i).getType()).append(")");
}
}
logger.info("Sql Params are {}", logPrint);
}
/**
* ready to execute SQL and parameter entity Map
*
* @return SqlBinds
*/
private SqlBinds getSqlAndSqlParamsMap(String sql) {
Map<Integer, Property> sqlParamsMap = new HashMap<>();
StringBuilder sqlBuilder = new StringBuilder();
Map<String, Property> paramsMap = ParamUtils.convert(taskExecutionContext, getParameters()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 7,607 | [Bug] [dolphinscheduler-api] Failed to execute PROCEDURE node | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
1.An error is reported when the data storage IN mode references a user-defined parameter


2.An error is reported when the data storage OUTmode references a user-defined parameter


### What you expected to happen
.
### How to reproduce
.
### Anything else
_No response_
### Version
2.0.1
### 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/7607 | https://github.com/apache/dolphinscheduler/pull/7680 | 2b05ebf47e3f6c3d02810a8c0dd18c32be4ffde0 | cc77963522536526618e19216d38dcd4fd8da472 | 2021-12-24T03:58:29Z | java | 2021-12-28T11:19:30Z | dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java | if (paramsMap == null) {
sqlBuilder.append(sql);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
if (StringUtils.isNotEmpty(sqlParameters.getTitle())) {
String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(),
ParamUtils.convert(paramsMap));
logger.info("SQL title : {}", title);
sqlParameters.setTitle(title);
}
sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime());
String rgex = "['\"]*\\$\\{(.*?)\\}['\"]*";
setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap);
String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*";
sql = replaceOriginalValue(sql, rgexo, paramsMap);
// r
String formatSql = sql.replaceAll(rgex, "?");
sqlBuilder.append(formatSql);
// p
printReplacedSql(sql, formatSql, rgex, sqlParamsMap);
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap);
}
private String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) {
Pattern pattern = Pattern.compile(rgex);
while (true) {
Matcher m = pattern.matcher(content); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.