status
stringclasses 1
value | repo_name
stringclasses 31
values | repo_url
stringclasses 31
values | issue_id
int64 1
104k
| title
stringlengths 4
233
| body
stringlengths 0
186k
⌀ | issue_url
stringlengths 38
56
| pull_url
stringlengths 37
54
| before_fix_sha
stringlengths 40
40
| after_fix_sha
stringlengths 40
40
| report_datetime
timestamp[us, tz=UTC] | language
stringclasses 5
values | commit_datetime
timestamp[us, tz=UTC] | updated_file
stringlengths 7
188
| chunk_content
stringlengths 1
1.03M
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | protected void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) {
response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
BufferedOutputStream buff = null;
ServletOutputStream out = null;
try {
out = response.getOutputStream();
buff = new BufferedOutputStream(out);
buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8));
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
}
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * get export process dag data
*
* @param processDefinition process definition
* @return DagDataSchedule
*/
public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode());
DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition));
if (scheduleObj != null) {
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
dagDataSchedule.setSchedule(scheduleObj);
}
return dagDataSchedule;
}
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
String dagDataScheduleJson = FileUtils.file2String(file);
List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class);
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_EXPORT); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (CollectionUtils.isEmpty(dagDataScheduleList)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
for (DagDataSchedule dagDataSchedule : dagDataScheduleList) {
if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule, EMPTY_STRING)) {
return result;
}
}
return result;
}
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_IMPORT);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename();
int index = processDefinitionName.lastIndexOf(".");
if (index > 0) {
processDefinitionName = processDefinitionName.substring(0, index);
}
processDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition processDefinition;
List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>();
List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>();
final int THRESHOLD_ENTRIES = 10000;
final int THRESHOLD_SIZE = 1000000000;
final double THRESHOLD_RATIO = 10;
int totalEntryArchive = 0;
int totalSizeEntry = 0;
Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Map<String, Long> taskNameToCode = new HashMap<>(16);
Map<String, List<String>> taskNameToUpstream = new HashMap<>(16);
try (ZipInputStream zIn = new ZipInputStream(file.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) {
processDefinition = new ProcessDefinition(projectCode,
processDefinitionName,
CodeGenerateUtils.getInstance().genCode(),
"",
"[]", null,
0, loginUser.getId(), loginUser.getTenantId());
ZipEntry entry;
while ((entry = zIn.getNextEntry()) != null) {
totalEntryArchive++;
int totalSizeArchive = 0;
if (!entry.isDirectory()) {
StringBuilder sql = new StringBuilder();
String taskName = null;
String datasourceName = null; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<String> upstreams = Collections.emptyList();
String line;
while ((line = bufferedReader.readLine()) != null) {
int nBytes = line.getBytes(StandardCharsets.UTF_8).length;
totalSizeEntry += nBytes;
totalSizeArchive += nBytes;
long compressionRatio = totalSizeEntry / entry.getCompressedSize();
if (compressionRatio > THRESHOLD_RATIO) {
throw new IllegalStateException("ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack");
}
int commentIndex = line.indexOf("-- ");
if (commentIndex >= 0) {
int colonIndex = line.indexOf(":", commentIndex);
if (colonIndex > 0) {
String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase();
String value = line.substring(colonIndex + 1).trim();
switch (key) {
case "name":
taskName = value;
line = line.substring(0, commentIndex);
break;
case "upstream":
upstreams = Arrays.stream(value.split(",")).map(String::trim)
.filter(s -> !"".equals(s)).collect(Collectors.toList());
line = line.substring(0, commentIndex);
break;
case "datasource":
datasourceName = value;
line = line.substring(0, commentIndex);
break; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | default:
break;
}
}
}
if (!"".equals(line)) {
sql.append(line).append("\n");
}
}
if (taskName == null) {
taskName = entry.getName();
index = taskName.indexOf("/");
if (index > 0) {
taskName = taskName.substring(index + 1);
}
index = taskName.lastIndexOf(".");
if (index > 0) {
taskName = taskName.substring(0, index);
}
}
DataSource dataSource = dataSourceCache.get(datasourceName);
if (dataSource == null) {
dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser);
}
if (dataSource == null) {
putMsg(result, Status.DATASOURCE_NAME_ILLEGAL);
return result;
}
dataSourceCache.put(datasourceName, dataSource); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1));
taskDefinitionList.add(taskDefinition);
taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode());
taskNameToUpstream.put(taskDefinition.getName(), upstreams);
}
if (totalSizeArchive > THRESHOLD_SIZE) {
throw new IllegalStateException("the uncompressed data size is too much for the application resource capacity");
}
if (totalEntryArchive > THRESHOLD_ENTRIES) {
throw new IllegalStateException("too much entries in this archive, can lead to inodes exhaustion of the system");
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return result;
}
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) {
List<String> upstreams = taskNameToUpstream.get(entry.getKey());
if (CollectionUtils.isEmpty(upstreams)
|| (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue());
processTaskRelationList.add(processTaskRelation);
continue;
}
for (String upstream : upstreams) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue());
processTaskRelationList.add(processTaskRelation);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING);
}
private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) {
ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog();
processTaskRelation.setPreTaskCode(preTaskCode);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPostTaskCode(postTaskCode);
processTaskRelation.setPostTaskVersion(0);
processTaskRelation.setConditionType(ConditionType.NONE);
processTaskRelation.setName("");
return processTaskRelation;
}
private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) {
if (isAdmin(loginUser)) {
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
if (CollectionUtils.isNotEmpty(dataSources)) {
return dataSources.get(0);
}
} else {
return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName);
}
return null;
}
private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException {
TaskDefinitionLog taskDefinition = new TaskDefinitionLog();
taskDefinition.setName(taskName);
taskDefinition.setFlag(Flag.YES);
SqlParameters sqlParameters = new SqlParameters();
sqlParameters.setType(dataSource.getType().name()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | sqlParameters.setDatasource(dataSource.getId());
sqlParameters.setSql(sql.substring(0, sql.length() - 1));
sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal());
sqlParameters.setLocalParams(Collections.emptyList());
taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters));
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
taskDefinition.setTaskType(TASK_TYPE_SQL);
taskDefinition.setFailRetryTimes(0);
taskDefinition.setFailRetryInterval(0);
taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE);
taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP);
taskDefinition.setTaskPriority(Priority.MEDIUM);
taskDefinition.setEnvironmentCode(-1);
taskDefinition.setTimeout(0);
taskDefinition.setDelayTime(0);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setVersion(0);
taskDefinition.setResourceIds("");
return taskDefinition;
}
/**
* check and import
*/
protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
String importProcessDefinitionName = processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp();
Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName);
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
processDefinition.setName(importProcessDefinitionName);
processDefinition.setId(0);
processDefinition.setProjectCode(projectCode);
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
taskDefinitionLog.setVersion(Constants.VERSION_FIRST); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | taskDefinitionLog.setCreateTime(now);
taskDefinitionLog.setUpdateTime(now);
taskDefinitionLog.setOperator(loginUser.getId());
taskDefinitionLog.setOperateTime(now);
try {
long code = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), code);
taskDefinitionLog.setCode(code);
} catch (CodeGenerateException e) {
logger.error("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
}
int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST);
processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST);
taskRelationLogList.add(processTaskRelationLog);
}
if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) {
ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations());
ArrayNode newArrayNode = JSONUtils.createArrayNode();
for (int i = 0; i < arrayNode.size(); i++) {
ObjectNode newObjectNode = newArrayNode.addObject();
JsonNode jsonNode = arrayNode.get(i);
Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong());
if (Objects.nonNull(taskCode)) {
newObjectNode.put("taskCode", taskCode);
newObjectNode.set("x", jsonNode.get("x"));
newObjectNode.set("y", jsonNode.get("y"));
}
}
processDefinition.setLocations(newArrayNode.toString());
}
processDefinition.setCreateTime(new Date());
processDefinition.setUpdateTime(new Date());
Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList(), otherParamsJson);
if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) {
putMsg(createDagResult, Status.SUCCESS);
} else {
result.putAll(createDagResult);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
Schedule schedule = dagDataSchedule.getSchedule(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | if (null != schedule) {
ProcessDefinition newProcessDefinition = processDefinitionMapper.queryByCode(processDefinition.getCode());
schedule.setProcessDefinitionCode(newProcessDefinition.getCode());
schedule.setUserId(loginUser.getId());
schedule.setCreateTime(now);
schedule.setUpdateTime(now);
int scheduleInsert = scheduleMapper.insert(schedule);
if (0 == scheduleInsert) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
processDefinitionName = processDefinition.getName() + "(" + num + ")";
}
} else {
return processDefinitionName;
}
return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1);
}
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
@Override
public Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogsList) {
Map<String, Object> result = new HashMap<>();
try {
if (processTaskRelationJson == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList);
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskNode.getType())
.taskParams(taskNode.getTaskParams())
.dependence(taskNode.getDependence())
.switchResult(taskNode.getSwitchResult())
.build())) {
logger.error("task node {} parameter invalid", taskNode.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage());
logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e);
}
return result;
}
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code process definition code
* @return task node list
*/
@Override
public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList());
putMsg(result, Status.SUCCESS);
return result;
}
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define codes
* @return task node list
*/
@Override
public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,null);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet);
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId()) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | .forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode);
List<DagData> dagDataList = processDefinitions.stream().map(processService::genDagData).collect(Collectors.toList());
result.put(Constants.DATA_LIST, dagDataList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by project code
*
* @param projectCode project code
* @return process definition list in the project
*/
@Override
public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) {
Map<String, Object> result = new HashMap<>();
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null);
result.put(Constants.DATA_LIST, processDefinitions);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition list by process definition code
*
* @param projectCode project code
* @param processDefinitionCode process definition code
* @return task definition list in the process definition
*/
@Override |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode) {
Map<String, Object> result = new HashMap<>();
Set<Long> definitionCodesSet = new HashSet<>();
definitionCodesSet.add(processDefinitionCode);
List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet);
List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode(
processDefinitions.get(0).getCode(),
processDefinitions.get(0).getVersion());
List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations);
List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) {
DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition();
dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode());
dependentSimplifyDefinition.setName(taskDefinitionLog.getName());
dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion());
taskDefinitionList.add(dependentSimplifyDefinition);
}
result.put(Constants.DATA_LIST, taskDefinitionList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | */
@Override
public Map<String, Object> viewTree(User loginUser,long projectCode, long code, Integer limit) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_TREE_VIEW);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances().add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (Stopper.isRunning()) {
Set<String> postNodeList;
Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry<String, List<TreeViewDto>> en = iter.next();
String nodeCode = en.getKey();
parentTreeViewDtoList = en.getValue();
TreeViewDto treeViewDto = new TreeViewDto();
TaskNode taskNode = dag.getNode(nodeCode);
treeViewDto.setType(taskNode.getType());
treeViewDto.setCode(taskNode.getCode());
treeViewDto.setName(taskNode.getName()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode));
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Long.parseLong(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
postNodeList = dag.getSubsequentNodes(nodeCode);
if (CollectionUtils.isNotEmpty(postNodeList)) {
for (String nextNodeCode : postNodeList) {
List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode);
if (CollectionUtils.isEmpty(treeViewDtoList)) {
treeViewDtoList = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
treeViewDtoList.add(treeViewDto);
waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList);
}
}
runningNodeMap.remove(nodeCode);
}
if (waitingRunningNodeMap.size() == 0) {
break;
} else {
runningNodeMap.putAll(waitingRunningNodeMap);
waitingRunningNodeMap.clear();
}
}
result.put(Constants.DATA_LIST, parentTreeViewDto);
result.put(Constants.STATUS, Status.SUCCESS);
result.put(Constants.MSG, Status.SUCCESS.getMsg());
return result;
}
/**
* whether the graph has a ring
*
* @param taskNodeResponseList task node response list
* @return if graph has cycle flag
*/
private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) {
DAG<String, TaskNode, String> graph = new DAG<>();
for (TaskNode taskNodeResponse : taskNodeResponseList) {
graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
for (TaskNode taskNodeResponse : taskNodeResponseList) {
List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class);
if (CollectionUtils.isNotEmpty(preTasks)) {
for (String preTask : preTasks) {
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) {
return true;
}
}
}
}
return graph.hasCycle();
}
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
public Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,WORKFLOW_BATCH_COPY);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true);
if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) {
return result;
}
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true);
return result;
}
/**
* batch move process definition
* Will be deleted
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode) {
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode,TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode,String perm) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,perm);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode,perm);
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) {
return targetResult;
}
}
return result;
}
protected void doBatchOperateProcessDefinition(User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | long targetProjectCode,
List<String> failedProcessList,
String processDefinitionCodes,
Map<String, Object> result,
boolean isCopy) {
Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet());
List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes);
Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet());
Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet());
diffCode.forEach(code -> failedProcessList.add(code + "[null]"));
for (ProcessDefinition processDefinition : processDefinitionList) {
List<ProcessTaskRelation> processTaskRelations =
processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode());
List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList());
processDefinition.setProjectCode(targetProjectCode);
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) {
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType());
return;
}
try {
long taskCode = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
taskDefinitionLog.setProjectCode(targetProjectCode);
taskDefinitionLog.setVersion(0);
taskDefinitionLog.setName(taskDefinitionLog.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPreTaskCode() > 0) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (processTaskRelationLog.getPostTaskCode() > 0) {
processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode()));
}
}
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(0);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp());
final Date date = new Date();
processDefinition.setCreateTime(date);
processDefinition.setUpdateTime(date);
if (StringUtils.isNotBlank(processDefinition.getLocations())) {
ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations());
for (int i = 0; i < jsonNodes.size(); i++) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ObjectNode node = (ObjectNode) jsonNodes.path(i);
node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong()));
jsonNodes.set(i, node);
}
processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes));
}
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null, Lists.newArrayList(), otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_SWITCH_TO_THIS_VERSION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR, processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
putMsg(result, Status.SUCCESS);
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
/**
* check batch operate result
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode, String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return the pagination process definition versions info of the certain process definition
*/
@Override
public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize, long code) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode,VERSION_LIST);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize);
Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinitionLog> processDefinitionVersionsPaging = processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode);
List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords();
pageInfo.setTotalList(processDefinitionLogs);
pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param code process definition code
* @param version version number |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return delete result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,VERSION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
if (processDefinition.getVersion() == version) {
putMsg(result, Status.MAIN_TABLE_USING_VERSION);
return result;
}
int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version);
int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version);
if (deleteLog == 0 || deleteRelationLog == 0) {
putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR);
}
deleteOtherRelation(project, result, processDefinition);
putMsg(result, Status.SUCCESS);
}
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | /**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_CREATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description,
globalParams, "", timeout, loginUser.getId(), tenantId);
processDefinition.setExecutionType(executionType);
result = createEmptyDagDefine(loginUser, processDefinition);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isBlank(scheduleJson)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | return result;
}
Map<String, Object> scheduleResult = createDagSchedule(loginUser, processDefinition, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> createEmptyDagDefine(User loginUser, ProcessDefinition processDefinition) {
Map<String, Object> result = new HashMap<>();
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
return result;
}
protected Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (scheduleObj == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
}
Date now = new Date(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | scheduleObj.setProcessDefinitionCode(processDefinition.getCode());
if (DateUtils.differSec(scheduleObj.getStartTime(), scheduleObj.getEndTime()) == 0) {
logger.warn("The start time must not be the same as the end");
putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME);
return result;
}
if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) {
logger.error("{} verify failure", scheduleObj.getCrontab());
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleObj.getCrontab());
return result;
}
scheduleObj.setWarningType(scheduleObj.getWarningType() == null ? WarningType.NONE : scheduleObj.getWarningType());
scheduleObj.setWarningGroupId(scheduleObj.getWarningGroupId() == 0 ? 1 : scheduleObj.getWarningGroupId());
scheduleObj.setFailureStrategy(scheduleObj.getFailureStrategy() == null ? FailureStrategy.CONTINUE : scheduleObj.getFailureStrategy());
scheduleObj.setCreateTime(now);
scheduleObj.setUpdateTime(now);
scheduleObj.setUserId(loginUser.getId());
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
scheduleObj.setProcessInstancePriority(scheduleObj.getProcessInstancePriority() == null ? Priority.MEDIUM : scheduleObj.getProcessInstancePriority());
scheduleObj.setWorkerGroup(scheduleObj.getWorkerGroup() == null ? "default" : scheduleObj.getWorkerGroup());
scheduleObj.setEnvironmentCode(scheduleObj.getEnvironmentCode() == null ? -1 : scheduleObj.getEnvironmentCode());
scheduleMapper.insert(scheduleObj);
putMsg(result, Status.SUCCESS);
result.put("scheduleId", scheduleObj.getId());
return result;
}
/**
* update process definition basic info
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param otherParamsJson otherParamsJson handle other params
* @param executionType executionType
* @return update result code
*/
@Override
@Transactional(rollbackFor = RuntimeException.class)
public Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | }
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | processDefinition.set(projectCode, name, description, globalParams, "", timeout, tenantId);
processDefinition.setExecutionType(executionType);
List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper.queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion());
result = updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, Lists.newArrayList(), otherParamsJson);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (StringUtils.isBlank(scheduleJson)) {
return result;
}
Map<String, Object> scheduleResult = updateDagSchedule(loginUser, projectCode, code, scheduleJson);
if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) {
Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS);
putMsg(result, scheduleResultStatus);
throw new ServiceException(scheduleResultStatus);
}
return result;
}
protected Map<String, Object> updateDagSchedule(User loginUser,
long projectCode,
long processDefinitionCode,
String scheduleJson) {
Map<String, Object> result = new HashMap<>();
Schedule schedule = JSONUtils.parseObject(scheduleJson, Schedule.class);
if (schedule == null) {
putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson);
throw new ServiceException(Status.DATA_IS_NOT_VALID);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | FailureStrategy failureStrategy = schedule.getFailureStrategy() == null ? FailureStrategy.CONTINUE : schedule.getFailureStrategy();
WarningType warningType = schedule.getWarningType() == null ? WarningType.NONE : schedule.getWarningType();
Priority processInstancePriority = schedule.getProcessInstancePriority() == null ? Priority.MEDIUM : schedule.getProcessInstancePriority();
int warningGroupId = schedule.getWarningGroupId() == 0 ? 1 : schedule.getWarningGroupId();
String workerGroup = schedule.getWorkerGroup() == null ? "default" : schedule.getWorkerGroup();
long environmentCode = schedule.getEnvironmentCode() == null ? -1 : schedule.getEnvironmentCode();
ScheduleParam param = new ScheduleParam();
param.setStartTime(schedule.getStartTime());
param.setEndTime(schedule.getEndTime());
param.setCrontab(schedule.getCrontab());
param.setTimezoneId(schedule.getTimezoneId());
return schedulerService.updateScheduleByProcessDefinitionCode(
loginUser,
projectCode,
processDefinitionCode,
JSONUtils.toJsonString(param),
warningType,
warningGroupId,
failureStrategy,
processInstancePriority,
workerGroup,
environmentCode);
}
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * @return update result code
*/
@Transactional(rollbackFor = RuntimeException.class)
@Override
public Map<String, Object> releaseWorkflowAndSchedule(User loginUser, long projectCode, long code, ReleaseState releaseState) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_ONLINE_OFFLINE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (null == releaseState) {
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code);
if (scheduleObj == null) {
putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, "processDefinitionCode:" + code);
return result;
}
switch (releaseState) {
case ONLINE:
List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion());
if (CollectionUtils.isEmpty(relationList)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
if (updateProcess > 0) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, scheduleObj.getId(), code);
scheduleObj.setReleaseState(ReleaseState.OFFLINE);
int updateSchedule = scheduleMapper.updateById(scheduleObj);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
schedulerService.deleteSchedule(project.getId(), scheduleObj.getId());
}
break;
default:
putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE);
return result;
}
putMsg(result, Status.SUCCESS);
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 8,855 | [Enhancement][API] Suggest support batch copy online process definitions. | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement.
### Description
If need to batch copy online process definitions,it should set the process definition offline,and then batch copy them.
Whether can support batch copy online process definitions?
<img width="400" alt="image" src="https://user-images.githubusercontent.com/15651066/158095998-aecc1ef8-4a1f-4e1f-8539-22a570552545.png">
### Use case
Whether can support batch copy online process definitions?
### Related issues
_No response_
### Are you willing to submit a PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
| https://github.com/apache/dolphinscheduler/issues/8855 | https://github.com/apache/dolphinscheduler/pull/10678 | 491d5001fcaf4f1e4cd16807375435282ea35aef | 4bbf3c8ea19cd4198d4b55aa2549d20ad70fb2ab | 2022-03-14T02:49:51Z | java | 2022-07-01T03:30:01Z | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java | * save other relation
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
@Override
public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result, String otherParamsJson) {
}
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
@Override
public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) {
return null;
}
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
@Override
public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) {
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/metrics/ProcessInstanceMetrics.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.metrics;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Timer;
public final class ProcessInstanceMetrics { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/metrics/ProcessInstanceMetrics.java | private ProcessInstanceMetrics() {
throw new UnsupportedOperationException("Utility class");
}
private static final Timer COMMAND_QUERY_TIMETER =
Timer.builder("ds.workflow.command.query.duration")
.description("Command query duration")
.register(Metrics.globalRegistry);
private static final Timer PROCESS_INSTANCE_GENERATE_TIMER =
Timer.builder("ds.workflow.instance.generate.duration")
.description("Process instance generated duration")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_SUBMIT_COUNTER =
Counter.builder("ds.workflow.instance.submit.count") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/metrics/ProcessInstanceMetrics.java | .description("Process instance submit total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_TIMEOUT_COUNTER =
Counter.builder("ds.workflow.instance.timeout.count")
.description("Process instance timeout total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_FINISH_COUNTER =
Counter.builder("ds.workflow.instance.finish.count")
.description("Process instance finish total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_SUCCESS_COUNTER =
Counter.builder("ds.workflow.instance.success.count")
.description("Process instance success total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_FAILURE_COUNTER =
Counter.builder("ds.workflow.instance.failure.count")
.description("Process instance failure total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_STOP_COUNTER =
Counter.builder("ds.workflow.instance.stop.count")
.description("Process instance stop total count")
.register(Metrics.globalRegistry);
private static final Counter PROCESS_INSTANCE_FAILOVER_COUNTER =
Counter.builder("ds.workflow.instance.failover.count")
.description("Process instance failover total count")
.register(Metrics.globalRegistry);
public static void recordCommandQueryTime(long milliseconds) {
COMMAND_QUERY_TIMETER.record(milliseconds, TimeUnit.MILLISECONDS);
}
public static void recordProcessInstanceGenerateTime(long milliseconds) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/metrics/ProcessInstanceMetrics.java | PROCESS_INSTANCE_GENERATE_TIMER.record(milliseconds, TimeUnit.MILLISECONDS);
}
public static synchronized void registerProcessInstanceRunningGauge(Supplier<Number> function) {
Gauge.builder("ds.workflow.instance.running", function)
.description("The current running process instance count")
.register(Metrics.globalRegistry);
}
public static void incProcessInstanceSubmit() {
PROCESS_INSTANCE_SUBMIT_COUNTER.increment();
}
public static void incProcessInstanceTimeout() {
PROCESS_INSTANCE_TIMEOUT_COUNTER.increment();
}
public static void incProcessInstanceFinish() {
PROCESS_INSTANCE_FINISH_COUNTER.increment();
}
public static void incProcessInstanceSuccess() {
PROCESS_INSTANCE_SUCCESS_COUNTER.increment();
}
public static void incProcessInstanceFailure() {
PROCESS_INSTANCE_FAILURE_COUNTER.increment();
}
public static void incProcessInstanceStop() {
PROCESS_INSTANCE_STOP_COUNTER.increment();
}
public static void incProcessInstanceFailover() {
PROCESS_INSTANCE_FAILOVER_COUNTER.increment();
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.SlotCheckState;
import org.apache.dolphinscheduler.service.expand.CuringParamsService;
import org.apache.dolphinscheduler.common.thread.BaseDaemonThread;
import org.apache.dolphinscheduler.common.thread.Stopper; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | import org.apache.dolphinscheduler.common.thread.ThreadUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.common.utils.NetUtils;
import org.apache.dolphinscheduler.common.utils.OSUtils;
import org.apache.dolphinscheduler.dao.entity.Command;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.remote.NettyRemotingClient;
import org.apache.dolphinscheduler.remote.config.NettyClientConfig;
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
import org.apache.dolphinscheduler.server.master.metrics.MasterServerMetrics;
import org.apache.dolphinscheduler.server.master.metrics.ProcessInstanceMetrics;
import org.apache.dolphinscheduler.server.master.registry.ServerNodeManager;
import org.apache.dolphinscheduler.service.alert.ProcessAlertManager;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ThreadPoolExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* Master scheduler thread, this thread will consume the commands from database and trigger processInstance executed.
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | public class MasterSchedulerService extends BaseDaemonThread {
/**
* logger of MasterSchedulerService
*/
private static final Logger logger = LoggerFactory.getLogger(MasterSchedulerService.class);
@Autowired
private ProcessService processService;
@Autowired
private MasterConfig masterConfig; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | @Autowired
private ProcessAlertManager processAlertManager;
private NettyRemotingClient nettyRemotingClient;
@Autowired
private NettyExecutorManager nettyExecutorManager;
/**
* master prepare exec service
*/
private ThreadPoolExecutor masterPrepareExecService;
/**
* workflow exec service
*/
@Autowired
private WorkflowExecuteThreadPool workflowExecuteThreadPool;
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
@Autowired
private StateWheelExecuteThread stateWheelExecuteThread;
@Autowired
private CuringParamsService curingGlobalParamsService;
private String masterAddress;
protected MasterSchedulerService() {
super("MasterCommandLoopThread");
}
/**
* constructor of MasterSchedulerService
*/
public void init() {
this.masterPrepareExecService = (ThreadPoolExecutor) ThreadUtils.newDaemonFixedThreadExecutor("MasterPreExecThread", masterConfig.getPreExecThreads());
NettyClientConfig clientConfig = new NettyClientConfig(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | this.nettyRemotingClient = new NettyRemotingClient(clientConfig);
this.masterAddress = NetUtils.getAddr(masterConfig.getListenPort());
}
@Override
public synchronized void start() {
logger.info("Master schedule service starting..");
this.stateWheelExecuteThread.start();
super.start();
logger.info("Master schedule service started...");
}
public void close() {
logger.info("Master schedule service stopping...");
nettyRemotingClient.close();
logger.info("Master schedule service stopped...");
}
/**
* run of MasterSchedulerService
*/
@Override
public void run() {
while (Stopper.isRunning()) {
try {
boolean isOverload = OSUtils.isOverload(masterConfig.getMaxCpuLoadAvg(), masterConfig.getReservedMemory());
if (isOverload) {
MasterServerMetrics.incMasterOverload();
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
continue;
}
scheduleWorkflow();
} catch (InterruptedException interruptedException) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | logger.warn("Master schedule service interrupted, close the loop", interruptedException);
Thread.currentThread().interrupt();
break;
} catch (Exception e) {
logger.error("Master schedule service loop command error", e);
}
}
}
/**
* Query command from database by slot, and transform to workflow instance, then submit to workflowExecuteThreadPool.
*/
private void scheduleWorkflow() throws InterruptedException {
List<Command> commands = findCommands();
if (CollectionUtils.isEmpty(commands)) {
Thread.sleep(Constants.SLEEP_TIME_MILLIS);
return;
}
List<ProcessInstance> processInstances = command2ProcessInstance(commands);
if (CollectionUtils.isEmpty(processInstances)) {
return;
}
MasterServerMetrics.incMasterConsumeCommand(commands.size());
for (ProcessInstance processInstance : processInstances) {
try {
LoggerUtils.setWorkflowInstanceIdMDC(processInstance.getId());
logger.info("Master schedule service starting workflow instance");
final WorkflowExecuteRunnable workflowExecuteRunnable = new WorkflowExecuteRunnable(
processInstance
, processService |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | , nettyExecutorManager
, processAlertManager
, masterConfig
, stateWheelExecuteThread
, curingGlobalParamsService);
this.processInstanceExecCacheManager.cache(processInstance.getId(), workflowExecuteRunnable);
if (processInstance.getTimeout() > 0) {
stateWheelExecuteThread.addProcess4TimeoutCheck(processInstance);
}
ProcessInstanceMetrics.incProcessInstanceSubmit();
workflowExecuteThreadPool.submit(workflowExecuteRunnable);
logger.info("Master schedule service started workflow instance");
} catch (Exception ex) {
processInstanceExecCacheManager.removeByProcessInstanceId(processInstance.getId());
stateWheelExecuteThread.removeProcess4TimeoutCheck(processInstance.getId());
logger.info("Master submit workflow to thread pool failed, will remove workflow runnable from cache manager", ex);
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
}
private List<ProcessInstance> command2ProcessInstance(List<Command> commands) throws InterruptedException {
long commandTransformStartTime = System.currentTimeMillis();
logger.info("Master schedule service transforming command to ProcessInstance, commandSize: {}", commands.size());
List<ProcessInstance> processInstances = Collections.synchronizedList(new ArrayList<>(commands.size()));
CountDownLatch latch = new CountDownLatch(commands.size());
for (final Command command : commands) {
masterPrepareExecService.execute(() -> {
try { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | SlotCheckState slotCheckState = slotCheck(command);
if (slotCheckState.equals(SlotCheckState.CHANGE) || slotCheckState.equals(SlotCheckState.INJECT)) {
logger.info("Master handle command {} skip, slot check state: {}", command.getId(), slotCheckState);
return;
}
ProcessInstance processInstance = processService.handleCommand(masterAddress, command);
if (processInstance != null) {
processInstances.add(processInstance);
logger.info("Master handle command {} end, create process instance {}", command.getId(), processInstance.getId());
}
} catch (Exception e) {
logger.error("Master handle command {} error ", command.getId(), e);
processService.moveToErrorCommand(command, e.toString());
} finally {
latch.countDown();
}
});
}
latch.await();
logger.info("Master schedule service transformed command to ProcessInstance, commandSize: {}, processInstanceSize: {}",
commands.size(), processInstances.size());
ProcessInstanceMetrics.recordProcessInstanceGenerateTime(System.currentTimeMillis() - commandTransformStartTime);
return processInstances;
}
private List<Command> findCommands() {
long scheduleStartTime = System.currentTimeMillis();
int thisMasterSlot = ServerNodeManager.getSlot(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/MasterSchedulerService.java | int masterCount = ServerNodeManager.getMasterSize();
if (masterCount <= 0) {
logger.warn("Master count: {} is invalid, the current slot: {}", masterCount, thisMasterSlot);
return Collections.emptyList();
}
int pageNumber = 0;
int pageSize = masterConfig.getFetchCommandNum();
final List<Command> result = processService.findCommandPageBySlot(pageSize, pageNumber, masterCount, thisMasterSlot);
if (CollectionUtils.isNotEmpty(result)) {
logger.info("Master schedule service loop command success, command size: {}, current slot: {}, total slot size: {}",
result.size(), thisMasterSlot, masterCount);
}
ProcessInstanceMetrics.recordCommandQueryTime(System.currentTimeMillis() - scheduleStartTime);
return result;
}
private SlotCheckState slotCheck(Command command) {
int slot = ServerNodeManager.getSlot();
int masterSize = ServerNodeManager.getMasterSize();
SlotCheckState state;
if (masterSize <= 0) {
state = SlotCheckState.CHANGE;
} else if (command.getId() % masterSize == slot) {
state = SlotCheckState.PASS;
} else {
state = SlotCheckState.INJECT;
}
return state;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.runner;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.StateEvent; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | import org.apache.dolphinscheduler.common.enums.StateEventType;
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
import org.apache.dolphinscheduler.common.thread.BaseDaemonThread;
import org.apache.dolphinscheduler.common.thread.Stopper;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.LoggerUtils;
import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.plugin.task.api.enums.ExecutionStatus;
import org.apache.dolphinscheduler.server.master.cache.ProcessInstanceExecCacheManager;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.master.runner.task.TaskInstanceKey;
import org.apache.commons.lang3.ThreadUtils;
import java.time.Duration;
import java.util.Optional;
import java.util.concurrent.ConcurrentLinkedQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import lombok.NonNull;
/**
* Check thread
* 1. timeout task check
* 2. dependent task state check
* 3. retry task check
* 4. timeout process check
*/
@Component |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | public class StateWheelExecuteThread extends BaseDaemonThread {
private static final Logger logger = LoggerFactory.getLogger(StateWheelExecuteThread.class);
/**
* ProcessInstance timeout check list, element is the processInstanceId.
*/
private final ConcurrentLinkedQueue<Integer> processInstanceTimeoutCheckList = new ConcurrentLinkedQueue<>();
/**
* task time out check list
*/
private final ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceTimeoutCheckList = new ConcurrentLinkedQueue<>();
/**
* task retry check list
*/
private final ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceRetryCheckList = new ConcurrentLinkedQueue<>();
/**
* task state check list
*/
private final ConcurrentLinkedQueue<TaskInstanceKey> taskInstanceStateCheckList = new ConcurrentLinkedQueue<>();
@Autowired
private MasterConfig masterConfig;
@Autowired
private WorkflowExecuteThreadPool workflowExecuteThreadPool;
@Autowired
private ProcessInstanceExecCacheManager processInstanceExecCacheManager;
protected StateWheelExecuteThread() {
super("StateWheelExecuteThread");
}
@Override
public void run() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | Duration checkInterval = masterConfig.getStateWheelInterval();
while (Stopper.isRunning()) {
try {
checkTask4Timeout();
checkTask4Retry();
checkTask4State();
checkProcess4Timeout();
} catch (Exception e) {
logger.error("state wheel thread check error:", e);
}
try {
ThreadUtils.sleep(checkInterval);
} catch (InterruptedException e) {
logger.error("state wheel thread sleep error", e);
}
}
}
public void addProcess4TimeoutCheck(ProcessInstance processInstance) {
processInstanceTimeoutCheckList.add(processInstance.getId());
logger.info("Success add workflow instance into timeout check list");
}
public void removeProcess4TimeoutCheck(int processInstanceId) {
boolean removeFlag = processInstanceTimeoutCheckList.remove(processInstanceId);
if (removeFlag) {
logger.info("Success remove workflow instance from timeout check list");
} else {
logger.warn("Failed to remove workflow instance from timeout check list");
}
}
private void checkProcess4Timeout() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | if (processInstanceTimeoutCheckList.isEmpty()) {
return;
}
for (Integer processInstanceId : processInstanceTimeoutCheckList) {
WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId);
if (workflowExecuteThread == null) {
logger.warn("Check workflow timeout failed, can not find workflowExecuteThread from cache manager, will remove this workflowInstance from check list");
processInstanceTimeoutCheckList.remove(processInstanceId);
continue;
}
ProcessInstance processInstance = workflowExecuteThread.getProcessInstance();
if (processInstance == null) {
logger.warn("Check workflow timeout failed, the workflowInstance is null");
continue;
}
long timeRemain = DateUtils.getRemainTime(processInstance.getStartTime(), (long) processInstance.getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT);
if (timeRemain < 0) {
logger.info("Workflow instance timeout, adding timeout event");
addProcessTimeoutEvent(processInstance);
processInstanceTimeoutCheckList.remove(processInstance.getId());
logger.info("Workflow instance timeout, added timeout event");
}
}
}
public void addTask4TimeoutCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
logger.info("Adding task instance into timeout check list");
if (taskInstanceTimeoutCheckList.contains(taskInstanceKey)) {
logger.warn("Task instance is already in timeout check list");
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | }
TaskDefinition taskDefinition = taskInstance.getTaskDefine();
if (taskDefinition == null) {
logger.error("Failed to add task instance into timeout check list, taskDefinition is null");
return;
}
if (TimeoutFlag.OPEN == taskDefinition.getTimeoutFlag()) {
taskInstanceTimeoutCheckList.add(taskInstanceKey);
logger.info("Timeout flag is open, added task instance into timeout check list");
}
if (taskInstance.isDependTask() || taskInstance.isSubProcess()) {
taskInstanceTimeoutCheckList.add(taskInstanceKey);
logger.info("task instance is dependTask orSubProcess, added task instance into timeout check list");
}
}
public void removeTask4TimeoutCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
taskInstanceTimeoutCheckList.remove(taskInstanceKey);
logger.info("remove task instance from timeout check list");
}
public void addTask4RetryCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
logger.info("Adding task instance into retry check list");
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
if (taskInstanceRetryCheckList.contains(taskInstanceKey)) {
logger.warn("Task instance is already in retry check list");
return;
}
TaskDefinition taskDefinition = taskInstance.getTaskDefine();
if (taskDefinition == null) {
logger.error("Add task instance into retry check list error, taskDefinition is null"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | return;
}
taskInstanceRetryCheckList.add(taskInstanceKey);
logger.info("[WorkflowInstance-{}][TaskInstance-{}] Added task instance into retry check list",
processInstance.getId(), taskInstance.getId());
}
public void removeTask4RetryCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
taskInstanceRetryCheckList.remove(taskInstanceKey);
logger.info("remove task instance from retry check list");
}
public void addTask4StateCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
logger.info("Adding task instance into state check list");
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
if (taskInstanceStateCheckList.contains(taskInstanceKey)) {
logger.warn("Task instance is already in state check list");
return;
}
if (taskInstance.isDependTask() || taskInstance.isSubProcess()) {
taskInstanceStateCheckList.add(taskInstanceKey);
logger.info("Added task instance into state check list");
}
}
public void removeTask4StateCheck(@NonNull ProcessInstance processInstance, @NonNull TaskInstance taskInstance) {
TaskInstanceKey taskInstanceKey = TaskInstanceKey.getTaskInstanceKey(processInstance, taskInstance);
taskInstanceStateCheckList.remove(taskInstanceKey);
logger.info("Removed task instance from state check list");
}
private void checkTask4Timeout() {
if (taskInstanceTimeoutCheckList.isEmpty()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | return;
}
for (TaskInstanceKey taskInstanceKey : taskInstanceTimeoutCheckList) {
try {
int processInstanceId = taskInstanceKey.getProcessInstanceId();
LoggerUtils.setWorkflowInstanceIdMDC(processInstanceId);
long taskCode = taskInstanceKey.getTaskCode();
WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId);
if (workflowExecuteThread == null) {
logger.warn("Check task instance timeout failed, can not find workflowExecuteThread from cache manager, will remove this check task");
taskInstanceTimeoutCheckList.remove(taskInstanceKey);
continue;
}
Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getActiveTaskInstanceByTaskCode(taskCode);
if (!taskInstanceOptional.isPresent()) {
logger.warn("Check task instance timeout failed, can not get taskInstance from workflowExecuteThread, taskCode: {}"
+ "will remove this check task", taskCode);
taskInstanceTimeoutCheckList.remove(taskInstanceKey);
continue;
}
TaskInstance taskInstance = taskInstanceOptional.get();
if (TimeoutFlag.OPEN == taskInstance.getTaskDefine().getTimeoutFlag()) {
long timeRemain = DateUtils.getRemainTime(taskInstance.getStartTime(), (long) taskInstance.getTaskDefine().getTimeout() * Constants.SEC_2_MINUTES_TIME_UNIT);
if (timeRemain < 0) {
logger.info("Task instance is timeout, adding task timeout event and remove the check");
addTaskTimeoutEvent(taskInstance);
taskInstanceTimeoutCheckList.remove(taskInstanceKey);
}
}
} finally { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
}
private void checkTask4Retry() {
if (taskInstanceRetryCheckList.isEmpty()) {
return;
}
for (TaskInstanceKey taskInstanceKey : taskInstanceRetryCheckList) {
int processInstanceId = taskInstanceKey.getProcessInstanceId();
long taskCode = taskInstanceKey.getTaskCode();
try {
LoggerUtils.setWorkflowInstanceIdMDC(processInstanceId);
WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId);
if (workflowExecuteThread == null) {
logger.warn("Task instance retry check failed, can not find workflowExecuteThread from cache manager, "
+ "will remove this check task");
taskInstanceRetryCheckList.remove(taskInstanceKey);
continue;
}
Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getRetryTaskInstanceByTaskCode(taskCode);
ProcessInstance processInstance = workflowExecuteThread.getProcessInstance();
if (processInstance.getState() == ExecutionStatus.READY_STOP) {
logger.warn("The process instance is ready to stop, will send process stop event and remove the check task");
addProcessStopEvent(processInstance);
taskInstanceRetryCheckList.remove(taskInstanceKey);
break;
}
if (!taskInstanceOptional.isPresent()) {
logger.warn("Task instance retry check failed, can not find taskInstance from workflowExecuteThread, will remove this check"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | taskInstanceRetryCheckList.remove(taskInstanceKey);
continue;
}
TaskInstance taskInstance = taskInstanceOptional.get();
if (taskInstance.retryTaskIntervalOverTime()) {
taskInstance.setEndTime(null);
taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS);
addTaskRetryEvent(taskInstance);
taskInstanceRetryCheckList.remove(taskInstanceKey);
}
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
}
private void checkTask4State() {
if (taskInstanceStateCheckList.isEmpty()) {
return;
}
for (TaskInstanceKey taskInstanceKey : taskInstanceStateCheckList) {
int processInstanceId = taskInstanceKey.getProcessInstanceId();
long taskCode = taskInstanceKey.getTaskCode();
try {
LoggerUtils.setTaskInstanceIdMDC(processInstanceId);
WorkflowExecuteRunnable workflowExecuteThread = processInstanceExecCacheManager.getByProcessInstanceId(processInstanceId);
if (workflowExecuteThread == null) {
logger.warn("Task instance state check failed, can not find workflowExecuteThread from cache manager, will remove this check task");
taskInstanceStateCheckList.remove(taskInstanceKey); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | continue;
}
Optional<TaskInstance> taskInstanceOptional = workflowExecuteThread.getActiveTaskInstanceByTaskCode(taskCode);
if (!taskInstanceOptional.isPresent()) {
logger.warn(
"Task instance state check failed, can not find taskInstance from workflowExecuteThread, will remove this check event");
taskInstanceStateCheckList.remove(taskInstanceKey);
continue;
}
TaskInstance taskInstance = taskInstanceOptional.get();
if (taskInstance.getState().typeIsFinished()) {
continue;
}
addTaskStateChangeEvent(taskInstance);
} finally {
LoggerUtils.removeWorkflowInstanceIdMDC();
}
}
}
private void addTaskStateChangeEvent(TaskInstance taskInstance) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_STATE_CHANGE);
stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setTaskCode(taskInstance.getTaskCode());
stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION);
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
private void addProcessStopEvent(ProcessInstance processInstance) {
StateEvent stateEvent = new StateEvent(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/StateWheelExecuteThread.java | stateEvent.setType(StateEventType.PROCESS_STATE_CHANGE);
stateEvent.setProcessInstanceId(processInstance.getId());
stateEvent.setExecutionStatus(ExecutionStatus.STOP);
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
private void addTaskRetryEvent(TaskInstance taskInstance) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_RETRY);
stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setTaskCode(taskInstance.getTaskCode());
stateEvent.setExecutionStatus(ExecutionStatus.RUNNING_EXECUTION);
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
private void addTaskTimeoutEvent(TaskInstance taskInstance) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.TASK_TIMEOUT);
stateEvent.setProcessInstanceId(taskInstance.getProcessInstanceId());
stateEvent.setTaskInstanceId(taskInstance.getId());
stateEvent.setTaskCode(taskInstance.getTaskCode());
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
private void addProcessTimeoutEvent(ProcessInstance processInstance) {
StateEvent stateEvent = new StateEvent();
stateEvent.setType(StateEventType.PROCESS_TIMEOUT);
stateEvent.setProcessInstanceId(processInstance.getId());
workflowExecuteThreadPool.submitStateEvent(stateEvent);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | /*
* Lcensed to the Apache Software Foundaton (ASF) under one or more
* contrbutor lcense agreements. See the NOTICE fle dstrbuted wth
* ths work for addtonal nformaton regardng copyrght ownershp. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * 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.
*/
package org.apache.dolphnscheduler.server.master.runner;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST;
mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODES;
mport statc org.apache.dolphnscheduler.common.Constants.COMMA;
mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP;
mport statc org.apache.dolphnscheduler.common.Constants.YYYY_MM_DD_HH_MM_SS;
mport statc org.apache.dolphnscheduler.plugn.task.ap.TaskConstants.TASK_TYPE_BLOCKING;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.DataType.VARCHAR;
mport statc org.apache.dolphnscheduler.plugn.task.ap.enums.Drect.IN;
mport org.apache.dolphnscheduler.common.Constants;
mport org.apache.dolphnscheduler.common.enums.CommandType;
mport org.apache.dolphnscheduler.common.enums.FalureStrategy;
mport org.apache.dolphnscheduler.common.enums.Flag;
mport org.apache.dolphnscheduler.common.enums.Prorty; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | 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.TmeoutFlag;
mport org.apache.dolphnscheduler.servce.expand.CurngParamsServce;
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.utls.DateUtls;
mport org.apache.dolphnscheduler.common.utls.JSONUtls;
mport org.apache.dolphnscheduler.common.utls.LoggerUtls;
mport org.apache.dolphnscheduler.common.utls.NetUtls;
mport org.apache.dolphnscheduler.dao.entty.Command;
mport org.apache.dolphnscheduler.dao.entty.Envronment;
mport org.apache.dolphnscheduler.dao.entty.ProcessDefnton;
mport org.apache.dolphnscheduler.dao.entty.ProcessInstance;
mport org.apache.dolphnscheduler.dao.entty.ProcessTaskRelaton;
mport org.apache.dolphnscheduler.dao.entty.ProjectUser;
mport org.apache.dolphnscheduler.dao.entty.Schedule;
mport org.apache.dolphnscheduler.dao.entty.TaskDefntonLog;
mport org.apache.dolphnscheduler.dao.entty.TaskGroupQueue;
mport org.apache.dolphnscheduler.dao.entty.TaskInstance;
mport org.apache.dolphnscheduler.dao.utls.DagHelper;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.DependResult;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.Drect;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.ExecutonStatus;
mport org.apache.dolphnscheduler.plugn.task.ap.enums.TaskTmeoutStrategy;
mport org.apache.dolphnscheduler.plugn.task.ap.model.Property; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | mport org.apache.dolphnscheduler.plugn.task.ap.parameters.BlockngParameters;
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.metrcs.ProcessInstanceMetrcs;
mport org.apache.dolphnscheduler.server.master.metrcs.TaskMetrcs;
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.corn.CronUtls;
mport org.apache.dolphnscheduler.servce.process.ProcessServce;
mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue;
mport org.apache.commons.collectons.CollectonUtls;
mport org.apache.commons.lang3.StrngUtls;
mport org.apache.commons.lang3.math.NumberUtls;
mport java.utl.ArrayLst;
mport java.utl.Arrays;
mport java.utl.Collecton;
mport java.utl.Date;
mport java.utl.HashMap;
mport java.utl.HashSet;
mport java.utl.Iterator;
mport java.utl.Lst;
mport java.utl.Map;
mport java.utl.Objects;
mport java.utl.Optonal;
mport java.utl.Set;
mport java.utl.concurrent.ConcurrentHashMap; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | 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;
/**
* Workflow execute task, used to execute a workflow nstance.
*/
publc class WorkflowExecuteRunnable mplements Runnable {
/**
* logger of WorkflowExecuteThread
*/
prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteRunnable.class);
/**
* master confg
*/
prvate fnal MasterConfg masterConfg;
/**
* process servce
*/
prvate fnal ProcessServce processServce;
/**
* alert manager
*/
prvate fnal ProcessAlertManager processAlertManager;
/**
* netty executor manager
*/
prvate fnal NettyExecutorManager nettyExecutorManager;
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * 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;
/**
* task nstance hash map, taskId as key
*/
prvate fnal Map<Integer, TaskInstance> taskInstanceMap = new ConcurrentHashMap<>();
/**
* runnng taskProcessor, taskCode as key, taskProcessor as value
* only on taskProcessor per taskCode |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | */
prvate fnal Map<Long, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>();
/**
* vald task map, taskCode as key, taskId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> valdTaskMap = new ConcurrentHashMap<>();
/**
* error task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> errorTaskMap = new ConcurrentHashMap<>();
/**
* complete task map, taskCode as key, taskInstanceId as value
* n a DAG, only one taskInstance per taskCode s vald
*/
prvate fnal Map<Long, Integer> completeTaskMap = new ConcurrentHashMap<>();
/**
* depend faled task map, taskCode as key, taskId as value
*/
prvate fnal Map<Long, Integer> dependFaledTaskMap = new ConcurrentHashMap<>();
/**
* forbdden task map, code as key
*/
prvate fnal Map<Long, TaskNode> forbddenTaskMap = new ConcurrentHashMap<>();
/**
* skp task map, code as key
*/
prvate fnal Map<Strng, TaskNode> skpTaskNodeMap = new ConcurrentHashMap<>();
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * complement date lst
*/
prvate Lst<Date> complementLstDate = Lsts.newLnkedLst();
/**
* state event queue
*/
prvate fnal ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>();
/**
* ready to submt task queue
*/
prvate fnal PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue();
/**
* wat to retry taskInstance map, taskCode as key, taskInstance as value
* before retry, the taskInstance d s 0
*/
prvate fnal Map<Long, TaskInstance> watToRetryTaskInstanceMap = new ConcurrentHashMap<>();
/**
* state wheel execute thread
*/
prvate fnal StateWheelExecuteThread stateWheelExecuteThread;
/**
* curng global params servce
*/
prvate fnal CurngParamsServce curngParamsServce;
/**
* @param processInstance processInstance
* @param processServce processServce
* @param nettyExecutorManager nettyExecutorManager
* @param processAlertManager processAlertManager
* @param masterConfg masterConfg |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | * @param stateWheelExecuteThread stateWheelExecuteThread
*/
publc WorkflowExecuteRunnable(ProcessInstance processInstance
, ProcessServce processServce
, NettyExecutorManager nettyExecutorManager
, ProcessAlertManager processAlertManager
, MasterConfg masterConfg
, StateWheelExecuteThread stateWheelExecuteThread
, CurngParamsServce curngParamsServce) {
ths.processServce = processServce;
ths.processInstance = processInstance;
ths.masterConfg = masterConfg;
ths.nettyExecutorManager = nettyExecutorManager;
ths.processAlertManager = processAlertManager;
ths.stateWheelExecuteThread = stateWheelExecuteThread;
ths.curngParamsServce = curngParamsServce;
TaskMetrcs.regsterTaskPrepared(readyToSubmtTaskQueue::sze);
}
/**
* the process start nodes are submtted completely.
*/
publc boolean sStart() {
return ths.sStart;
}
/**
* handle event
*/
publc vod handleEvents() {
f (!sStart) {
return; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
whle (!ths.stateEvents.sEmpty()) {
try {
StateEvent stateEvent = ths.stateEvents.peek();
LoggerUtls.setWorkflowAndTaskInstanceIDMDC(stateEvent.getProcessInstanceId(), stateEvent.getTaskInstanceId());
f (stateEventHandler(stateEvent)) {
ths.stateEvents.remove(stateEvent);
}
} catch (Excepton e) {
logger.error("state handle error:", e);
} fnally {
LoggerUtls.removeWorkflowAndTaskInstanceIdMDC();
}
}
}
publc Strng getKey() {
f (StrngUtls.sNotEmpty(key)
|| ths.processDefnton == null) {
return key;
}
key = Strng.format("%d_%d_%d",
ths.processDefnton.getCode(),
ths.processDefnton.getVerson(),
ths.processInstance.getId());
return key;
}
publc boolean addStateEvent(StateEvent stateEvent) {
f (processInstance.getId() != stateEvent.getProcessInstanceId()) {
logger.nfo("state event would be abounded :{}", stateEvent);
return false; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
ths.stateEvents.add(stateEvent);
return true;
}
publc nt eventSze() {
return ths.stateEvents.sze();
}
publc ProcessInstance getProcessInstance() {
return ths.processInstance;
}
prvate boolean stateEventHandler(StateEvent stateEvent) {
logger.nfo("process event: {}", stateEvent);
f (!checkProcessInstance(stateEvent)) {
return false;
}
boolean result = false;
swtch (stateEvent.getType()) {
case PROCESS_STATE_CHANGE:
measureProcessState(stateEvent);
result = pr
break;
case TASK_STATE_CHANGE:
measureTaskState(stateEvent);
result = taskStateChangeHandler(stateEvent);
break;
case PROCESS_TIMEOUT:
ProcessInstanceMetrcs.ncProcessInstanceTmeout();
result = processTmeout();
break;
case TASK_TIMEOUT: |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | TaskMetrcs.ncTaskTmeout();
result = taskTmeout(stateEvent);
break;
case WAIT_TASK_GROUP:
result = checkForceStartAndWakeUp(stateEvent);
break;
case TASK_RETRY:
TaskMetrcs.ncTaskRetry();
result = taskRetryEventHandler(stateEvent);
break;
case PROCESS_BLOCKED:
result = processBlockHandler(stateEvent);
break;
default:
break;
}
f (result) {
ths.stateEvents.remove(stateEvent);
}
return result;
}
prvate boolean checkForceStartAndWakeUp(StateEvent stateEvent) {
TaskGroupQueue taskGroupQueue = ths.processServce.loadTaskGroupQueue(stateEvent.getTaskInstanceId());
f (taskGroupQueue.getForceStart() == Flag.YES.getCode()) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
ths.processServce.updateTaskGroupQueueStatus(taskGroupQueue.getTaskId(), TaskGroupQueueStatus.ACQUIRE_SUCCESS.getCode());
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (taskGroupQueue.getInQueue() == Flag.YES.getCode()) {
boolean acqureTaskGroup = processServce.acqureTaskGroupAgan(taskGroupQueue);
f (acqureTaskGroup) {
TaskInstance taskInstance = ths.processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId());
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.DISPATCH);
return true;
}
}
return false;
}
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();
f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy || TaskTmeoutStrategy.WARNFAILED == taskTmeoutStrategy) {
ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(taskInstance.getTaskCode());
taskProcessor.acton(TaskActon.TIMEOUT);
}
f (TaskTmeoutStrategy.WARN == taskTmeoutStrategy || TaskTmeoutStrategy.WARNFAILED == taskTmeoutStrategy) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, projectUser);
}
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | prvate boolean processTmeout() {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, projectUser);
return true;
}
prvate boolean taskStateChangeHandler(StateEvent stateEvent) {
f (!checkTaskInstanceByStateEvent(stateEvent)) {
return true;
}
Optonal<TaskInstance> taskInstanceOptonal = getTaskInstance(stateEvent.getTaskInstanceId());
TaskInstance task = taskInstanceOptonal.orElseThrow(
() -> new RuntmeExcepton("Cannot fnd task nstance by task nstance d: " + stateEvent.getTaskInstanceId()));
f (task.getState() == null) {
logger.error("task state s null, state handler error: {}", stateEvent);
return true;
}
f (task.getState().typeIsFnshed()) {
f (completeTaskMap.contansKey(task.getTaskCode()) && completeTaskMap.get(task.getTaskCode()) == task.getId()) {
logger.warn("The task nstance s already complete, stateEvent: {}", stateEvent);
return true;
}
taskFnshed(task);
f (task.getTaskGroupId() > 0) {
releaseTaskGroup(task);
}
return true;
}
f (actveTaskProcessorMaps.contansKey(task.getTaskCode())) {
ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(task.getTaskCode());
TaskProcessor.acton(TaskActon.RUN); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (TaskProcessor.taskInstance().getState().typeIsFnshed()) {
f (TaskProcessor.taskInstance().getState() != task.getState()) {
task.setState(TaskProcessor.taskInstance().getState());
}
taskFnshed(task);
}
return true;
}
logger.error("state handler error: {}", stateEvent);
return true;
}
prvate vod taskFnshed(TaskInstance taskInstance) {
logger.nfo("TaskInstance fnshed task code:{} state:{} ",
taskInstance.getTaskCode(),
taskInstance.getState());
actveTaskProcessorMaps.remove(taskInstance.getTaskCode());
stateWheelExecuteThread.removeTask4TmeoutCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4RetryCheck(processInstance, taskInstance);
stateWheelExecuteThread.removeTask4StateCheck(processInstance, taskInstance);
f (taskInstance.getState().typeIsSuccess()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
processInstance.setVarPool(taskInstance.getVarPool());
processServce.saveProcessInstance(processInstance);
f (!processInstance.sBlocked()) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
}
} else f (taskInstance.taskCanRetry() && processInstance.getState() != ExecutonStatus.READY_STOP) {
logger.nfo("Retry taskInstance taskInstance state: {}", taskInstance.getState());
retryTaskInstance(taskInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | } else f (taskInstance.getState().typeIsFalure()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.CONTINUE
&& DagHelper.haveAllNodeAfterNode(Long.toStrng(taskInstance.getTaskCode()), dag)) {
submtPostNode(Long.toStrng(taskInstance.getTaskCode()));
} else {
errorTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
f (processInstance.getFalureStrategy() == FalureStrategy.END) {
kllAllTasks();
}
}
} else f (taskInstance.getState().typeIsFnshed()) {
completeTaskMap.put(taskInstance.getTaskCode(), taskInstance.getId());
}
ths.updateProcessInstanceState();
}
/**
* release task group
*
* @param taskInstance
*/
prvate vod releaseTaskGroup(TaskInstance taskInstance) {
f (taskInstance.getTaskGroupId() > 0) {
TaskInstance nextTaskInstance = ths.processServce.releaseTaskGroup(taskInstance);
f (nextTaskInstance != null) {
f (nextTaskInstance.getProcessInstanceId() == taskInstance.getProcessInstanceId()) {
StateEvent nextEvent = new StateEvent();
nextEvent.setProcessInstanceId(ths.processInstance.getId()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.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);
}
}
}
}
/**
* crate new task nstance to retry, dfferent objects from the orgnal
*
* @param taskInstance
*/
prvate vod retryTaskInstance(TaskInstance taskInstance) {
f (!taskInstance.taskCanRetry()) {
return;
}
TaskInstance newTaskInstance = cloneRetryTaskInstance(taskInstance);
f (newTaskInstance == null) {
logger.error("retry fal, new taskInstance s null, task code:{}, task d:{}", taskInstance.getTaskCode(), taskInstance.getId());
return;
}
watToRetryTaskInstanceMap.put(newTaskInstance.getTaskCode(), newTaskInstance);
f (!taskInstance.retryTaskIntervalOverTme()) {
logger.nfo("falure task wll be submtted: process d: {}, task nstance code: {} state:{} retry tmes:{} / {}, nterval:{}",
processInstance.getId(),
newTaskInstance.getTaskCode(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | newTaskInstance.getState(),
newTaskInstance.getRetryTmes(),
newTaskInstance.getMaxRetryTmes(),
newTaskInstance.getRetryInterval());
stateWheelExecuteThread.addTask4TmeoutCheck(processInstance, newTaskInstance);
stateWheelExecuteThread.addTask4RetryCheck(processInstance, newTaskInstance);
} else {
addTaskToStandByLst(newTaskInstance);
submtStandByTask();
watToRetryTaskInstanceMap.remove(newTaskInstance.getTaskCode());
}
}
/**
* handle task retry event
*
* @param stateEvent
* @return
*/
prvate boolean taskRetryEventHandler(StateEvent stateEvent) {
TaskInstance taskInstance = watToRetryTaskInstanceMap.get(stateEvent.getTaskCode());
addTaskToStandByLst(taskInstance);
submtStandByTask();
watToRetryTaskInstanceMap.remove(stateEvent.getTaskCode());
return true;
}
/**
* update process nstance
*/
publc vod refreshProcessInstance(nt processInstanceId) {
logger.nfo("process nstance update: {}", processInstanceId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | 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(taskInstance.getTaskCode());
f (Flag.YES == taskInstance.getFlag()) {
valdTaskMap.put(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); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | 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;
}
/**
* check f task nstance exst by task code
*/
publc boolean checkTaskInstanceByCode(long taskCode) {
f (taskInstanceMap.sEmpty()) {
return false;
}
for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return true;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | return false;
}
/**
* check f task nstance exst by d
*/
publc boolean checkTaskInstanceById(nt taskInstanceId) {
f (taskInstanceMap.sEmpty()) {
return false;
}
return taskInstanceMap.contansKey(taskInstanceId);
}
/**
* get task nstance from memory
*/
publc Optonal<TaskInstance> getTaskInstance(nt taskInstanceId) {
f (taskInstanceMap.contansKey(taskInstanceId)) {
return Optonal.ofNullable(taskInstanceMap.get(taskInstanceId));
}
return Optonal.empty();
}
publc Optonal<TaskInstance> getTaskInstance(long taskCode) {
f (taskInstanceMap.sEmpty()) {
return Optonal.empty();
}
for (TaskInstance taskInstance : taskInstanceMap.values()) {
f (taskInstance.getTaskCode() == taskCode) {
return Optonal.of(taskInstance);
}
}
return Optonal.empty(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
publc Optonal<TaskInstance> getActveTaskInstanceByTaskCode(long taskCode) {
f (actveTaskProcessorMaps.contansKey(taskCode)) {
return Optonal.ofNullable(actveTaskProcessorMaps.get(taskCode).taskInstance());
}
return Optonal.empty();
}
publc Optonal<TaskInstance> getRetryTaskInstanceByTaskCode(long taskCode) {
f (watToRetryTaskInstanceMap.contansKey(taskCode)) {
return Optonal.ofNullable(watToRetryTaskInstanceMap.get(taskCode));
}
return Optonal.empty();
}
prvate boolean processStateChangeHandler(StateEvent stateEvent) {
try {
logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus());
f (stateEvent.getExecutonStatus() == ExecutonStatus.STOP) {
f (processDefnton.getExecutonType().typeIsSeralWat() || processDefnton.getExecutonType().typeIsSeralProrty()) {
endProcess();
return true;
}
ths.updateProcessInstanceState(stateEvent);
return true;
}
f (processComplementData()) {
return true;
}
f (stateEvent.getExecutonStatus().typeIsFnshed()) {
endProcess(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | }
f (processInstance.getState() == ExecutonStatus.READY_STOP) {
kllAllTasks();
}
return true;
} catch (Excepton e) {
logger.error("process state change error:", e);
}
return true;
}
prvate boolean processBlockHandler(StateEvent stateEvent) {
try {
Optonal<TaskInstance> taskInstanceOptonal = getTaskInstance(stateEvent.getTaskInstanceId());
TaskInstance task = taskInstanceOptonal.orElseThrow(
() -> new RuntmeExcepton("Cannot fnd taskInstance by taskInstanceId:" + stateEvent.getTaskInstanceId()));
f (!checkTaskInstanceByStateEvent(stateEvent)) {
logger.error("task {} s not a blockng task", task.getTaskCode());
return false;
}
BlockngParameters parameters = JSONUtls.parseObject(task.getTaskParams(), BlockngParameters.class);
f (parameters.sAlertWhenBlockng()) {
ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendProcessBlockngAlert(processInstance, projectUser);
logger.nfo("processInstance {} block alert send successful!", processInstance.getId());
}
} catch (Excepton e) {
logger.error("sendng blockng message error:", e);
}
return true;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | 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);
} else f (processInstance.getState().typeIsFnshed()) {
endProcess();
f (complementLstDate.sEmpty()) {
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);
scheduleDate = complementLstDate.get(ndex + 1);
}
nt create = ths.createComplementDataCommand(scheduleDate); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | f (create > 0) {
logger.nfo("create complement data command successfully.");
}
return true;
}
prvate nt createComplementDataCommand(Date scheduleDate) {
Command command = new Command();
command.setScheduleTme(scheduleDate);
command.setCommandType(CommandType.COMPLEMENT_DATA);
command.setProcessDefntonCode(processInstance.getProcessDefntonCode());
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);
}
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) {
cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST,
cmdParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)
.substrng(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST).ndexOf(COMMA) + 1));
}
f (cmdParam.contansKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) {
cmdParam.replace(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtls.format(scheduleDate, YYYY_MM_DD_HH_MM_SS, null));
}
command.setCommandParam(JSONUtls.toJsonStrng(cmdParam));
command.setTaskDependType(processInstance.getTaskDependType());
command.setFalureStrategy(processInstance.getFalureStrategy());
command.setWarnngType(processInstance.getWarnngType());
command.setWarnngGroupId(processInstance.getWarnngGroupId());
command.setStartTme(new Date());
command.setExecutorId(processInstance.getExecutorId());
command.setUpdateTme(new Date()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | command.setProcessInstanceProrty(processInstance.getProcessInstanceProrty());
command.setWorkerGroup(processInstance.getWorkerGroup());
command.setEnvronmentCode(processInstance.getEnvronmentCode());
command.setDryRun(processInstance.getDryRun());
command.setProcessInstanceId(0);
command.setProcessDefntonVerson(processInstance.getProcessDefntonVerson());
return processServce.createCommand(command);
}
prvate boolean needComplementProcess() {
f (processInstance.sComplementData()
&& Flag.NO == processInstance.getIsSubProcess()) {
return true;
}
return false;
}
/**
* ProcessInstance start entrypont.
*/
@Overrde
publc vod run() {
f (ths.taskInstanceMap.sze() > 0 || sStart) {
logger.warn("The workflow has already been started");
return;
}
try {
buldFlowDag();
ntTaskQueue();
submtPostNode(null);
sStart = true;
} catch (Excepton e) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | logger.error("start process error, process nstance d:{}", processInstance.getId(), e);
}
}
/**
* process end handle
*/
publc vod endProcess() {
ths.stateEvents.clear();
f (processDefnton.getExecutonType().typeIsSeralWat() || processDefnton.getExecutonType().typeIsSeralProrty()) {
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(), processInstance.getId());
f (nextProcessInstance == null) {
return;
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | ProcessInstance nextReadyStopProcessInstance = ths.processServce.loadNextProcess4Seral(processInstance.getProcessDefnton().getCode(), ExecutonStatus.READY_STOP.getCode(), processInstance.getId());
f (processDefnton.getExecutonType().typeIsSeralProrty() && nextReadyStopProcessInstance != null) {
return;
}
nextInstanceId = nextProcessInstance.getId();
}
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.setProcessInstanceId(nextProcessInstance.getId());
command.setProcessDefntonCode(processDefnton.getCode());
command.setProcessDefntonVerson(processDefnton.getVerson());
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(), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | processInstance.getProcessDefntonVerson());
processInstance.setProcessDefnton(processDefnton);
Lst<TaskInstance> recoverNodeLst = getStartTaskInstanceLst(processInstance.getCommandParam());
Lst<ProcessTaskRelaton> processTaskRelatons = processServce.fndRelatonByCode(processDefnton.getCode(), processDefnton.getVerson());
Lst<TaskDefntonLog> taskDefntonLogs = processServce.getTaskDefneLogLstByRelaton(processTaskRelatons);
Lst<TaskNode> taskNodeLst = processServce.transformTask(processTaskRelatons, taskDefntonLogs);
forbddenTaskMap.clear();
taskNodeLst.forEach(taskNode -> {
f (taskNode.sForbdden()) {
forbddenTaskMap.put(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(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 10,666 | [Bug] [Master] Workflow submit failed will still in memory and never retry | ### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
When we execute a workflow, if the workflow submit failed in MasterServer, the WorkflowRunnable will always stay in memory, and it will not retry.
This is caused we didn't judge the submit status.
### What you expected to happen
When workflow submit failed, it will retry.
### How to reproduce
Submit the workflow, and restart the mysql.
### 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/10666 | https://github.com/apache/dolphinscheduler/pull/10667 | f8650b7b7c0a14f33a536418a4ef23092c941bb6 | 35a10d092f566c07137da5fb67b21cee644cdc8f | 2022-06-29T09:17:05Z | java | 2022-07-04T14:08:15Z | dolphinscheduler-master/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteRunnable.java | dependFaledTaskMap.clear();
completeTaskMap.clear();
errorTaskMap.clear();
f (!sNewProcessInstance()) {
Lst<TaskInstance> valdTaskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId());
for (TaskInstance task : valdTaskInstanceLst) {
f (valdTaskMap.contansKey(task.getTaskCode())) {
nt oldTaskInstanceId = valdTaskMap.get(task.getTaskCode());
TaskInstance oldTaskInstance = taskInstanceMap.get(oldTaskInstanceId);
f (!oldTaskInstance.getState().typeIsFnshed() && task.getState().typeIsFnshed()) {
task.setFlag(Flag.NO);
processServce.updateTaskInstance(task);
contnue;
}
logger.warn("have same taskCode taskInstance when nt task queue, taskCode:{}", task.getTaskCode());
}
valdTaskMap.put(task.getTaskCode(), task.getId());
taskInstanceMap.put(task.getId(), task);
f (task.sTaskComplete()) {
completeTaskMap.put(task.getTaskCode(), task.getId());
contnue;
}
f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(Long.toStrng(task.getTaskCode()), dag)) {
contnue;
}
f (task.taskCanRetry()) {
f (task.getState() == ExecutonStatus.NEED_FAULT_TOLERANCE) {
TaskInstance tolerantTaskInstance = cloneTolerantTaskInstance(task);
addTaskToStandByLst(tolerantTaskInstance); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.