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
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} /** * 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 * @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); 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); List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords(); pageInfo.setTotalList(processDefinitionLogs); pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal()); result.setData(pageInfo); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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 * @return delele result code */ @Override 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); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); } else { processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); putMsg(result, Status.SUCCESS); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.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.common.utils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Objects; public class SnowFlakeUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
private static final long START_TIMESTAMP = 1609430400L; private static final long SEQUENCE_BIT = 13; private static final long MACHINE_BIT = 2; private static final long MAX_SEQUENCE = ~(-1L << SEQUENCE_BIT); private static final long MACHINE_LEFT = SEQUENCE_BIT; private static final long TIMESTAMP_LEFT = SEQUENCE_BIT + MACHINE_BIT; private final int machineId; private long sequence = 0L; private long lastTimestamp = -1L; private SnowFlakeUtils() throws SnowFlakeException { try { this.machineId = Math.abs(Objects.hash(InetAddress.getLocalHost().getHostName())) % 32; } catch (UnknownHostException e) { throw new SnowFlakeException(e.getMessage()); } } private static SnowFlakeUtils instance = null; public static synchronized SnowFlakeUtils getInstance() throws SnowFlakeException { if (instance == null) { instance = new SnowFlakeUtils(); } return instance;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
} public synchronized long nextId() throws SnowFlakeException { long currStmp = nowTimestamp(); if (currStmp < lastTimestamp) { throw new SnowFlakeException("Clock moved backwards. Refusing to generate id"); } if (currStmp == lastTimestamp) { sequence = (sequence + 1) & MAX_SEQUENCE; if (sequence == 0L) { currStmp = getNextMill(); } } else { sequence = 0L; } lastTimestamp = currStmp; return (currStmp - START_TIMESTAMP) << TIMESTAMP_LEFT | machineId << MACHINE_LEFT | sequence; } private long getNextMill() { long mill = nowTimestamp(); while (mill <= lastTimestamp) { mill = nowTimestamp(); } return mill; } private long nowTimestamp() { return System.currentTimeMillis() / 1000; } public static class SnowFlakeException extends Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,147
[Bug] The genTaskCodeList interface returns the same code
Multiple requests to the genTaskCodeList interface within a short period of time may respond with the same code ![image](https://user-images.githubusercontent.com/87303815/132617237-b53dd19d-603d-4ffe-9364-e69357175f6f.png) 短时间内(≈1s)多次请求`/dolphinscheduler/projects/{projectCode}/task-definition/gen-task-codes`接口,可能返回相同的code
https://github.com/apache/dolphinscheduler/issues/6147
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:31:10Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
public SnowFlakeException(String message) { super(message); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID; import org.apache.dolphinscheduler.api.dto.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.treeview.Instance; import org.apache.dolphinscheduler.api.dto.treeview.TreeViewDto; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.ProcessDefinitionService; import org.apache.dolphinscheduler.api.service.ProcessInstanceService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.api.service.SchedulerService; import org.apache.dolphinscheduler.api.utils.CheckUtils; import org.apache.dolphinscheduler.api.utils.FileUtils; import org.apache.dolphinscheduler.api.utils.PageInfo; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.AuthorizationType; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.thread.Stopper; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils; import org.apache.dolphinscheduler.common.utils.SnowFlakeUtils.SnowFlakeException; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.ProcessData; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelationLog; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinition; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.service.permission.PermissionCheck; import org.apache.dolphinscheduler.service.process.ProcessService; import java.io.BufferedOutputStream;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Collectors; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.Lists; /** * process definition service impl */ @Service
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService { private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class); private static final String RELEASESTATE = "releaseState"; @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private UserMapper userMapper; @Autowired private ProcessDefinitionLogMapper processDefinitionLogMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private TenantMapper tenantMapper; /** * create process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return create result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> createProcessDefinition(User loginUser, long projectCode, String name, String description,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } long processDefinitionCode; try { processDefinitionCode = SnowFlakeUtils.getInstance().nextId(); } catch (SnowFlakeException e) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); return result; } ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, loginUser.getId(), tenantId); return createProcessDefine(loginUser, result, taskRelationList, processDefinition, taskDefinitionLogs); } private void createTaskDefinition(Map<String, Object> result, User loginUser, long projectCode, List<TaskDefinitionLog> taskDefinitionLogs, String taskDefinitionJson) { if (taskDefinitionLogs.isEmpty()) { logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson); putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson); return; } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!CheckUtils.checkTaskDefinitionParameters(taskDefinitionLog)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); return; } } if (processService.saveTaskDefine(loginUser, projectCode, taskDefinitionLogs)) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); } } private Map<String, Object> createProcessDefine(User loginUser, Map<String, Object> result, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, List<TaskDefinitionLog> taskDefinitionLogs) { int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); if (insertVersion > 0) { int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); } } else { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); } return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList, String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) { Map<String, Object> result = new HashMap<>(); try { if (taskRelationList == null || taskRelationList.isEmpty()) { logger.error("task relation list is null"); putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson); return result; } List<TaskNode> taskNodeList = processService.transformTask(taskRelationList, taskDefinitionLogs); if (taskNodeList.size() != taskRelationList.size()) { Set<Long> postTaskCodes = taskRelationList.stream().map(ProcessTaskRelationLog::getPostTaskCode).collect(Collectors.toSet()); Set<Long> taskNodeCodes = taskNodeList.stream().map(TaskNode::getCode).collect(Collectors.toSet()); Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); logger.error("the task code is not exit"); putMsg(result, Status.TASK_DEFINE_NOT_EXIST, StringUtils.join(codes, Constants.COMMA)); return result; } if (graphHasCycle(taskNodeList)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPostTaskCode() == 0) { logger.error("the post_task_code or post_task_version can't be zero"); putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR); return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
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.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } return result; } /** * query process definition list * * @param loginUser login user * @param projectCode project code * @return definition list */ @Override public Map<String, Object> queryProcessDefinitionList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> resourceList = processDefinitionMapper.queryAllDefinitionList(projectCode); List<DagData> dagDataList = resourceList.stream().map(processService::genDagData).collect(Collectors.toList()); result.put(Constants.DATA_LIST, dagDataList); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list paging
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* * @param loginUser login user * @param projectCode project code * @param searchVal search value * @param userId user id * @param pageNo page number * @param pageSize page size * @return process definition page */ @Override public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal, Integer userId, Integer pageNo, Integer pageSize) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } Page<ProcessDefinition> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging( page, searchVal, userId, project.getCode(), isAdmin(loginUser)); List<ProcessDefinition> records = processDefinitionIPage.getRecords(); for (ProcessDefinition pd : records) { ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion()); User user = userMapper.selectById(processDefinitionLog.getOperator()); pd.setModifyBy(user.getUserName()); } processDefinitionIPage.setRecords(records);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) processDefinitionIPage.getTotal()); pageInfo.setTotalList(processDefinitionIPage.getRecords()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * query detail of process definition * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return process definition detail */ @Override public Map<String, Object> queryProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); } else { Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId()); if (tenant != null) { processDefinition.setTenantCode(tenant.getTenantCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } @Override public Map<String, Object> queryProcessDefinitionByName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name); } else { DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData); putMsg(result, Status.SUCCESS); } return result; } /** * update process definition * * @param loginUser login user * @param projectCode project code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param name process definition name * @param code process definition code * @param description description * @param globalParams global params * @param locations locations for nodes * @param timeout timeout * @param tenantCode tenantCode * @param taskRelationJson relation json for nodes * @param taskDefinitionJson taskDefinitionJson * @return update result code */ @Transactional(rollbackFor = RuntimeException.class) @Override public Map<String, Object> updateProcessDefinition(User loginUser, long projectCode, String name, long code, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); createTaskDefinition(result, loginUser, projectCode, taskDefinitionLogs, taskDefinitionJson); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); Map<String, Object> checkRelationJson = checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs); if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) { return checkRelationJson; } 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) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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); processDefinition.set(projectCode, name, description, globalParams, locations, timeout, tenantId); return updateProcessDefine(loginUser, result, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs); } private Map<String, Object> updateProcessDefine(User loginUser, Map<String, Object> result, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, ProcessDefinition processDefinitionDeepCopy, List<TaskDefinitionLog> taskDefinitionLogs) { int insertVersion; if (processDefinition.equals(processDefinitionDeepCopy)) { insertVersion = processDefinitionDeepCopy.getVersion(); } else { processDefinition.setUpdateTime(new Date()); insertVersion = processService.saveProcessDefine(loginUser, processDefinition, true); } if (insertVersion > 0) { int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs); if (insertResult == Constants.EXIT_CODE_SUCCESS) { putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
result.put(Constants.DATA_LIST, processDefinition); } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } } else { putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); } return result; } /** * verify process definition name unique * * @param loginUser login user * @param projectCode project code * @param name name * @return true if process definition name not exists, otherwise false */ @Override public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim()); if (processDefinition == null) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} return result; } /** * delete process definition by code * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return delete result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> deleteProcessDefinitionByCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { putMsg(result, Status.USER_NO_OPERATION_PERM); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_STATE_ONLINE, code); return result; } List<ProcessInstance> processInstances = processInstanceService.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { putMsg(result, Status.DELETE_PROCESS_DEFINITION_BY_CODE_FAIL, processInstances.size()); return result; } List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(code); if (!schedules.isEmpty() && schedules.size() > 1) { logger.warn("scheduler num is {},Greater than 1", schedules.size()); putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); return result; } else if (schedules.size() == 1) { Schedule schedule = schedules.get(0); if (schedule.getReleaseState() == ReleaseState.OFFLINE) { scheduleMapper.deleteById(schedule.getId()); } else if (schedule.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, schedule.getId()); return result; } } int delete = processDefinitionMapper.deleteById(processDefinition.getId()); processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); if (delete > 0) { putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} else { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } return result; } /** * release process definition: online / offline * * @param loginUser login user * @param projectCode project code * @param code process definition code * @param releaseState release state * @return release result code */ @Override @Transactional(rollbackFor = RuntimeException.class) public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); 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); switch (releaseState) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
case ONLINE: String resourceIds = processDefinition.getResourceIds(); if (StringUtils.isNotBlank(resourceIds)) { Integer[] resourceIdArray = Arrays.stream(resourceIds.split(Constants.COMMA)).map(Integer::parseInt).toArray(Integer[]::new); PermissionCheck<Integer> permissionCheck = new PermissionCheck<>(AuthorizationType.RESOURCE_FILE_ID, processService, resourceIdArray, loginUser.getId(), logger); try { permissionCheck.checkPermission(); } catch (Exception e) { logger.error(e.getMessage(), e); putMsg(result, Status.RESOURCE_NOT_EXIST_OR_NO_PERMISSION, RELEASESTATE); return result; } } processDefinition.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); break; case OFFLINE: processDefinition.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); List<Schedule> scheduleList = scheduleMapper.selectAllByProcessDefineArray( new long[]{processDefinition.getCode()} ); for (Schedule schedule : scheduleList) { logger.info("set schedule offline, project id: {}, schedule id: {}, process definition code: {}", project.getId(), schedule.getId(), code); schedule.setReleaseState(ReleaseState.OFFLINE); scheduleMapper.updateById(schedule); schedulerService.deleteSchedule(project.getId(), schedule.getId()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } putMsg(result, Status.SUCCESS); return result; } /** * batch export process definition by codes */ @Override public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) { if (StringUtils.isEmpty(codes)) { return; } Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); List<DagDataSchedule> dagDataSchedules = processDefinitionList.stream().map(this::exportProcessDagData).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(dagDataSchedules)) { downloadProcessDefinitionFile(response, dagDataSchedules); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* download the process definition file */ private 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
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
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) { List<Schedule> schedules = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode()); DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition)); if (!schedules.isEmpty()) { Schedule schedule = schedules.get(0); schedule.setReleaseState(ReleaseState.OFFLINE); dagDataSchedule.setSchedule(schedule); } 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class); if (CollectionUtils.isEmpty(dagDataScheduleList)) { putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for (DagDataSchedule dagDataSchedule : dagDataScheduleList) { if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule)) { return result; } } return result; } /** * check and import */ private boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule) { if (!checkImportanceParams(dagDataSchedule, result)) { return false; } ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, processDefinition.getName()); if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefinition.setName(processDefinitionName + "_import_" + DateUtils.getCurrentTimeStamp()); processDefinition.setUserId(loginUser.getId()); try { processDefinition.setCode(SnowFlakeUtils.getInstance().nextId()); } catch (SnowFlakeException e) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); return false; } List<TaskDefinitionLog> taskDefinitionList = dagDataSchedule.getTaskDefinitionList(); Map<Long, Long> taskCodeMap = new HashMap<>(); Date now = new Date(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionList) { taskDefinitionLog.setName(taskDefinitionLog.getName() + "_import_" + DateUtils.getCurrentTimeStamp()); taskDefinitionLog.setProjectCode(projectCode); taskDefinitionLog.setUserId(loginUser.getId()); taskDefinitionLog.setVersion(Constants.VERSION_FIRST); taskDefinitionLog.setCreateTime(now); taskDefinitionLog.setUpdateTime(now); taskDefinitionLog.setOperator(loginUser.getId()); taskDefinitionLog.setOperateTime(now); try { long code = SnowFlakeUtils.getInstance().nextId(); taskCodeMap.put(taskDefinitionLog.getCode(), code); taskDefinitionLog.setCode(code); } catch (SnowFlakeException e) { logger.error("Task code get error, ", e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); return false; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
int insert = taskDefinitionMapper.batchInsert(taskDefinitionList); int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionList); if ((logInsert & insert) == 0) { putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); return false; } List<ProcessTaskRelationLog> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); taskRelationList.forEach(processTaskRelationLog -> { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST); processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); }); Map<String, Object> createProcessResult = createProcessDefine(loginUser, result, taskRelationList, processDefinition, null); if (Status.SUCCESS.equals(createProcessResult.get(Constants.STATUS))) { putMsg(createProcessResult, Status.SUCCESS); } else { result.putAll(createProcessResult); return false; } Schedule schedule = dagDataSchedule.getSchedule(); 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return false; } } 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; } 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 {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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) { 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; } List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelationLog.class); List<TaskNode> taskNodes = processService.transformTask(taskRelationList, Lists.newArrayList()); if (CollectionUtils.isEmpty(taskNodes)) { logger.error("process node info is empty"); putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (graphHasCycle(taskNodes)) { logger.error("process DAG has cycle"); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (TaskNode taskNode : taskNodes) { if (!CheckUtils.checkTaskNodeParameters(taskNode)) { logger.error("task node {} parameter invalid", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); } putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR); result.put(Constants.MSG, e.getMessage()); } 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
*/ @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); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); 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; } Map<Long, List<TaskDefinitionLog>> taskNodeMap = new HashMap<>(); for (ProcessDefinition processDefinition : processDefinitionList) { 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { 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; } /** * Encapsulates the TreeView structure * * @param code process definition code * @param limit limit * @return tree view json data */ @Override public Map<String, Object> viewTree(long code, Integer limit) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (null == processDefinition) { logger.info("process define not exists"); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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.queryTaskDefinitionListByProcess(code, processDefinition.getVersion()); Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream() .collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); 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.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); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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 nodeName = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); treeViewDto.setName(nodeName); TaskNode taskNode = dag.getNode(nodeName); treeViewDto.setType(taskNode.getType()); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndName(processInstance.getId(), nodeName); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime(); int subProcessId = 0; if (taskInstance.isSubProcess()) { TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode()); subProcessId = Integer.parseInt(JSONUtils.parseObject( taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_ID).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessId));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeName); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeName : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeName); if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); } treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeName, treeViewDtoList); } } runningNodeMap.remove(nodeName); } 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; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * 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(taskNodeResponse.getName(), taskNodeResponse); } 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, taskNodeResponse.getName())) { return true; } } } } return graph.hasCycle(); } /** * batch copy process definition * * @param loginUser loginUser * @param projectCode projectCode
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @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); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true); checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true); return result; } /** * batch move process definition * * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override public Map<String, Object> batchMoveProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (projectCode == targetProjectCode) { return result; } 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) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (targetResult.get(Constants.STATUS) != Status.SUCCESS) { return targetResult; } } return result; } private void doBatchOperateProcessDefinition(User loginUser, 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); if (isCopy) { processDefinition.setName(processDefinition.getName() + "_copy_" + DateUtils.getCurrentTimeStamp()); createProcessDefine(loginUser, result, taskRelationList, processDefinition, Lists.newArrayList()); } else { updateProcessDefine(loginUser, result, taskRelationList, processDefinition, null, Lists.newArrayList()); } if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]"); } } } /** * switch the defined process definition version * * @param loginUser login user * @param projectCode project code * @param code process definition code * @param version the version user want to switch * @return switch process definition version result code */ @Override 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); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (Objects.isNull(processDefinition)) { 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);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog); if (switchVersion > 0) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR); } return result; } /** * 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); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} /** * 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 * @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); 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); List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords(); pageInfo.setTotalList(processDefinitionLogs); pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal()); result.setData(pageInfo); putMsg(result, Status.SUCCESS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
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 * @return delele result code */ @Override 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); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, code); } else { processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); putMsg(result, Status.SUCCESS); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.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.common.utils; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Objects; public class SnowFlakeUtils {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
private static final long START_TIMESTAMP = 1609430400L; private static final long SEQUENCE_BIT = 13; private static final long MACHINE_BIT = 2; private static final long MAX_SEQUENCE = ~(-1L << SEQUENCE_BIT); private static final long MACHINE_LEFT = SEQUENCE_BIT; private static final long TIMESTAMP_LEFT = SEQUENCE_BIT + MACHINE_BIT; private final int machineId; private long sequence = 0L; private long lastTimestamp = -1L; private SnowFlakeUtils() throws SnowFlakeException { try { this.machineId = Math.abs(Objects.hash(InetAddress.getLocalHost().getHostName())) % 32; } catch (UnknownHostException e) { throw new SnowFlakeException(e.getMessage()); } } private static SnowFlakeUtils instance = null; public static synchronized SnowFlakeUtils getInstance() throws SnowFlakeException { if (instance == null) { instance = new SnowFlakeUtils(); } return instance;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
} public synchronized long nextId() throws SnowFlakeException { long currStmp = nowTimestamp(); if (currStmp < lastTimestamp) { throw new SnowFlakeException("Clock moved backwards. Refusing to generate id"); } if (currStmp == lastTimestamp) { sequence = (sequence + 1) & MAX_SEQUENCE; if (sequence == 0L) { currStmp = getNextMill(); } } else { sequence = 0L; } lastTimestamp = currStmp; return (currStmp - START_TIMESTAMP) << TIMESTAMP_LEFT | machineId << MACHINE_LEFT | sequence; } private long getNextMill() { long mill = nowTimestamp(); while (mill <= lastTimestamp) { mill = nowTimestamp(); } return mill; } private long nowTimestamp() { return System.currentTimeMillis() / 1000; } public static class SnowFlakeException extends Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,146
[Bug] Save workflow error
I created a workflow as follows: ![image](https://user-images.githubusercontent.com/87303815/132616260-4e0be953-ecfe-497a-86ed-a5c0fe8ba404.png) I got an error when i clicked the save btn: ![image](https://user-images.githubusercontent.com/87303815/132616620-89a34a31-f6e4-4bab-9c5f-168c10b92907.png) **Which version of Dolphin Scheduler:** version: 2.0.0 branch: dev **Additional context** The request params: [request.txt](https://github.com/apache/dolphinscheduler/files/7133138/request.txt)
https://github.com/apache/dolphinscheduler/issues/6146
https://github.com/apache/dolphinscheduler/pull/6150
cca48d0a9249917f7dc2ecef1cad67e93e227555
e8ddc9103dbc6d0e69b5a1e10c43606ba84f7009
"2021-09-09T03:19:57Z"
java
"2021-09-09T14:01:22Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SnowFlakeUtils.java
public SnowFlakeException(String message) { super(message); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractTask.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.spi.task; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; /** * executive task */ public abstract class AbstractTask { /** * varPool string */ protected String varPool; /** * taskExecutionContext **/ TaskRequest taskRequest;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractTask.java
/** * SHELL process pid */ protected int processId; /** * SHELL result string */ protected String resultString; /** * other resource manager appId , for example : YARN etc */ protected String appIds; /** * cancel */ protected volatile boolean cancel = false; /** * exit code */ protected volatile int exitStatusCode = -1; /** * constructor * * @param taskExecutionContext taskExecutionContext */ protected AbstractTask(TaskRequest taskExecutionContext) { this.taskRequest = taskExecutionContext; } /** * init task
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractTask.java
*/ public void init() { } public String getPreScript() { return null; } public void setCommand(String command) throws Exception { } /** * task handle * * @throws Exception exception */ public abstract void handle() throws Exception; /** * cancel application * * @param status status * @throws Exception exception */ public void cancelApplication(boolean status) throws Exception { this.cancel = status; } public void setVarPool(String varPool) { this.varPool = varPool; } public String getVarPool() { return varPool; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractTask.java
* get exit status code * * @return exit status code */ public int getExitStatusCode() { return exitStatusCode; } public void setExitStatusCode(int exitStatusCode) { this.exitStatusCode = exitStatusCode; } public String getAppIds() { return appIds; } public void setAppIds(String appIds) { this.appIds = appIds; } public int getProcessId() { return processId; } public void setProcessId(int processId) { this.processId = processId; } public String getResultString() { return resultString; } public void setResultString(String resultString) { this.resultString = resultString; } /** * get task parameters
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-spi/src/main/java/org/apache/dolphinscheduler/spi/task/AbstractTask.java
* * @return AbstractParameters */ public abstract AbstractParameters getParameters(); /** * result processing maybe */ public void after() { } /** * get exit status according to exitCode * * @return exit status */ public ExecutionStatus getExitStatus() { ExecutionStatus status; switch (getExitStatusCode()) { case TaskConstants.EXIT_CODE_SUCCESS: status = ExecutionStatus.SUCCESS; break; case TaskConstants.EXIT_CODE_KILL: status = ExecutionStatus.KILL; break; default: status = ExecutionStatus.FAILURE; break; } return status; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.api; import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_FAILURE; import static org.apache.dolphinscheduler.spi.task.TaskConstants.EXIT_CODE_KILL; import static org.apache.dolphinscheduler.spi.task.TaskConstants.SH; import org.apache.dolphinscheduler.plugin.task.util.LoggerUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
import org.apache.dolphinscheduler.plugin.task.util.OSUtils; import org.apache.dolphinscheduler.spi.task.TaskConstants; import org.apache.dolphinscheduler.spi.task.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadFactory; import java.util.concurrent.TimeUnit; import java.util.function.Consumer; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.slf4j.Logger; import com.google.common.util.concurrent.ThreadFactoryBuilder; /** * abstract command executor */ public abstract class AbstractCommandExecutor { /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
* rules for extracting application ID */ protected static final Pattern APPLICATION_REGEX = Pattern.compile(TaskConstants.APPLICATION_REGEX); protected StringBuilder varPool = new StringBuilder(); /** * process */ private Process process; /** * log handler */ protected Consumer<List<String>> logHandler; /** * logger */ protected Logger logger; /** * log list */ protected List<String> logBuffer; protected boolean logOutputIsSuccess = false; /* * SHELL result string */ protected String taskResultString; /** * taskRequest */ protected TaskRequest taskRequest; public AbstractCommandExecutor(Consumer<List<String>> logHandler,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
TaskRequest taskRequest, Logger logger) { this.logHandler = logHandler; this.taskRequest = taskRequest; this.logger = logger; this.logBuffer = Collections.synchronizedList(new ArrayList<>()); } public AbstractCommandExecutor(List<String> logBuffer) { this.logBuffer = logBuffer; } /** * build process * * @param commandFile command file * @throws IOException IO Exception */ private void buildProcess(String commandFile) throws IOException { List<String> command = new LinkedList<>(); ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.directory(new File(taskRequest.getExecutePath())); processBuilder.redirectErrorStream(true); command.add("sudo"); command.add("-u"); command.add(taskRequest.getTenantCode()); command.add(SH);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
command.addAll(Collections.emptyList()); command.add(commandFile); processBuilder.command(command); process = processBuilder.start(); printCommand(command); } public TaskResponse run(String execCommand) throws IOException, InterruptedException { TaskResponse result = new TaskResponse(); int taskInstanceId = taskRequest.getTaskInstanceId(); if (null == TaskExecutionContextCacheManager.getByTaskInstanceId(taskInstanceId)) { result.setExitStatusCode(EXIT_CODE_KILL); return result; } if (StringUtils.isEmpty(execCommand)) { TaskExecutionContextCacheManager.removeByTaskInstanceId(taskInstanceId); return result; } String commandFilePath = buildCommandFilePath(); createCommandFileIfNotExists(execCommand, commandFilePath); buildProcess(commandFilePath); parseProcessOutput(process); int processId = getProcessId(process); result.setProcessId(processId); taskRequest.setProcessId(processId); boolean updateTaskExecutionContextStatus = TaskExecutionContextCacheManager.updateTaskExecutionContext(taskRequest);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
if (Boolean.FALSE.equals(updateTaskExecutionContextStatus)) { ProcessUtils.kill(taskRequest); result.setExitStatusCode(EXIT_CODE_KILL); return result; } logger.info("process start, process id is: {}", processId); long remainTime = getRemainTime(); boolean status = process.waitFor(remainTime, TimeUnit.SECONDS); if (status) { List<String> appIds = getAppIds(taskRequest.getLogPath()); result.setAppIds(String.join(TaskConstants.COMMA, appIds)); result.setExitStatusCode(process.exitValue()); } else { logger.error("process has failure , exitStatusCode:{}, processExitValue:{}, ready to kill ...", result.getExitStatusCode(), process.exitValue()); ProcessUtils.kill(taskRequest); result.setExitStatusCode(EXIT_CODE_FAILURE); } logger.info("process has exited, execute path:{}, processId:{} ,exitStatusCode:{} ,processWaitForStatus:{} ,processExitValue:{}", taskRequest.getExecutePath(), processId, result.getExitStatusCode(), status, process.exitValue()); return result; } public String getVarPool() { return varPool.toString();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
} /** * cancel application * * @throws Exception exception */ public void cancelApplication() throws Exception { if (process == null) { return; } clear(); int processId = getProcessId(process); logger.info("cancel process: {}", processId); boolean killed = softKill(processId); if (!killed) { hardKill(processId); process.destroy(); process = null; } } /** * soft kill * * @param processId process id * @return process is alive */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
private boolean softKill(int processId) { if (processId != 0 && process.isAlive()) { try { String cmd = String.format("kill %d", processId); cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd); logger.info("soft kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd); Runtime.getRuntime().exec(cmd); } catch (IOException e) { logger.info("kill attempt failed", e); } } return process.isAlive(); } /** * hard kill * * @param processId process id */ private void hardKill(int processId) { if (processId != 0 && process.isAlive()) { try { String cmd = String.format("kill -9 %d", processId); cmd = OSUtils.getSudoCmd(taskRequest.getTenantCode(), cmd); logger.info("hard kill task:{}, process id:{}, cmd:{}", taskRequest.getTaskAppId(), processId, cmd); Runtime.getRuntime().exec(cmd); } catch (IOException e) { logger.error("kill attempt failed ", e); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
} private void printCommand(List<String> commands) { logger.info("task run command: {}", String.join(" ", commands)); } /** * clear */ private void clear() { List<String> markerList = new ArrayList<>(); markerList.add(ch.qos.logback.classic.ClassicConstants.FINALIZE_SESSION_MARKER.toString()); if (!logBuffer.isEmpty()) { logHandler.accept(logBuffer); logBuffer.clear(); } logHandler.accept(markerList); } /** * get the standard output of the process * * @param process process */ private void parseProcessOutput(Process process) { String threadLoggerInfoName = String.format(LoggerUtils.TASK_LOGGER_THREAD_NAME + "-%s", taskRequest.getTaskAppId()); ExecutorService getOutputLogService = newDaemonSingleThreadExecutor(threadLoggerInfoName + "-" + "getOutputLogService"); getOutputLogService.submit(() -> { try (BufferedReader inReader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line; logBuffer.add("welcome to use bigdata scheduling system..."); while ((line = inReader.readLine()) != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
if (line.startsWith("${setValue(")) { varPool.append(line, "${setValue(".length(), line.length() - 2); varPool.append("$VarPool$"); } else { logBuffer.add(line); taskResultString = line; } } logOutputIsSuccess = true; } catch (Exception e) { logger.error(e.getMessage(), e); logOutputIsSuccess = true; } }); getOutputLogService.shutdown(); ExecutorService parseProcessOutputExecutorService = newDaemonSingleThreadExecutor(threadLoggerInfoName); parseProcessOutputExecutorService.submit(() -> { try { long lastFlushTime = System.currentTimeMillis(); while (logBuffer.size() > 0 || !logOutputIsSuccess) { if (logBuffer.size() > 0) { lastFlushTime = flush(lastFlushTime); } else { Thread.sleep(TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL); } } } catch (Exception e) { Thread.currentThread().interrupt(); logger.error(e.getMessage(), e); } finally {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
clear(); } }); parseProcessOutputExecutorService.shutdown(); } /** * get app links * * @param logPath log path * @return app id list */ private List<String> getAppIds(String logPath) { List<String> logs = convertFile2List(logPath); List<String> appIds = new ArrayList<>(); /* * analysis log?get submited yarn application id */ for (String log : logs) { String appId = findAppId(log); if (StringUtils.isNotEmpty(appId) && !appIds.contains(appId)) { logger.info("find app id: {}", appId); appIds.add(appId); } } return appIds; } /** * convert file to list * * @param filename file name
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
* @return line list */ private List<String> convertFile2List(String filename) { List<String> lineList = new ArrayList<>(100); File file = new File(filename); if (!file.exists()) { return lineList; } try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(filename), StandardCharsets.UTF_8))) { String line; while ((line = br.readLine()) != null) { lineList.add(line); } } catch (Exception e) { logger.error(String.format("read file: %s failed : ", filename), e); } return lineList; } /** * find app id * * @param line line * @return appid */ private String findAppId(String line) { Matcher matcher = APPLICATION_REGEX.matcher(line); if (matcher.find()) { return matcher.group(); } return null;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
} /** * get remain time(s) * * @return remain time */ private long getRemainTime() { long usedTime = (System.currentTimeMillis() - taskRequest.getStartTime().getTime()) / 1000; long remainTime = taskRequest.getTaskTimeout() - usedTime; if (remainTime < 0) { throw new RuntimeException("task execution time out"); } return remainTime; } /** * get process id * * @param process process * @return process id */ private int getProcessId(Process process) { int processId = 0; try { Field f = process.getClass().getDeclaredField(TaskConstants.PID); f.setAccessible(true); processId = f.getInt(process); } catch (Throwable e) { logger.error(e.getMessage(), e); } return processId;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractCommandExecutor.java
} /** * when log buffer siz or flush time reach condition , then flush * * @param lastFlushTime last flush time * @return last flush time */ private long flush(long lastFlushTime) { long now = System.currentTimeMillis(); /* * when log buffer siz or flush time reach condition , then flush */ if (logBuffer.size() >= TaskConstants.DEFAULT_LOG_ROWS_NUM || now - lastFlushTime > TaskConstants.DEFAULT_LOG_FLUSH_INTERVAL) { lastFlushTime = now; logHandler.accept(logBuffer); logBuffer.clear(); } return lastFlushTime; } protected abstract String buildCommandFilePath(); protected abstract void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException; ExecutorService newDaemonSingleThreadExecutor(String threadName) { ThreadFactory threadFactory = new ThreadFactoryBuilder() .setDaemon(true) .setNameFormat(threadName) .build(); return Executors.newSingleThreadExecutor(threadFactory); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.python; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskException; import org.apache.dolphinscheduler.plugin.task.api.TaskResponse; import org.apache.dolphinscheduler.spi.task.AbstractParameters; import org.apache.dolphinscheduler.spi.task.TaskConstants; import org.apache.dolphinscheduler.spi.task.request.TaskRequest; import org.apache.dolphinscheduler.spi.utils.JSONUtils; /** * python task */ public class PythonTask extends AbstractTaskExecutor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java
/** * python parameters */ private PythonParameters pythonParameters; /** * task dir */ private String taskDir; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java
* python command executor */ private PythonCommandExecutor pythonCommandExecutor; private TaskRequest taskRequest; private String command; /** * constructor * * @param taskRequest taskRequest */ public PythonTask(TaskRequest taskRequest) { super(taskRequest); this.taskRequest = taskRequest; this.pythonCommandExecutor = new PythonCommandExecutor(this::logHandle, taskRequest, logger); } @Override public void init() { logger.info("python task params {}", taskRequest.getTaskParams()); pythonParameters = JSONUtils.parseObject(taskRequest.getTaskParams(), PythonParameters.class); if (!pythonParameters.checkParameters()) { throw new TaskException("python task params is not valid"); } } @Override public String getPreScript() { String rawPythonScript = pythonParameters.getRawScript().replaceAll("\\r\\n", "\n"); try { rawPythonScript = convertPythonScriptPlaceholders(rawPythonScript);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java
} catch (StringIndexOutOfBoundsException e) { logger.error("setShareVar field format error, raw python script : {}", rawPythonScript); } return rawPythonScript; } @Override public void setCommand(String command) { this.command = command; } @Override public void handle() throws Exception { try { TaskResponse taskResponse = pythonCommandExecutor.run(command); setExitStatusCode(taskResponse.getExitStatusCode()); setAppIds(taskResponse.getAppIds()); setProcessId(taskResponse.getProcessId()); setVarPool(pythonCommandExecutor.getVarPool()); } catch (Exception e) { logger.error("python task failure", e); setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); throw new TaskException("run python task error",e); } } @Override public void cancelApplication(boolean cancelApplication) throws Exception { pythonCommandExecutor.cancelApplication(); } @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,166
[Bug] [task-plugin] Python Task execute error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened In the newest dev version, python task is not migrated complete. When I execute python task in workflow, ds throws NullPointerException. ### What you expected to happen Python task execute correctly. ### How to reproduce - Add a python task into work flow. - Type simple script, just like`print('Hello')` - Then execute the work flow ### Anything else _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6166
https://github.com/apache/dolphinscheduler/pull/6167
ea2a9dbcb2ca3f4be2da6a4f300e988640e72219
0715be34d5b4c553396374679ccb23fedc4c27a0
"2021-09-10T15:02:37Z"
java
"2021-09-11T04:25:24Z"
dolphinscheduler-task-plugin/dolphinscheduler-task-python/src/main/java/org/apache/dolphinscheduler/plugin/task/python/PythonTask.java
public AbstractParameters getParameters() { return pythonParameters; } /** * convertPythonScriptPlaceholders * * @param rawScript rawScript * @return String * @throws StringIndexOutOfBoundsException StringIndexOutOfBoundsException */ private static String convertPythonScriptPlaceholders(String rawScript) throws StringIndexOutOfBoundsException { int len = "${setShareVar(${".length(); int scriptStart = 0; while ((scriptStart = rawScript.indexOf("${setShareVar(${", scriptStart)) != -1) { int start = -1; int end = rawScript.indexOf('}', scriptStart + len); String prop = rawScript.substring(scriptStart + len, end); start = rawScript.indexOf(',', end); end = rawScript.indexOf(')', start); String value = rawScript.substring(start + 1, end); start = rawScript.indexOf('}', start) + 1; end = rawScript.length(); String replaceScript = String.format("print(\"${{setValue({},{})}}\".format(\"%s\",%s))", prop, value); rawScript = rawScript.substring(0, scriptStart) + replaceScript + rawScript.substring(start, end); scriptStart += replaceScript.length(); } return rawScript; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
/* * Lcensed to the Apache Software Foundaton (ASF) under one or more * contrbutor lcense agreements. See the NOTICE fle dstrbuted wth * ths work for addtonal nformaton regardng copyrght ownershp. * The ASF lcenses ths fle to You under the Apache Lcense, Verson 2.0 * (the "Lcense"); you may not use ths fle except n complance wth * the Lcense. You may obtan a copy of the Lcense at * * http://www.apache.org/lcenses/LICENSE-2.0 * * Unless requred by applcable law or agreed to n wrtng, software * dstrbuted under the Lcense s dstrbuted on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, ether express or mpled. * See the Lcense for the specfc language governng permssons and * lmtatons under the Lcense. */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
package org.apache.dolphnscheduler.server.master.runner; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_RECOVERY_START_NODE_STRING; mport statc org.apache.dolphnscheduler.common.Constants.CMD_PARAM_START_NODE_NAMES; mport statc org.apache.dolphnscheduler.common.Constants.DEFAULT_WORKER_GROUP; mport statc org.apache.dolphnscheduler.common.Constants.SEC_2_MINUTES_TIME_UNIT; mport org.apache.dolphnscheduler.common.Constants; mport org.apache.dolphnscheduler.common.enums.CommandType; mport org.apache.dolphnscheduler.common.enums.DependResult; mport org.apache.dolphnscheduler.common.enums.Drect; mport org.apache.dolphnscheduler.common.enums.ExecutonStatus; mport org.apache.dolphnscheduler.common.enums.FalureStrategy; mport org.apache.dolphnscheduler.common.enums.Flag; mport org.apache.dolphnscheduler.common.enums.Prorty; mport org.apache.dolphnscheduler.common.enums.StateEvent; mport org.apache.dolphnscheduler.common.enums.StateEventType; mport org.apache.dolphnscheduler.common.enums.TaskDependType; mport org.apache.dolphnscheduler.common.enums.TaskTmeoutStrategy; mport org.apache.dolphnscheduler.common.enums.TmeoutFlag; mport org.apache.dolphnscheduler.common.graph.DAG; mport org.apache.dolphnscheduler.common.model.TaskNode; mport org.apache.dolphnscheduler.common.model.TaskNodeRelaton; mport org.apache.dolphnscheduler.common.process.ProcessDag; mport org.apache.dolphnscheduler.common.process.Property; mport org.apache.dolphnscheduler.common.thread.ThreadUtls; mport org.apache.dolphnscheduler.common.utls.CollectonUtls; mport org.apache.dolphnscheduler.common.utls.DateUtls; mport org.apache.dolphnscheduler.common.utls.JSONUtls; mport org.apache.dolphnscheduler.common.utls.NetUtls;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport org.apache.dolphnscheduler.common.utls.ParameterUtls; 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.ProjectUser; mport org.apache.dolphnscheduler.dao.entty.Schedule; mport org.apache.dolphnscheduler.dao.entty.TaskDefnton; mport org.apache.dolphnscheduler.dao.entty.TaskInstance; mport org.apache.dolphnscheduler.dao.utls.DagHelper; mport org.apache.dolphnscheduler.remote.command.HostUpdateCommand; mport org.apache.dolphnscheduler.remote.utls.Host; mport org.apache.dolphnscheduler.server.master.confg.MasterConfg; mport org.apache.dolphnscheduler.server.master.dspatch.executor.NettyExecutorManager; mport org.apache.dolphnscheduler.server.master.runner.task.ITaskProcessor; mport org.apache.dolphnscheduler.server.master.runner.task.TaskActon; mport org.apache.dolphnscheduler.server.master.runner.task.TaskProcessorFactory; mport org.apache.dolphnscheduler.servce.alert.ProcessAlertManager; mport org.apache.dolphnscheduler.servce.process.ProcessServce; mport org.apache.dolphnscheduler.servce.quartz.cron.CronUtls; mport org.apache.dolphnscheduler.servce.queue.PeerTaskInstancePrortyQueue; mport org.apache.commons.lang.StrngUtls; mport java.utl.ArrayLst; mport java.utl.Arrays; mport java.utl.Collecton; mport java.utl.Date; mport java.utl.HashMap; mport java.utl.Iterator; mport java.utl.Lst; mport java.utl.Map; mport java.utl.Objects;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
mport java.utl.Set; mport java.utl.concurrent.ConcurrentHashMap; mport java.utl.concurrent.ConcurrentLnkedQueue; mport java.utl.concurrent.ExecutorServce; mport org.slf4j.Logger; mport org.slf4j.LoggerFactory; mport com.google.common.collect.HashBasedTable; mport com.google.common.collect.Lsts; mport com.google.common.collect.Table; /** * master exec thread,splt dag */ publc class WorkflowExecuteThread mplements Runnable { /** * logger of WorkflowExecuteThread */ prvate statc fnal Logger logger = LoggerFactory.getLogger(WorkflowExecuteThread.class); /** * runng TaskNode */ prvate fnal Map<Integer, ITaskProcessor> actveTaskProcessorMaps = new ConcurrentHashMap<>(); /** * task exec servce */ prvate fnal ExecutorServce taskExecServce; /** * process nstance */ prvate ProcessInstance processInstance; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* submt falure nodes */ prvate boolean taskFaledSubmt = false; /** * recover node d lst */ prvate Lst<TaskInstance> recoverNodeIdLst = new ArrayLst<>(); /** * error task lst */ prvate Map<Strng, TaskInstance> errorTaskLst = new ConcurrentHashMap<>(); /** * complete task lst */ prvate Map<Strng, TaskInstance> completeTaskLst = new ConcurrentHashMap<>(); /** * ready to submt task queue */ prvate PeerTaskInstancePrortyQueue readyToSubmtTaskQueue = new PeerTaskInstancePrortyQueue(); /** * depend faled task map */ prvate Map<Strng, TaskInstance> dependFaledTask = new ConcurrentHashMap<>(); /** * forbdden task map */ prvate Map<Strng, TaskNode> forbddenTaskLst = new ConcurrentHashMap<>(); /** * skp task map */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate Map<Strng, TaskNode> skpTaskNodeLst = new ConcurrentHashMap<>(); /** * recover tolerance fault task lst */ prvate Lst<TaskInstance> recoverToleranceFaultTaskLst = new ArrayLst<>(); /** * alert manager */ prvate ProcessAlertManager processAlertManager; /** * the object of DAG */ prvate DAG<Strng, TaskNode, TaskNodeRelaton> dag; /** * process servce */ prvate ProcessServce processServce; /** * master confg */ prvate MasterConfg masterConfg; /** * */ prvate NettyExecutorManager nettyExecutorManager; prvate ConcurrentLnkedQueue<StateEvent> stateEvents = new ConcurrentLnkedQueue<>(); prvate Lst<Date> complementLstDate = Lsts.newLnkedLst(); prvate Table<Integer, Long, TaskInstance> taskInstanceHashMap = HashBasedTable.create(); prvate ProcessDefnton processDefnton; prvate Strng key;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst; /** * constructor of WorkflowExecuteThread * * @param processInstance processInstance * @param processServce processServce * @param nettyExecutorManager nettyExecutorManager * @param taskTmeoutCheckLst */ publc WorkflowExecuteThread(ProcessInstance processInstance , ProcessServce processServce , NettyExecutorManager nettyExecutorManager , ProcessAlertManager processAlertManager , MasterConfg masterConfg , ConcurrentHashMap<Integer, TaskInstance> taskTmeoutCheckLst) { ths.processServce = processServce; ths.processInstance = processInstance; ths.masterConfg = masterConfg; nt masterTaskExecNum = masterConfg.getMasterExecTaskNum(); ths.taskExecServce = ThreadUtls.newDaemonFxedThreadExecutor("Master-Task-Exec-Thread", masterTaskExecNum); ths.nettyExecutorManager = nettyExecutorManager; ths.processAlertManager = processAlertManager; ths.taskTmeoutCheckLst = taskTmeoutCheckLst; } @Overrde publc vod run() { try { startProcess(); handleEvents();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} catch (Excepton e) { logger.error("handler error:", e); } } prvate vod handleEvents() { whle (ths.stateEvents.sze() > 0) { try { StateEvent stateEvent = ths.stateEvents.peek(); f (stateEventHandler(stateEvent)) { ths.stateEvents.remove(stateEvent); } } catch (Excepton e) { logger.error("state handle error:", e); } } } publc Strng getKey() { f (StrngUtls.sNotEmpty(key) || ths.processDefnton == null) { return key; } key = Strng.format("{}_{}_{}", ths.processDefnton.getCode(), ths.processDefnton.getVerson(), ths.processInstance.getId()); return key; } publc boolean addStateEvent(StateEvent stateEvent) { f (processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.nfo("state event would be abounded :{}", stateEvent.toStrng());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
return false; } ths.stateEvents.add(stateEvent); return true; } publc nt eventSze() { return ths.stateEvents.sze(); } publc ProcessInstance getProcessInstance() { return ths.processInstance; } prvate boolean stateEventHandler(StateEvent stateEvent) { logger.nfo("process event: {}", stateEvent.toStrng()); f (!checkStateEvent(stateEvent)) { return false; } boolean result = false; swtch (stateEvent.getType()) { case PROCESS_STATE_CHANGE: result = processStateChangeHandler(stateEvent); break; case TASK_STATE_CHANGE: result = taskStateChangeHandler(stateEvent); break; case PROCESS_TIMEOUT: result = processTmeout(); break; case TASK_TIMEOUT: result = taskTmeout(stateEvent); break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
default: break; } f (result) { ths.stateEvents.remove(stateEvent); } return result; } prvate boolean taskTmeout(StateEvent stateEvent) { f (taskInstanceHashMap.contansRow(stateEvent.getTaskInstanceId())) { return true; } TaskInstance taskInstance = taskInstanceHashMap .row(stateEvent.getTaskInstanceId()) .values() .terator().next(); f (TmeoutFlag.CLOSE == taskInstance.getTaskDefne().getTmeoutFlag()) { return true; } TaskTmeoutStrategy taskTmeoutStrategy = taskInstance.getTaskDefne().getTmeoutNotfyStrategy(); f (TaskTmeoutStrategy.FAILED == taskTmeoutStrategy) { ITaskProcessor taskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId()); taskProcessor.acton(TaskActon.TIMEOUT); return false; } else { processAlertManager.sendTaskTmeoutAlert(processInstance, taskInstance, taskInstance.getTaskDefne()); return true; } } prvate boolean processTmeout() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
ths.processAlertManager.sendProcessTmeoutAlert(ths.processInstance, ths.processDefnton); return true; } prvate boolean taskStateChangeHandler(StateEvent stateEvent) { TaskInstance task = processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); f (stateEvent.getExecutonStatus().typeIsFnshed()) { taskFnshed(task); } else f (actveTaskProcessorMaps.contansKey(stateEvent.getTaskInstanceId())) { ITaskProcessor TaskProcessor = actveTaskProcessorMaps.get(stateEvent.getTaskInstanceId()); TaskProcessor.run(); f (TaskProcessor.taskState().typeIsFnshed()) { task = processServce.fndTaskInstanceById(stateEvent.getTaskInstanceId()); taskFnshed(task); } } else { logger.error("state handler error: {}", stateEvent.toStrng()); } return true; } prvate vod taskFnshed(TaskInstance task) { logger.nfo("work flow {} task {} state:{} ", processInstance.getId(), task.getId(), task.getState()); f (task.taskCanRetry()) { addTaskToStandByLst(task); return; } ProcessInstance processInstance = processServce.fndProcessInstanceById(ths.processInstance.getId()); completeTaskLst.put(task.getName(), task);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
actveTaskProcessorMaps.remove(task.getId()); taskTmeoutCheckLst.remove(task.getId()); f (task.getState().typeIsSuccess()) { processInstance.setVarPool(task.getVarPool()); processServce.saveProcessInstance(processInstance); submtPostNode(task.getName()); } else f (task.getState().typeIsFalure()) { f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(task.getName(), dag)) { submtPostNode(task.getName()); } else { errorTaskLst.put(task.getName(), task); f (processInstance.getFalureStrategy() == FalureStrategy.END) { kllAllTasks(); } } } ths.updateProcessInstanceState(); } prvate boolean checkStateEvent(StateEvent stateEvent) { f (ths.processInstance.getId() != stateEvent.getProcessInstanceId()) { logger.error("msmatch process nstance d: {}, state event:{}", ths.processInstance.getId(), stateEvent.toStrng()); return false; } return true; } prvate boolean processStateChangeHandler(StateEvent stateEvent) { try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
logger.nfo("process:{} state {} change to {}", processInstance.getId(), processInstance.getState(), stateEvent.getExecutonStatus()); processInstance = processServce.fndProcessInstanceById(ths.processInstance.getId()); f (processComplementData()) { return true; } f (stateEvent.getExecutonStatus().typeIsFnshed()) { endProcess(); } f (stateEvent.getExecutonStatus() == ExecutonStatus.READY_STOP) { kllAllTasks(); } return true; } catch (Excepton e) { logger.error("process state change error:", e); } return true; } prvate boolean processComplementData() throws Excepton { f (!needComplementProcess()) { return false; } Date scheduleDate = processInstance.getScheduleTme(); f (scheduleDate == null) { scheduleDate = complementLstDate.get(0); } else f (processInstance.getState().typeIsFnshed()) { endProcess(); nt ndex = complementLstDate.ndexOf(scheduleDate); f (ndex >= complementLstDate.sze() - 1 || !processInstance.getState().typeIsSuccess()) { return false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
} scheduleDate = complementLstDate.get(ndex + 1); processInstance.setId(0); } processInstance.setScheduleTme(scheduleDate); Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); f (cmdParam.contansKey(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING)) { cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING); processInstance.setCommandParam(JSONUtls.toJsonStrng(cmdParam)); } processInstance.setState(ExecutonStatus.RUNNING_EXECUTION); processInstance.setGlobalParams(ParameterUtls.curngGlobalParams( processDefnton.getGlobalParamMap(), processDefnton.getGlobalParamLst(), CommandType.COMPLEMENT_DATA, processInstance.getScheduleTme())); processInstance.setStartTme(new Date()); processInstance.setEndTme(null); processServce.saveProcessInstance(processInstance); ths.taskInstanceHashMap.clear(); startProcess(); return true; } prvate boolean needComplementProcess() { f (processInstance.sComplementData() && Flag.NO == processInstance.getIsSubProcess()) { return true; } return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
prvate vod startProcess() throws Excepton { buldFlowDag(); f (ths.taskInstanceHashMap.sze() == 0) { ntTaskQueue(); submtPostNode(null); } } /** * process end handle */ prvate vod endProcess() { ths.stateEvents.clear(); processInstance.setEndTme(new Date()); processServce.updateProcessInstance(processInstance); f (processInstance.getState().typeIsWatngThread()) { processServce.createRecoveryWatngThreadCommand(null, processInstance); } Lst<TaskInstance> taskInstances = processServce.fndValdTaskLstByProcessId(processInstance.getId()); ProjectUser projectUser = processServce.queryProjectWthUserByProcessInstanceId(processInstance.getId()); processAlertManager.sendAlertProcessInstance(processInstance, taskInstances, projectUser); } /** * generate process dag * * @throws Excepton excepton */ prvate vod buldFlowDag() throws Excepton { f (ths.dag != null) { return; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
processDefnton = processServce.fndProcessDefnton(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson()); recoverNodeIdLst = getStartTaskInstanceLst(processInstance.getCommandParam()); Lst<TaskNode> taskNodeLst = processServce.genTaskNodeLst(processInstance.getProcessDefntonCode(), processInstance.getProcessDefntonVerson(), new HashMap<>()); forbddenTaskLst.clear(); taskNodeLst.forEach(taskNode -> { f (taskNode.sForbdden()) { forbddenTaskLst.put(taskNode.getName(), taskNode); } }); Lst<Strng> recoveryNameLst = getRecoveryNodeNameLst(); Lst<Strng> startNodeNameLst = parseStartNodeName(processInstance.getCommandParam()); ProcessDag processDag = generateFlowDag(taskNodeLst, startNodeNameLst, recoveryNameLst, 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(); dependFaledTask.clear();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
completeTaskLst.clear(); errorTaskLst.clear(); Lst<TaskInstance> taskInstanceLst = processServce.fndValdTaskLstByProcessId(processInstance.getId()); for (TaskInstance task : taskInstanceLst) { f (task.sTaskComplete()) { completeTaskLst.put(task.getName(), task); } f (task.sCondtonsTask() || DagHelper.haveCondtonsAfterNode(task.getName(), dag)) { contnue; } f (task.getState().typeIsFalure() && !task.taskCanRetry()) { errorTaskLst.put(task.getName(), task); } } f (complementLstDate.sze() == 0 && needComplementProcess()) { Map<Strng, Strng> cmdParam = JSONUtls.toMap(processInstance.getCommandParam()); Date startDate = DateUtls.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE)); Date endDate = DateUtls.getScheduleDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE)); f (startDate.after(endDate)) { Date tmp = startDate; startDate = endDate; endDate = tmp; } Lst<Schedule> schedules = processServce.queryReleaseSchedulerLstByProcessDefntonCode(processInstance.getProcessDefntonCode()); complementLstDate.addAll(CronUtls.getSelfFreDateLst(startDate, endDate, schedules)); logger.nfo(" process defnton code:{} complement data: {}", processInstance.getProcessDefntonCode(), complementLstDate.toStrng()); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* submt task to execute * * @param taskInstance task nstance * @return TaskInstance */ prvate TaskInstance submtTaskExec(TaskInstance taskInstance) { try { ITaskProcessor taskProcessor = TaskProcessorFactory.getTaskProcessor(taskInstance.getTaskType()); f (taskInstance.getState() == ExecutonStatus.RUNNING_EXECUTION && taskProcessor.getType().equalsIgnoreCase(Constants.COMMON_TASK_TYPE)) { notfyProcessHostUpdate(taskInstance); } boolean submt = taskProcessor.submt(taskInstance, processInstance, masterConfg.getMasterTaskCommtRetryTmes(), masterConfg.getMasterTaskCommtInterval()); f (submt) { ths.taskInstanceHashMap.put(taskInstance.getId(), taskInstance.getTaskCode(), taskInstance); actveTaskProcessorMaps.put(taskInstance.getId(), taskProcessor); taskProcessor.run(); addTmeoutCheck(taskInstance); TaskDefnton taskDefnton = processServce.fndTaskDefnton( taskInstance.getTaskCode(), taskInstance.getTaskDefntonVerson()); taskInstance.setTaskDefne(taskDefnton); f (taskProcessor.taskState().typeIsFnshed()) { StateEvent stateEvent = new StateEvent(); stateEvent.setProcessInstanceId(ths.processInstance.getId()); stateEvent.setTaskInstanceId(taskInstance.getId()); stateEvent.setExecutonStatus(taskProcessor.taskState()); stateEvent.setType(StateEventType.TASK_STATE_CHANGE); ths.stateEvents.add(stateEvent); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
return taskInstance; } else { logger.error("process d:{} name:{} submt standby task d:{} name:{} faled!", processInstance.getId(), processInstance.getName(), taskInstance.getId(), taskInstance.getName()); return null; } } catch (Excepton e) { logger.error("submt standby task error", e); return null; } } prvate vod notfyProcessHostUpdate(TaskInstance taskInstance) { f (StrngUtls.sEmpty(taskInstance.getHost())) { return; } try { HostUpdateCommand hostUpdateCommand = new HostUpdateCommand(); hostUpdateCommand.setProcessHost(NetUtls.getAddr(masterConfg.getLstenPort())); hostUpdateCommand.setTaskInstanceId(taskInstance.getId()); Host host = new Host(taskInstance.getHost()); nettyExecutorManager.doExecute(host, hostUpdateCommand.convert2Command()); } catch (Excepton e) { logger.error("notfy process host update", e); } } prvate vod addTmeoutCheck(TaskInstance taskInstance) { TaskDefnton taskDefnton = processServce.fndTaskDefnton( taskInstance.getTaskCode(), taskInstance.getTaskDefntonVerson()
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
); taskInstance.setTaskDefne(taskDefnton); f (TmeoutFlag.OPEN == taskDefnton.getTmeoutFlag()) { ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance); return; } f (taskInstance.sDependTask() || taskInstance.sSubProcess()) { ths.taskTmeoutCheckLst.put(taskInstance.getId(), taskInstance); } } /** * fnd task nstance n db. * n case submt more than one same name task n the same tme. * * @param taskCode task code * @param taskVerson task verson * @return TaskInstance */ prvate TaskInstance fndTaskIfExsts(Long taskCode, nt taskVerson) { Lst<TaskInstance> taskInstanceLst = processServce.fndValdTaskLstByProcessId(ths.processInstance.getId()); for (TaskInstance taskInstance : taskInstanceLst) { f (taskInstance.getTaskCode() == taskCode && taskInstance.getTaskDefntonVerson() == taskVerson) { return taskInstance; } } return null; } /** * encapsulaton task *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
6,194
[Bug] [Server] Master build dag error
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Perform multi version tasks ![image](https://user-images.githubusercontent.com/42576980/133109069-2b465273-4ebb-4f83-b9b4-ae0f8bce473d.png) ### What you expected to happen Normal execution ### How to reproduce Perform multi version tasks ### Anything else _No response_ ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/6194
https://github.com/apache/dolphinscheduler/pull/6195
7029062f4c2f247e9eac333e28e36e66b03fb435
71e2c8808b3a0871619af4968dfaaa423a90b4c6
"2021-09-13T15:09:21Z"
java
"2021-09-14T03:46:47Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/runner/WorkflowExecuteThread.java
* @param processInstance process nstance * @param taskNode taskNode * @return TaskInstance */ prvate TaskInstance createTaskInstance(ProcessInstance processInstance, TaskNode taskNode) { TaskInstance taskInstance = fndTaskIfExsts(taskNode.getCode(), taskNode.getVerson()); f (taskInstance == null) { taskInstance = new TaskInstance(); taskInstance.setTaskCode(taskNode.getCode()); taskInstance.setTaskDefntonVerson(taskNode.getVerson()); taskInstance.setName(taskNode.getName()); taskInstance.setState(ExecutonStatus.SUBMITTED_SUCCESS); taskInstance.setProcessInstanceId(processInstance.getId()); taskInstance.setTaskType(taskNode.getType().toUpperCase()); taskInstance.setAlertFlag(Flag.NO); taskInstance.setStartTme(null); taskInstance.setFlag(Flag.YES); taskInstance.setRetryTmes(0); taskInstance.setMaxRetryTmes(taskNode.getMaxRetryTmes()); taskInstance.setRetryInterval(taskNode.getRetryInterval());