status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
timestamp[us, tz=UTC]
language
stringclasses
5 values
commit_datetime
timestamp[us, tz=UTC]
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } private String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) { Pattern pattern = Pattern.compile(rgex); while (true) { Matcher m = pattern.matcher(content); if (!m.find()) { break; } String paramName = m.group(1); String paramValue = sqlParamsMap.get(paramName).getValue(); content = m.replaceFirst(paramValue); } return content; } /** * create function list * * @param udfFuncParameters udfFuncParameters * @param logger logger * @return */ private List<String> createFuncs(List<UdfFuncParameters> udfFuncParameters, Logger logger) { if (CollectionUtils.isEmpty(udfFuncParameters)) { logger.info("can't find udf function resource"); return null; } // b List<String> funcList = buildJarSql(udfFuncParameters); // b
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
List<String> tempFuncList = buildTempFuncSql(udfFuncParameters); funcList.addAll(tempFuncList); return funcList; } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildTempFuncSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> MessageFormat .format(CREATE_OR_REPLACE_FUNCTION_FORMAT, value.getFuncName(), value.getClassName())).collect(Collectors.toList()); } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildJarSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> { String defaultFS = value.getDefaultFS(); String prefixPath = defaultFS.startsWith("file://") ? "file://" : defaultFS; String uploadPath = CommonUtils.getHdfsUdfDir(value.getTenantCode()); String resourceFullName = value.getResourceName(); resourceFullName = resourceFullName.startsWith("/") ? resourceFullName : String.format("/%s", resourceFullName); return String.format("add jar %s%s%s", prefixPath, uploadPath, resourceFullName); }).collect(Collectors.toList()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_START; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_NODES;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS; import static org.apache.dolphinscheduler.common.Constants.COMMA; import static org.apache.dolphinscheduler.common.Constants.MAX_TASK_TIMEOUT; import static org.apache.dolphinscheduler.common.Constants.SCHEDULE_TIME_MAX_LENGTH; import org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ExecutorService; import org.apache.dolphinscheduler.api.service.MonitorService; import org.apache.dolphinscheduler.api.service.ProjectService; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.CommandType; import org.apache.dolphinscheduler.common.enums.ComplementDependentMode; import org.apache.dolphinscheduler.common.enums.CycleEnum; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.RunMode; import org.apache.dolphinscheduler.common.enums.TaskDependType; import org.apache.dolphinscheduler.common.enums.TaskGroupQueueStatus; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.DependentProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation; 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.TaskGroupQueue; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; import org.apache.dolphinscheduler.dao.repository.ProcessInstanceDao; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.remote.command.TaskExecuteStartCommand; import org.apache.dolphinscheduler.remote.command.WorkflowExecutingDataRequestCommand; import org.apache.dolphinscheduler.remote.command.WorkflowExecutingDataResponseCommand; import org.apache.dolphinscheduler.remote.command.WorkflowStateEventChangeCommand; import org.apache.dolphinscheduler.remote.dto.WorkflowExecuteDto; import org.apache.dolphinscheduler.remote.processor.StateEventCallbackService; import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.service.cron.CronUtils; import org.apache.dolphinscheduler.service.exceptions.CronParseException; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.fasterxml.jackson.core.type.TypeReference; import com.google.common.collect.Lists; /** * executor service impl */ @Service public class ExecutorServiceImpl extends BaseServiceImpl implements ExecutorService { private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceImpl.class); @Autowired private ProjectMapper projectMapper; @Autowired private ProjectService projectService; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private MonitorService monitorService; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
private ProcessInstanceMapper processInstanceMapper; @Autowired private ProcessService processService; @Autowired private ProcessInstanceDao processInstanceDao; @Autowired private StateEventCallbackService stateEventCallbackService; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private TaskGroupQueueMapper taskGroupQueueMapper; /** * execute process instance * * @param loginUser login user * @param projectCode project code * @param processDefinitionCode process definition code * @param cronTime cron time * @param commandType command type * @param failureStrategy failure strategy * @param startNodeList start nodelist * @param taskDependType node dependency type * @param warningType warning type * @param warningGroupId notify group id * @param processInstancePriority process instance priority * @param workerGroup worker group name * @param environmentCode environment code * @param runMode run mode
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @param timeout timeout * @param startParams the global param values which pass to new process instance * @param expectedParallelismNumber the expected parallelism number when execute complement in parallel mode * @param testFlag testFlag * @return execute process instance code */ @Override public Map<String, Object> execProcessInstance(User loginUser, long projectCode, long processDefinitionCode, String cronTime, CommandType commandType, FailureStrategy failureStrategy, String startNodeList, TaskDependType taskDependType, WarningType warningType, int warningGroupId, RunMode runMode, Priority processInstancePriority, String workerGroup, Long environmentCode, Integer timeout, Map<String, String> startParams, Integer expectedParallelismNumber, int dryRun, int testFlag, ComplementDependentMode complementDependentMode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_START); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (timeout <= 0 || timeout > MAX_TASK_TIMEOUT) { logger.warn("Parameter timeout is invalid, timeout:{}.", timeout); putMsg(result, Status.TASK_TIMEOUT_PARAMS_ERROR); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); result = checkProcessDefinitionValid(projectCode, processDefinition, processDefinitionCode, processDefinition.getVersion()); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (!checkTenantSuitable(processDefinition)) { logger.error("There is not any valid tenant for the process definition, processDefinitionCode:{}, processDefinitionName:{}.", processDefinition.getCode(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); return result; } if (!checkScheduleTimeNum(commandType, cronTime)) { putMsg(result, Status.SCHEDULE_TIME_NUMBER); return result; } if (!checkMasterExists(result)) { return result; } /** * create command */ int create = this.createCommand(commandType, processDefinition.getCode(), taskDependType, failureStrategy, startNodeList, cronTime, warningType, loginUser.getId(), warningGroupId, runMode, processInstancePriority, workerGroup, environmentCode, startParams, expectedParallelismNumber, dryRun, testFlag, complementDependentMode); if (create > 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
processDefinition.setWarningGroupId(warningGroupId); processDefinitionMapper.updateById(processDefinition); logger.info("Create command complete, processDefinitionCode:{}, commandCount:{}.", processDefinition.getCode(), create); putMsg(result, Status.SUCCESS); } else { logger.error("Start process instance failed because create command error, processDefinitionCode:{}.", processDefinition.getCode()); putMsg(result, Status.START_PROCESS_INSTANCE_ERROR); } return result; } /** * check whether master exists * * @param result result * @return master exists return true , otherwise return false */ private boolean checkMasterExists(Map<String, Object> result) { List<Server> masterServers = monitorService.getServerListFromRegistry(true); if (masterServers.isEmpty()) { logger.error("Master does not exist."); putMsg(result, Status.MASTER_NOT_EXISTS); return false; } return true; } /** * @param complementData * @param cronTime
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @return CommandType is COMPLEMENT_DATA and cronTime's number is not greater than 100 return true , otherwise return false */ private boolean checkScheduleTimeNum(CommandType complementData, String cronTime) { if (!CommandType.COMPLEMENT_DATA.equals(complementData)) { return true; } if (cronTime == null) { return true; } Map<String, String> cronMap = JSONUtils.toMap(cronTime); if (cronMap.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { String[] stringDates = cronMap.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST).split(COMMA); if (stringDates.length > SCHEDULE_TIME_MAX_LENGTH) { logger.warn("Parameter cornTime is bigger than {}.", SCHEDULE_TIME_MAX_LENGTH); return false; } } return true; } /** * check whether the process definition can be executed * * @param projectCode project code * @param processDefinition process definition * @param processDefineCode process definition code * @param version process instance verison * @return check result code */ @Override public Map<String, Object> checkProcessDefinitionValid(long projectCode, ProcessDefinition processDefinition,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
long processDefineCode, Integer version) { Map<String, Object> result = new HashMap<>(); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, projectCode:{}, processDefinitionCode:{}.", projectCode, processDefineCode); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(processDefineCode)); } else if (processDefinition.getReleaseState() != ReleaseState.ONLINE) { logger.warn("Process definition is not {}, processDefinitionCode:{}, version:{}.", ReleaseState.ONLINE.getDescp(), processDefineCode, version); putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, String.valueOf(processDefineCode), version); } else if (!checkSubProcessDefinitionValid(processDefinition)) { logger.warn("Subprocess definition of process definition is not {}, processDefinitionCode:{}.", ReleaseState.ONLINE.getDescp(), processDefineCode); putMsg(result, Status.SUB_PROCESS_DEFINE_NOT_RELEASE); } else { result.put(Constants.STATUS, Status.SUCCESS); } return result; } /** * check whether the current process has subprocesses and validate all subprocesses * * @param processDefinition * @return check result */ @Override public boolean checkSubProcessDefinitionValid(ProcessDefinition processDefinition) { List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryDownstreamByProcessDefinitionCode(processDefinition.getCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (processTaskRelations.isEmpty()) { return true; } Set<Long> relationCodes = processTaskRelations.stream().map(ProcessTaskRelation::getPostTaskCode).collect(Collectors.toSet()); List<TaskDefinition> taskDefinitions = taskDefinitionMapper.queryByCodeList(relationCodes); Set<Long> processDefinitionCodeSet = new HashSet<>(); taskDefinitions.stream() .filter(task -> TaskConstants.TASK_TYPE_SUB_PROCESS.equalsIgnoreCase(task.getTaskType())).forEach( taskDefinition -> processDefinitionCodeSet.add(Long.valueOf( JSONUtils.getNodeString(taskDefinition.getTaskParams(), Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE)))); if (processDefinitionCodeSet.isEmpty()) { return true; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryByCodes(processDefinitionCodeSet); return processDefinitions.stream() .filter(definition -> definition.getReleaseState().equals(ReleaseState.OFFLINE)) .collect(Collectors.toSet()) .isEmpty(); } /** * do action to process instance:pause, stop, repeat, recover from pause, recover from stop,rerun failed task * * @param loginUser login user * @param projectCode project code
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* @param processInstanceId process instance id * @param executeType execute type * @return execute result code */ @Override public Map<String, Object> execute(User loginUser, long projectCode, Integer processInstanceId, ExecuteType executeType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, ApiFuncIdentificationConstant.map.get(executeType)); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (!checkMasterExists(result)) { return result; } ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId) .orElseThrow(() -> new ServiceException(Status.PROCESS_INSTANCE_NOT_EXIST, processInstanceId)); ProcessDefinition processDefinition = processService.findProcessDefinition(processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); processDefinition.setReleaseState(ReleaseState.ONLINE); if (executeType != ExecuteType.STOP && executeType != ExecuteType.PAUSE) { result = checkProcessDefinitionValid(projectCode, processDefinition, processInstance.getProcessDefinitionCode(), processInstance.getProcessDefinitionVersion()); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return result; } } result = checkExecuteType(processInstance, executeType); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (!checkTenantSuitable(processDefinition)) { logger.error("There is not any valid tenant for the process definition, processDefinitionId:{}, processDefinitionCode:{}, ", processDefinition.getId(), processDefinition.getName()); putMsg(result, Status.TENANT_NOT_SUITABLE); } // g Map<String, Object> commandMap = JSONUtils.parseObject(processInstance.getCommandParam(), new TypeReference<Map<String, Object>>() { }); String startParams = null; if (MapUtils.isNotEmpty(commandMap) && executeType == ExecuteType.REPEAT_RUNNING) { Object startParamsJson = commandMap.get(Constants.CMD_PARAM_START_PARAMS); if (startParamsJson != null) { startParams = startParamsJson.toString(); } } switch (executeType) { case REPEAT_RUNNING: result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(), processDefinition.getVersion(), CommandType.REPEAT_RUNNING, startParams, processInstance.getTestFlag()); break; case RECOVER_SUSPENDED_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
processDefinition.getVersion(), CommandType.RECOVER_SUSPENDED_PROCESS, startParams, processInstance.getTestFlag()); break; case START_FAILURE_TASK_PROCESS: result = insertCommand(loginUser, processInstanceId, processDefinition.getCode(), processDefinition.getVersion(), CommandType.START_FAILURE_TASK_PROCESS, startParams, processInstance.getTestFlag()); break; case STOP: if (processInstance.getState() == WorkflowExecutionStatus.READY_STOP) { logger.warn("Process instance status is already {}, processInstanceName:{}.", WorkflowExecutionStatus.READY_STOP.getDesc(), processInstance.getName()); putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.STOP, WorkflowExecutionStatus.READY_STOP); } break; case PAUSE: if (processInstance.getState() == WorkflowExecutionStatus.READY_PAUSE) { logger.warn("Process instance status is already {}, processInstanceName:{}.", WorkflowExecutionStatus.READY_STOP.getDesc(), processInstance.getName()); putMsg(result, Status.PROCESS_INSTANCE_ALREADY_CHANGED, processInstance.getName(), processInstance.getState()); } else { result = updateProcessInstancePrepare(processInstance, CommandType.PAUSE, WorkflowExecutionStatus.READY_PAUSE); } break; default: logger.warn("Unknown execute type for process instance, processInstanceId:{}.", processInstance.getId()); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "unknown execute type");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
break; } return result; } @Override public Map<String, Object> forceStartTaskInstance(User loginUser, int queueId) { Map<String, Object> result = new HashMap<>(); TaskGroupQueue taskGroupQueue = taskGroupQueueMapper.selectById(queueId); // c ProcessInstance processInstance = processInstanceMapper.selectById(taskGroupQueue.getProcessId()); if (processInstance == null) { logger.error("Process instance does not exist, projectCode:{}, processInstanceId:{}.", taskGroupQueue.getProjectCode(), taskGroupQueue.getProcessId()); putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, taskGroupQueue.getProcessId()); return result; } if (!checkMasterExists(result)) { return result; } return forceStart(processInstance, taskGroupQueue); } /** * check tenant suitable * * @param processDefinition process definition * @return true if tenant suitable, otherwise return false */ private boolean checkTenantSuitable(ProcessDefinition processDefinition) { Tenant tenant = processService.getTenantForProcess(processDefinition.getTenantId(), processDefinition.getUserId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return tenant != null; } /** * Check the state of process instance and the type of operation match * * @param processInstance process instance * @param executeType execute type * @return check result code */ private Map<String, Object> checkExecuteType(ProcessInstance processInstance, ExecuteType executeType) { Map<String, Object> result = new HashMap<>(); WorkflowExecutionStatus executionStatus = processInstance.getState(); boolean checkResult = false; switch (executeType) { case PAUSE: if (executionStatus.isRunning()) { checkResult = true; } break; case STOP: if (executionStatus.canStop()) { checkResult = true; } break; case REPEAT_RUNNING: if (executionStatus.isFinished()) { checkResult = true; } break; case START_FAILURE_TASK_PROCESS:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (executionStatus.isFailure()) { checkResult = true; } break; case RECOVER_SUSPENDED_PROCESS: if (executionStatus.isPause() || executionStatus.isStop()) { checkResult = true; } break; default: break; } if (!checkResult) { putMsg(result, Status.PROCESS_INSTANCE_STATE_OPERATION_ERROR, processInstance.getName(), executionStatus.toString(), executeType.toString()); } else { putMsg(result, Status.SUCCESS); } return result; } /** * prepare to update process instance command type and status * * @param processInstance process instance * @param commandType command type * @param executionStatus execute status * @return update result */ private Map<String, Object> updateProcessInstancePrepare(ProcessInstance processInstance, CommandType commandType, WorkflowExecutionStatus executionStatus) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
Map<String, Object> result = new HashMap<>(); processInstance.setCommandType(commandType); processInstance.addHistoryCmd(commandType); processInstance.setStateWithDesc(executionStatus, commandType.getDescp() + "by ui"); int update = processInstanceDao.updateProcessInstance(processInstance); // d if (update > 0) { logger.info("Process instance state is updated to {} in database, processInstanceName:{}.", executionStatus.getDesc(), processInstance.getName()); // d // s WorkflowStateEventChangeCommand workflowStateEventChangeCommand = new WorkflowStateEventChangeCommand( processInstance.getId(), 0, processInstance.getState(), processInstance.getId(), 0); Host host = new Host(processInstance.getHost()); stateEventCallbackService.sendResult(host, workflowStateEventChangeCommand.convert2Command()); putMsg(result, Status.SUCCESS); } else { logger.error("Process instance state update error, processInstanceName:{}.", processInstance.getName()); putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * prepare to update process instance command type and status * * @param processInstance process instance * @return update result */ private Map<String, Object> forceStart(ProcessInstance processInstance, TaskGroupQueue taskGroupQueue) { Map<String, Object> result = new HashMap<>(); if (taskGroupQueue.getStatus() != TaskGroupQueueStatus.WAIT_QUEUE) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
logger.warn("Task group queue already starts, taskGroupQueueId:{}.", taskGroupQueue.getId()); putMsg(result, Status.TASK_GROUP_QUEUE_ALREADY_START); return result; } taskGroupQueue.setForceStart(Flag.YES.getCode()); processService.updateTaskGroupQueue(taskGroupQueue); logger.info("Sending force start command to master."); processService.sendStartTask2Master(processInstance, taskGroupQueue.getTaskId(), org.apache.dolphinscheduler.remote.command.CommandType.TASK_FORCE_STATE_EVENT_REQUEST); putMsg(result, Status.SUCCESS); return result; } /** * insert command, used in the implementation of the page, rerun, recovery (pause / failure) execution * * @param loginUser login user * @param instanceId instance id * @param processDefinitionCode process definition code * @param processVersion * @param commandType command type * @return insert result code */ private Map<String, Object> insertCommand(User loginUser, Integer instanceId, long processDefinitionCode, int processVersion, CommandType commandType, String startParams, int testFlag) { Map<String, Object> result = new HashMap<>(); // T Map<String, Object> cmdParam = new HashMap<>(); cmdParam.put(CMD_PARAM_RECOVER_PROCESS_ID_STRING, instanceId); if (!StringUtils.isEmpty(startParams)) { cmdParam.put(CMD_PARAM_START_PARAMS, startParams);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} Command command = new Command(); command.setCommandType(commandType); command.setProcessDefinitionCode(processDefinitionCode); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); command.setExecutorId(loginUser.getId()); command.setProcessDefinitionVersion(processVersion); command.setProcessInstanceId(instanceId); command.setTestFlag(testFlag); if (!processService.verifyIsNeedCreateCommand(command)) { logger.warn("Process instance is executing the command, processDefinitionCode:{}, processDefinitionVersion:{}, processInstanceId:{}.", processDefinitionCode, processVersion, instanceId); putMsg(result, Status.PROCESS_INSTANCE_EXECUTING_COMMAND, String.valueOf(processDefinitionCode)); return result; } logger.info("Creating command, commandInfo:{}.", command); int create = processService.createCommand(command); if (create > 0) { logger.info("Create {} command complete, processDefinitionCode:{}, processDefinitionVersion:{}.", command.getCommandType().getDescp(), command.getProcessDefinitionCode(), processVersion); putMsg(result, Status.SUCCESS); } else { logger.error("Execute process instance failed because create {} command error, processDefinitionCode:{}, processDefinitionVersion:{}, processInstanceId:{}.", command.getCommandType().getDescp(), command.getProcessDefinitionCode(), processVersion, instanceId); putMsg(result, Status.EXECUTE_PROCESS_INSTANCE_ERROR); } return result; } /** * check whether sub processes are offline before starting process definition
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* * @param processDefinitionCode process definition code * @return check result code */ @Override public Map<String, Object> startCheckByProcessDefinedCode(long processDefinitionCode) { Map<String, Object> result = new HashMap<>(); ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(processDefinitionCode); if (processDefinition == null) { logger.error("Process definition is not be found, processDefinitionCode:{}.", processDefinitionCode); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, "processDefinitionCode"); return result; } List<Long> codes = new ArrayList<>(); processService.recurseFindSubProcess(processDefinition.getCode(), codes); if (!codes.isEmpty()) { List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(codes); if (processDefinitionList != null) { for (ProcessDefinition processDefinitionTmp : processDefinitionList) { /** * if there is no online process, exit directly */ if (processDefinitionTmp.getReleaseState() != ReleaseState.ONLINE) { logger.warn("Subprocess definition {} of process definition {} is not {}.", processDefinitionTmp.getName(), processDefinition.getName(), ReleaseState.ONLINE.getDescp()); putMsg(result, Status.PROCESS_DEFINE_NOT_RELEASE, processDefinitionTmp.getName()); return result; } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} putMsg(result, Status.SUCCESS); return result; } /** * create command * * @param commandType commandType * @param processDefineCode processDefineCode * @param nodeDep nodeDep * @param failureStrategy failureStrategy * @param startNodeList startNodeList * @param schedule schedule * @param warningType warningType * @param executorId executorId * @param warningGroupId warningGroupId * @param runMode runMode * @param processInstancePriority processInstancePriority * @param workerGroup workerGroup * @param testFlag testFlag * @param environmentCode environmentCode * @return command id */ private int createCommand(CommandType commandType, long processDefineCode, TaskDependType nodeDep, FailureStrategy failureStrategy, String startNodeList, String schedule, WarningType warningType, int executorId, int warningGroupId, RunMode runMode, Priority processInstancePriority, String workerGroup, Long environmentCode, Map<String, String> startParams, Integer expectedParallelismNumber, int dryRun, int testFlag, ComplementDependentMode complementDependentMode) { /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* instantiate command schedule instance */ Command command = new Command(); Map<String, String> cmdParam = new HashMap<>(); if (commandType == null) { command.setCommandType(CommandType.START_PROCESS); } else { command.setCommandType(commandType); } command.setProcessDefinitionCode(processDefineCode); if (nodeDep != null) { command.setTaskDependType(nodeDep); } if (failureStrategy != null) { command.setFailureStrategy(failureStrategy); } if (!StringUtils.isEmpty(startNodeList)) { cmdParam.put(CMD_PARAM_START_NODES, startNodeList); } if (warningType != null) { command.setWarningType(warningType); } if (startParams != null && startParams.size() > 0) { cmdParam.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams)); } command.setCommandParam(JSONUtils.toJsonString(cmdParam)); command.setExecutorId(executorId); command.setWarningGroupId(warningGroupId); command.setProcessInstancePriority(processInstancePriority); command.setWorkerGroup(workerGroup);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
command.setEnvironmentCode(environmentCode); command.setDryRun(dryRun); command.setTestFlag(testFlag); ProcessDefinition processDefinition = processService.findProcessDefinitionByCode(processDefineCode); if (processDefinition != null) { command.setProcessDefinitionVersion(processDefinition.getVersion()); } command.setProcessInstanceId(0); // det if (commandType == CommandType.COMPLEMENT_DATA) { if (schedule == null || StringUtils.isEmpty(schedule)) { logger.error("Create {} type command error because parameter schedule is invalid.", command.getCommandType().getDescp()); return 0; } if (!isValidateScheduleTime(schedule)) { return 0; } try { logger.info("Start to create {} command, processDefinitionCode:{}.", command.getCommandType().getDescp(), processDefineCode); return createComplementCommandList(schedule, runMode, command, expectedParallelismNumber, complementDependentMode); } catch (CronParseException cronParseException) { // We // cro return 0; } } else { command.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating command, commandInfo:{}.", command); return processService.createCommand(command);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} } /** * create complement command * close left and close right * * @param scheduleTimeParam * @param runMode * @return */ protected int createComplementCommandList(String scheduleTimeParam, RunMode runMode, Command command, Integer expectedParallelismNumber, ComplementDependentMode complementDependentMode) throws CronParseException { int createCount = 0; String startDate = null; String endDate = null; String dateList = null; int dependentProcessDefinitionCreateCount = 0; runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam()); Map<String, String> scheduleParam = JSONUtils.toMap(scheduleTimeParam); if (scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { dateList = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST); dateList = removeDuplicates(dateList); } if (scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE) && scheduleParam.containsKey( CMDPARAM_COMPLEMENT_DATA_END_DATE)) { startDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); endDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
switch (runMode) { case RUN_MODE_SERIAL: { logger.info("RunMode of {} command is serial run, processDefinitionCode:{}.", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); if (StringUtils.isNotEmpty(dateList)) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, dateList); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating command, commandInfo:{}.", command); createCount = processService.createCommand(command); if (createCount > 0) logger.info("Create {} command complete, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); else logger.error("Create {} command error, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); } if (startDate != null && endDate != null) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startDate); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endDate); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating command, commandInfo:{}.", command); createCount = processService.createCommand(command); if (createCount > 0) logger.info("Create {} command complete, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); else logger.error("Create {} command error, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); // dep List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode( command.getProcessDefinitionCode()); if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) { logger.info("Complement dependent mode is off mode or Scheduler is empty, so skip create complement dependent command, processDefinitionCode:{}.", command.getProcessDefinitionCode()); } else { logger.info("Complement dependent mode is all dependent and Scheduler is not empty, need create complement dependent command, processDefinitionCode:{}.", command.getProcessDefinitionCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } break; } case RUN_MODE_PARALLEL: { logger.info("RunMode of {} command is parallel run, processDefinitionCode:{}.", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); if (startDate != null && endDate != null) { List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode( command.getProcessDefinitionCode()); List<ZonedDateTime> listDate = new ArrayList<>( CronUtils.getSelfFireDateList(DateUtils.stringToZoneDateTime(startDate), DateUtils.stringToZoneDateTime(endDate), schedules)); int listDateSize = listDate.size(); createCount = listDate.size(); if (!CollectionUtils.isEmpty(listDate)) { if (expectedParallelismNumber != null && expectedParallelismNumber != 0) { createCount = Math.min(createCount, expectedParallelismNumber); } logger.info("Complement command run in parallel mode, current expectedParallelismNumber:{}.", createCount); // Dis // The int itemsPerCommand = (listDateSize / createCount); int remainingItems = (listDateSize % createCount); int startDateIndex = 0; int endDateIndex = 0; for (int i = 1; i <= createCount; i++) { int extra = (i <= remainingItems) ? 1 : 0; int singleCommandItems = (itemsPerCommand + extra); if (i == 1) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
endDateIndex += singleCommandItems - 1; } else { startDateIndex = endDateIndex + 1; endDateIndex += singleCommandItems; } cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(listDate.get(startDateIndex))); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(listDate.get(endDateIndex))); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating command, commandInfo:{}.", command); if (processService.createCommand(command) > 0) logger.info("Create {} command complete, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); else logger.error("Create {} command error, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) { logger.info("Complement dependent mode is off mode or Scheduler is empty, so skip create complement dependent command, processDefinitionCode:{}.", command.getProcessDefinitionCode()); } else { logger.info("Complement dependent mode is all dependent and Scheduler is not empty, need create complement dependent command, processDefinitionCode:{}.", command.getProcessDefinitionCode()); dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } } } if (StringUtils.isNotEmpty(dateList)) { List<String> listDate = Arrays.asList(dateList.split(COMMA)); createCount = listDate.size(); if (!CollectionUtils.isEmpty(listDate)) { if (expectedParallelismNumber != null && expectedParallelismNumber != 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
createCount = Math.min(createCount, expectedParallelismNumber); } logger.info("Complement command run in parallel mode, current expectedParallelismNumber:{}.", createCount); for (List<String> stringDate : Lists.partition(listDate, createCount)) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, String.join(COMMA, stringDate)); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating command, commandInfo:{}.", command); if (processService.createCommand(command) > 0) logger.info("Create {} command complete, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); else logger.error("Create {} command error, processDefinitionCode:{}", command.getCommandType().getDescp(), command.getProcessDefinitionCode()); } } } break; } default: break; } logger.info("Create complement command count:{}, Create dependent complement command count:{}", createCount, dependentProcessDefinitionCreateCount); return createCount; } /** * create complement dependent command */ public int createComplementDependentCommand(List<Schedule> schedules, Command command) { int dependentProcessDefinitionCreateCount = 0; Command dependentCommand; try {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
dependentCommand = (Command) BeanUtils.cloneBean(command); } catch (Exception e) { logger.error("Copy dependent command error.", e); return dependentProcessDefinitionCreateCount; } List<DependentProcessDefinition> dependentProcessDefinitionList = getComplementDependentDefinitionList(dependentCommand.getProcessDefinitionCode(), CronUtils.getMaxCycle(schedules.get(0).getCrontab()), dependentCommand.getWorkerGroup()); dependentCommand.setTaskDependType(TaskDependType.TASK_POST); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { // If // and dependentCommand.setId(null); dependentCommand.setProcessDefinitionCode(dependentProcessDefinition.getProcessDefinitionCode()); dependentCommand.setProcessDefinitionVersion(dependentProcessDefinition.getProcessDefinitionVersion()); dependentCommand.setWorkerGroup(dependentProcessDefinition.getWorkerGroup()); Map<String, String> cmdParam = JSONUtils.toMap(dependentCommand.getCommandParam()); cmdParam.put(CMD_PARAM_START_NODES, String.valueOf(dependentProcessDefinition.getTaskDefinitionCode())); dependentCommand.setCommandParam(JSONUtils.toJsonString(cmdParam)); logger.info("Creating complement dependent command, commandInfo:{}.", command); dependentProcessDefinitionCreateCount += processService.createCommand(dependentCommand); } return dependentProcessDefinitionCreateCount; } /** * get complement dep list */ private List<DependentProcessDefinition> getComplementDependentDefinitionList(long processDefinitionCode, CycleEnum processDefinitionCycle, String workerGroup) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
List<DependentProcessDefinition> dependentProcessDefinitionList = processService.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode); return checkDependentProcessDefinitionValid(dependentProcessDefinitionList, processDefinitionCycle, workerGroup, processDefinitionCode); } /** * Check whether the dependency cycle of the dependent node is consistent with the schedule cycle of * the dep and if there is no worker group in the schedule, use the complement selection's * worker group */ private List<DependentProcessDefinition> checkDependentProcessDefinitionValid( List<DependentProcessDefinition> dependentProcessDefinitionList, CycleEnum processDefinitionCycle, String workerGroup, long upstreamProcessDefinitionCode) { List<DependentProcessDefinition> validDependentProcessDefinitionList = new ArrayList<>(); List<Long> processDefinitionCodeList = dependentProcessDefinitionList.stream().map(DependentProcessDefinition::getProcessDefinitionCode) .collect(Collectors.toList()); Map<Long, String> processDefinitionWorkerGroupMap = processService.queryWorkerGroupByProcessDefinitionCodes(processDefinitionCodeList); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { if (dependentProcessDefinition.getDependentCycle(upstreamProcessDefinitionCode) == processDefinitionCycle) { if (processDefinitionWorkerGroupMap .get(dependentProcessDefinition.getProcessDefinitionCode()) == null) { dependentProcessDefinition.setWorkerGroup(workerGroup); } validDependentProcessDefinitionList.add(dependentProcessDefinition); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return validDependentProcessDefinitionList; } /** * @param schedule * @return check error return 0, otherwise 1 */ private boolean isValidateScheduleTime(String schedule) { Map<String, String> scheduleResult = JSONUtils.toMap(schedule); if (scheduleResult == null) { return false; } if (scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { if (scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST) == null) { return false; } } if (scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) { String startDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); String endDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); if (startDate == null || endDate == null) { return false; } try { ZonedDateTime start = DateUtils.stringToZoneDateTime(startDate); ZonedDateTime end = DateUtils.stringToZoneDateTime(endDate); if (start == null || end == null) { return false; } if (start.isAfter(end)) { logger.error("Complement data parameter error, start time should be before end time, startDate:{}, endDate:{}.", start, end);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return false; } } catch (Exception ex) { logger.warn("Parse schedule time error, startDate:{}, endDate:{}.", startDate, endDate); return false; } } return true; } /** * @param scheduleTimeList * @return remove duplicate date list */ private String removeDuplicates(String scheduleTimeList) { if (StringUtils.isNotEmpty(scheduleTimeList)) { Set<String> dateSet = Arrays.stream(scheduleTimeList.split(COMMA)).map(String::trim).collect(Collectors.toSet()); return String.join(COMMA, dateSet); } return null; } /** * query executing data of processInstance by master * @param processInstanceId * @return */ @Override public WorkflowExecuteDto queryExecutingWorkflowByProcessInstanceId(Integer processInstanceId) { ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId).orElse(null); if (processInstance == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
logger.error("Process instance does not exist, processInstanceId:{}.", processInstanceId); return null; } Host host = new Host(processInstance.getHost()); WorkflowExecutingDataRequestCommand requestCommand = new WorkflowExecutingDataRequestCommand(); requestCommand.setProcessInstanceId(processInstanceId); org.apache.dolphinscheduler.remote.command.Command command = stateEventCallbackService.sendSync(host, requestCommand.convert2Command()); if (command == null) { logger.error("Query executing process instance from master error, processInstanceId:{}.", processInstanceId); return null; } WorkflowExecutingDataResponseCommand responseCommand = JSONUtils.parseObject(command.getBody(), WorkflowExecutingDataResponseCommand.class); return responseCommand.getWorkflowExecuteDto(); } @Override public Map<String, Object> execStreamTaskInstance(User loginUser, long projectCode, long taskDefinitionCode, int taskDefinitionVersion, int warningGroupId, String workerGroup, Long environmentCode, Map<String, String> startParams, int dryRun) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_START); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (!checkMasterExists(result)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return result; } // tod List<Server> masterServerList = monitorService.getServerListFromRegistry(true); Host host = new Host(masterServerList.get(0).getHost(), masterServerList.get(0).getPort()); TaskExecuteStartCommand taskExecuteStartCommand = new TaskExecuteStartCommand(); taskExecuteStartCommand.setExecutorId(loginUser.getId()); taskExecuteStartCommand.setExecutorName(loginUser.getUserName()); taskExecuteStartCommand.setProjectCode(projectCode); taskExecuteStartCommand.setTaskDefinitionCode(taskDefinitionCode); taskExecuteStartCommand.setTaskDefinitionVersion(taskDefinitionVersion); taskExecuteStartCommand.setWorkerGroup(workerGroup); taskExecuteStartCommand.setWarningGroupId(warningGroupId); taskExecuteStartCommand.setEnvironmentCode(environmentCode); taskExecuteStartCommand.setStartParams(startParams); taskExecuteStartCommand.setDryRun(dryRun); org.apache.dolphinscheduler.remote.command.Command response = stateEventCallbackService.sendSync(host, taskExecuteStartCommand.convert2Command()); if (response != null) { logger.info("Send task execute start command complete, response is {}.", response); putMsg(result, Status.SUCCESS); } else { logger.error("Start to execute stream task instance error, projectCode:{}, taskDefinitionCode:{}, taskVersion:{}.", projectCode, taskDefinitionCode, taskDefinitionVersion); putMsg(result, Status.START_TASK_INSTANCE_ERROR); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
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 * 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.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.VERSION_LIST; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_BATCH_COPY; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_CREATE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_DELETE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_DEFINITION_EXPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_EXPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_IMPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_ONLINE_OFFLINE; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE; import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_CODE; import static org.apache.dolphinscheduler.common.Constants.COPY_SUFFIX; import static org.apache.dolphinscheduler.common.Constants.DEFAULT_WORKER_GROUP; import static org.apache.dolphinscheduler.common.Constants.EMPTY_STRING; import static org.apache.dolphinscheduler.common.Constants.IMPORT_SUFFIX; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.COMPLEX_TASK_TYPES; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_SQL; import org.apache.dolphinscheduler.api.dto.DagDataSchedule; import org.apache.dolphinscheduler.api.dto.ScheduleParam; 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.exceptions.ServiceException; 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.service.WorkFlowLineageService; 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.ConditionType; import org.apache.dolphinscheduler.common.enums.FailureStrategy; import org.apache.dolphinscheduler.common.enums.Flag; import org.apache.dolphinscheduler.common.enums.Priority; import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.common.enums.TimeoutFlag; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.common.enums.WarningType; import org.apache.dolphinscheduler.common.graph.DAG; import org.apache.dolphinscheduler.common.lifecycle.ServerLifeCycleManager; import org.apache.dolphinscheduler.common.model.TaskNode; import org.apache.dolphinscheduler.common.model.TaskNodeRelation; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils; import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils.CodeGenerateException; import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.DagData; import org.apache.dolphinscheduler.dao.entity.DataSource; import org.apache.dolphinscheduler.dao.entity.DependentSimplifyDefinition; 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.TaskMainInfo; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionLogMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationLogMapper; 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.dao.model.PageListingResult; import org.apache.dolphinscheduler.dao.repository.ProcessDefinitionDao; import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.parameters.ParametersNode; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.service.task.TaskPluginManager; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import java.io.BufferedOutputStream; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import lombok.NonNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; 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.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import com.google.common.collect.Lists; /** * process definition service impl */ @Service 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;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
@Autowired private ProcessDefinitionLogMapper processDefinitionLogMapper; @Autowired private ProcessDefinitionMapper processDefinitionMapper; @Autowired private ProcessDefinitionDao processDefinitionDao; @Lazy @Autowired private ProcessInstanceService processInstanceService; @Autowired private TaskInstanceMapper taskInstanceMapper; @Autowired private ScheduleMapper scheduleMapper; @Autowired private ProcessService processService; @Autowired private ProcessTaskRelationMapper processTaskRelationMapper; @Autowired private ProcessTaskRelationLogMapper processTaskRelationLogMapper; @Autowired TaskDefinitionLogMapper taskDefinitionLogMapper; @Autowired private TaskDefinitionMapper taskDefinitionMapper; @Autowired private SchedulerService schedulerService; @Autowired private TenantMapper tenantMapper; @Autowired private DataSourceMapper dataSourceMapper; @Autowired
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
private TaskPluginManager taskPluginManager; @Autowired private WorkFlowLineageService workFlowLineageService; /** * 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 public Map<String, Object> createProcessDefinition(User loginUser, long projectCode, String name, String description, String globalParams, String locations, int timeout, String tenantCode, String taskRelationJson, String taskDefinitionJson,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
String otherParamsJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (checkDescriptionLength(description)) { logger.warn("Parameter description is too long."); throw new ServiceException(Status.DESCRIPTION_TOO_LONG_ERROR); } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.", definition.getName(), definition.getCode()); throw new ServiceException(Status.PROCESS_DEFINITION_NAME_EXIST, name); } List<TaskDefinitionLog> taskDefinitionLogs = generateTaskDefinitionList(taskDefinitionJson); List<ProcessTaskRelationLog> taskRelationList = generateTaskRelationList(taskRelationJson, taskDefinitionLogs); int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { logger.error("Tenant does not exist."); throw new ServiceException(Status.TENANT_NOT_EXIST); } tenantId = tenant.getId();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} long processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); ProcessDefinition processDefinition = new ProcessDefinition(projectCode, name, processDefinitionCode, description, globalParams, locations, timeout, loginUser.getId(), tenantId); processDefinition.setExecutionType(executionType); return createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs, otherParamsJson); } protected Map<String, Object> createDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) { Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { logger.error("Save task definition error."); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion == 0) { logger.error("Save process definition error, processCode:{}.", processDefinition.getCode()); throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } else logger.info("Save process definition complete, processCode:{}, processVersion:{}.", processDefinition.getCode(), insertVersion); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult != Constants.EXIT_CODE_SUCCESS) { logger.error("Save process task relations error, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR); } else logger.info("Save process task relations complete, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); saveOtherRelation(loginUser, processDefinition, result, otherParamsJson); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); return result; } private List<TaskDefinitionLog> generateTaskDefinitionList(String taskDefinitionJson) { try { List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); if (CollectionUtils.isEmpty(taskDefinitionLogs)) { logger.error("Generate task definition list failed, the given taskDefinitionJson is invalided: {}", taskDefinitionJson); throw new ServiceException(Status.DATA_IS_NOT_VALID, taskDefinitionJson); } for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskDefinitionLog.getTaskType()) .taskParams(taskDefinitionLog.getTaskParams()) .dependence(taskDefinitionLog.getDependence()) .build())) { logger.error( "Generate task definition list failed, the given task definition parameter is invalided, taskName: {}, taskDefinition: {}", taskDefinitionLog.getName(), taskDefinitionLog);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
throw new ServiceException(Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName()); } } return taskDefinitionLogs; } catch (ServiceException ex) { throw ex; } catch (Exception e) { logger.error("Generate task definition list failed, meet an unknown exception", e); throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR); } } private List<ProcessTaskRelationLog> generateTaskRelationList(String taskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs) { try { List<ProcessTaskRelationLog> taskRelationList = JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class); if (CollectionUtils.isEmpty(taskRelationList)) { logger.error("Generate task relation list failed the taskRelation list is empty, taskRelationJson: {}", taskRelationJson); throw new ServiceException(Status.DATA_IS_NOT_VALID); } List<ProcessTaskRelation> processTaskRelations = taskRelationList.stream() .map(processTaskRelationLog -> JSONUtils.parseObject(JSONUtils.toJsonString(processTaskRelationLog), ProcessTaskRelation.class)) .collect(Collectors.toList()); List<TaskNode> taskNodeList = processService.transformTask(processTaskRelations, 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());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes); if (CollectionUtils.isNotEmpty(codes)) { String taskCodes = StringUtils.join(codes, Constants.COMMA); logger.error("Task definitions do not exist, taskCodes:{}.", taskCodes); throw new ServiceException(Status.TASK_DEFINE_NOT_EXIST, taskCodes); } } if (graphHasCycle(taskNodeList)) { logger.error("Process DAG has cycle."); throw new ServiceException(Status.PROCESS_NODE_HAS_CYCLE); } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPostTaskCode() == 0) { logger.error("The post_task_code or post_task_version of processTaskRelationLog can not be zero, " + "processTaskRelationLogId:{}.", processTaskRelationLog.getId()); throw new ServiceException(Status.CHECK_PROCESS_TASK_RELATION_ERROR); } } return taskRelationList; } catch (ServiceException ex) { throw ex; } catch (Exception e) { logger.error("Check task relation list error, meet an unknown exception, given taskRelationJson: {}", taskRelationJson, e); throw new ServiceException(Status.REQUEST_PARAMS_NOT_VALID_ERROR); } } /** * query process definition list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* * @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, WORKFLOW_DEFINITION); 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 simple list * * @param loginUser login user * @param projectCode project code * @return definition simple list */ @Override public Map<String, Object> queryProcessDefinitionSimpleList(User loginUser, long projectCode) { Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<ProcessDefinition> processDefinitions = processDefinitionMapper.queryAllDefinitionList(projectCode); ArrayNode arrayNode = JSONUtils.createArrayNode(); for (ProcessDefinition processDefinition : processDefinitions) { ObjectNode processDefinitionNode = JSONUtils.createObjectNode(); processDefinitionNode.put("id", processDefinition.getId()); processDefinitionNode.put("code", processDefinition.getCode()); processDefinitionNode.put("name", processDefinition.getName()); processDefinitionNode.put("projectCode", processDefinition.getProjectCode()); arrayNode.add(processDefinitionNode); } result.put(Constants.DATA_LIST, arrayNode); putMsg(result, Status.SUCCESS); return result; } /** * query process definition list paging * * @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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
*/ @Override public PageInfo<ProcessDefinition> queryProcessDefinitionListPaging(@NonNull User loginUser, long projectCode, String searchVal, String otherParamsJson, Integer userId, Integer pageNo, Integer pageSize) { Project project = projectMapper.queryByCode(projectCode); projectService.checkProjectAndAuthThrowException(loginUser, project, WORKFLOW_DEFINITION); PageListingResult<ProcessDefinition> processDefinitionsPageListingResult = processDefinitionDao.listingProcessDefinition( pageNo, pageSize, searchVal, userId, projectCode); List<ProcessDefinition> processDefinitions = processDefinitionsPageListingResult.getRecords(); List<Long> processDefinitionCodes = processDefinitions.stream().map(ProcessDefinition::getCode).collect(Collectors.toList()); Map<Long, Schedule> scheduleMap = schedulerService.queryScheduleByProcessDefinitionCodes(processDefinitionCodes) .stream() .collect(Collectors.toMap(Schedule::getProcessDefinitionCode, Function.identity())); for (ProcessDefinition pd : processDefinitions) { ProcessDefinitionLog processDefinitionLog = processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion()); User user = userMapper.selectById(processDefinitionLog.getOperator()); pd.setModifyBy(user.getUserName()); Schedule schedule = scheduleMap.get(pd.getCode()); pd.setScheduleReleaseState(schedule == null ? null : schedule.getReleaseState()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize); pageInfo.setTotal((int) processDefinitionsPageListingResult.getTotalCount()); pageInfo.setTotalList(processDefinitions); return pageInfo; } /** * 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, WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, processCode:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); } else { Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId()); if (tenant != null) { processDefinition.setTenantCode(tenant.getTenantCode());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
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, WORKFLOW_DEFINITION); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, name); if (processDefinition == null) { logger.error("Process definition does not exist, projectCode:{}.", projectCode); 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 *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param loginUser login user * @param projectCode project code * @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 * @param otherParamsJson otherParamsJson handle other params * @return update result code */ @Override @Transactional 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, String otherParamsJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (checkDescriptionLength(description)) { logger.warn("Parameter description is too long."); putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR); return result; } List<TaskDefinitionLog> taskDefinitionLogs = generateTaskDefinitionList(taskDefinitionJson); List<ProcessTaskRelationLog> taskRelationList = generateTaskRelationList(taskRelationJson, taskDefinitionLogs); int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { logger.error("Tenant does not exist."); putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, processCode:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { logger.warn("Process definition is not allowed to be modified due to {}, processDefinitionCode:{}.", ReleaseState.ONLINE.getDescp(), processDefinition.getCode()); putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); return result; } if (!name.equals(processDefinition.getName())) { ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { logger.warn("Process definition with the same name already exists, processDefinitionCode:{}.", definition.getCode()); 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); processDefinition.setExecutionType(executionType); return updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, taskDefinitionLogs, otherParamsJson); } /** * Task want to delete whether used in other task, should throw exception when have be used. * * This function avoid delete task already dependencies by other tasks by accident. * * @param processDefinition ProcessDefinition you change task definition and task relation
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
* @param taskRelationList All the latest task relation list from process definition */ private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition, List<ProcessTaskRelationLog> taskRelationList) { List<ProcessTaskRelation> oldProcessTaskRelationList = processTaskRelationMapper .queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()); Set<ProcessTaskRelationLog> oldProcessTaskRelationSet = oldProcessTaskRelationList.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toSet()); StringBuilder sb = new StringBuilder(); for (ProcessTaskRelationLog oldProcessTaskRelation : oldProcessTaskRelationSet) { boolean oldTaskExists = taskRelationList.stream() .anyMatch(relation -> oldProcessTaskRelation.getPostTaskCode() == relation.getPostTaskCode()); if (!oldTaskExists) { Optional<String> taskDepMsg = workFlowLineageService.taskDepOnTaskMsg( processDefinition.getProjectCode(), oldProcessTaskRelation.getProcessDefinitionCode(), oldProcessTaskRelation.getPostTaskCode()); taskDepMsg.ifPresent(sb::append); } if (sb.length() != 0) { logger.error("Task cannot be deleted because it is dependent"); throw new ServiceException(sb.toString()); } } } protected Map<String, Object> updateDagDefine(User loginUser, List<ProcessTaskRelationLog> taskRelationList, ProcessDefinition processDefinition, ProcessDefinition processDefinitionDeepCopy, List<TaskDefinitionLog> taskDefinitionLogs, String otherParamsJson) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, Object> result = new HashMap<>(); int saveTaskResult = processService.saveTaskDefine(loginUser, processDefinition.getProjectCode(), taskDefinitionLogs, Boolean.TRUE); if (saveTaskResult == Constants.EXIT_CODE_SUCCESS) { logger.info("The task has not changed, so skip"); } if (saveTaskResult == Constants.DEFINITION_FAILURE) { logger.error("Update task definitions error, projectCode:{}, processCode:{}.", processDefinition.getProjectCode(), processDefinition.getCode()); putMsg(result, Status.UPDATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_TASK_DEFINITION_ERROR); } boolean isChange = false; if (processDefinition.equals(processDefinitionDeepCopy) && saveTaskResult == Constants.EXIT_CODE_SUCCESS) { List<ProcessTaskRelationLog> processTaskRelationLogList = processTaskRelationLogMapper .queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); if (taskRelationList.size() == processTaskRelationLogList.size()) { Set<ProcessTaskRelationLog> taskRelationSet = new HashSet<>(taskRelationList); Set<ProcessTaskRelationLog> processTaskRelationLogSet = new HashSet<>(processTaskRelationLogList); if (taskRelationSet.size() == processTaskRelationLogSet.size()) { taskRelationSet.removeAll(processTaskRelationLogSet); if (!taskRelationSet.isEmpty()) { isChange = true; } } else { isChange = true; } } else { isChange = true; } } else {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
isChange = true; } if (isChange) { logger.info("Process definition needs to be updated, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), processDefinition.getVersion()); processDefinition.setUpdateTime(new Date()); int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion <= 0) { logger.error("Update process definition error, processCode:{}.", processDefinition.getCode()); putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } else logger.info("Update process definition complete, processCode:{}, processVersion:{}.", processDefinition.getCode(), insertVersion); taskUsedInOtherTaskValid(processDefinition, taskRelationList); int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE); if (insertResult == Constants.EXIT_CODE_SUCCESS) { logger.info("Update process task relations complete, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } else { logger.error("Update process task relations error, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), insertVersion); putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR); } saveOtherRelation(loginUser, processDefinition, result, otherParamsJson); } else {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.info("Process definition does not need to be updated because there is no change, projectCode:{}, processCode:{}, processVersion:{}.", processDefinition.getProjectCode(), processDefinition.getCode(), processDefinition.getVersion()); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); } 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, long processDefinitionCode) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.verifyByDefineName(project.getCode(), name.trim()); if (processDefinition == null) { putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (processDefinitionCode != 0 && processDefinitionCode == processDefinition.getCode()) { putMsg(result, Status.SUCCESS); return result; } logger.warn("Process definition with the same name {} already exists, processDefinitionCode:{}.", processDefinition.getName(), processDefinition.getCode()); putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name.trim()); return result; } /** * Process definition want to delete whether used in other task, should throw exception when have be used. * * This function avoid delete process definition already dependencies by other tasks by accident. * * @param processDefinition ProcessDefinition you change task definition and task relation */ private void processDefinitionUsedInOtherTaskValid(ProcessDefinition processDefinition) { if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { logger.warn("Process definition can not be deleted due to {}, processDefinitionCode:{}.", ReleaseState.ONLINE.getDescp(), processDefinition.getCode()); throw new ServiceException(Status.PROCESS_DEFINE_STATE_ONLINE, processDefinition.getName()); } List<ProcessInstance> processInstances = processInstanceService .queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES); if (CollectionUtils.isNotEmpty(processInstances)) { logger.warn("Process definition can not be deleted because there are {} executing process instances, processDefinitionCode:{}", processInstances.size(), processDefinition.getCode()); throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_EXECUTING_FAIL, processInstances.size());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} Set<TaskMainInfo> taskDepOnProcess = workFlowLineageService .queryTaskDepOnProcess(processDefinition.getProjectCode(), processDefinition.getCode()); if (CollectionUtils.isNotEmpty(taskDepOnProcess)) { String taskDepDetail = taskDepOnProcess.stream() .map(task -> String.format(Constants.FORMAT_S_S_COLON, task.getProcessDefinitionName(), task.getTaskName())) .collect(Collectors.joining(Constants.COMMA)); logger.warn("Process definition can not be deleted due to being referenced by other tasks:{}, processDefinitionCode:{}", taskDepDetail, processDefinition.getCode()); throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL, taskDepDetail); } } /** * delete process definition by code * * @param loginUser login user * @param projectCode project code * @param code process definition code * @return delete result code */ @Override @Transactional 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, WORKFLOW_DEFINITION_DELETE); if (result.get(Constants.STATUS) != Status.SUCCESS) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, processCode:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) { logger.warn("User does not have permission for process definition, userId:{}, processDefinitionCode:{}.", loginUser.getId(), code); putMsg(result, Status.USER_NO_OPERATION_PERM); return result; } processDefinitionUsedInOtherTaskValid(processDefinition); Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code); if (scheduleObj != null) { if (scheduleObj.getReleaseState() == ReleaseState.OFFLINE) { int delete = scheduleMapper.deleteById(scheduleObj.getId()); if (delete == 0) { logger.error("Delete schedule of process definition error, processDefinitionCode:{}, scheduleId:{}.", code, scheduleObj.getId()); putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR); } } if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) { logger.warn("Process definition can not be deleted due to schedule {}, processDefinitionCode:{}, scheduleId:{}.", ReleaseState.ONLINE.getDescp(), processDefinition.getCode(), scheduleObj.getId()); putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } } int delete = processDefinitionMapper.deleteById(processDefinition.getId()); if (delete == 0) { logger.error("Delete process definition error, processDefinitionCode:{}.", code); putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } int deleteRelation = processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode()); if (deleteRelation == 0) { logger.warn("The process definition has not relation, it will be delete successfully, processDefinitionCode:{}.", code); } deleteOtherRelation(project, result, processDefinition); putMsg(result, Status.SUCCESS); 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 public Map<String, Object> releaseProcessDefinition(User loginUser, long projectCode, long code, ReleaseState releaseState) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
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, WORKFLOW_ONLINE_OFFLINE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, processDefinitionCode:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } switch (releaseState) { case ONLINE: List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion()); if (CollectionUtils.isEmpty(relationList)) { logger.warn("Process definition has no task relation, processDefinitionCode:{}.", code); putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } processDefinition.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); logger.info("Set process definition online, projectCode:{}, processDefinitionCode:{}.", projectCode, code);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
break; case OFFLINE: processDefinition.setReleaseState(releaseState); int updateProcess = processDefinitionMapper.updateById(processDefinition); Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code); if (updateProcess > 0) { logger.info("Set process definition offline, projectCode:{}, processDefinitionCode:{}.", projectCode, code); if (schedule != null) { schedule.setReleaseState(releaseState); int updateSchedule = scheduleMapper.updateById(schedule); if (updateSchedule == 0) { logger.error("Set schedule offline error, projectCode:{}, processDefinitionCode:{}, scheduleId:{}", projectCode, code, schedule.getId()); putMsg(result, Status.OFFLINE_SCHEDULE_ERROR); throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR); } else logger.info("Set schedule offline, projectCode:{}, processDefinitionCode:{}, scheduleId:{}", projectCode, code, schedule.getId()); schedulerService.deleteSchedule(project.getId(), schedule.getId()); } } 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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
*/ @Override public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes, HttpServletResponse response) { if (StringUtils.isEmpty(codes)) { logger.warn("Process definition codes to be exported is empty."); return; } Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_EXPORT); 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); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.error("Process definitions to be exported do not exist, processDefinitionCodes:{}.", defineCodeSet); return; } List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream() .filter(o -> projectCode == o.getProjectCode()).collect(Collectors.toList()); List<DagDataSchedule> dagDataSchedules = processDefinitionListInProject.stream().map(this::exportProcessDagData).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(dagDataSchedules)) { logger.info("Start download process definition file, processDefinitionCodes:{}.", defineCodeSet); downloadProcessDefinitionFile(response, dagDataSchedules);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} else logger.error("There is no exported process dag data."); } /** * download the process definition file */ protected void downloadProcessDefinitionFile(HttpServletResponse response, List<DagDataSchedule> dagDataSchedules) { response.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE); BufferedOutputStream buff = null; ServletOutputStream out = null; try { out = response.getOutputStream(); buff = new BufferedOutputStream(out); buff.write(JSONUtils.toJsonString(dagDataSchedules).getBytes(StandardCharsets.UTF_8)); buff.flush(); buff.close(); } catch (IOException e) { logger.warn("Export process definition fail", e); } finally { if (null != buff) { try { buff.close(); } catch (Exception e) { logger.warn("Buffer does not close", e); } } if (null != out) { try { out.close(); } catch (Exception e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.warn("Output stream does not close", e); } } } } /** * get export process dag data * * @param processDefinition process definition * @return DagDataSchedule */ public DagDataSchedule exportProcessDagData(ProcessDefinition processDefinition) { Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinition.getCode()); DagDataSchedule dagDataSchedule = new DagDataSchedule(processService.genDagData(processDefinition)); if (scheduleObj != null) { scheduleObj.setReleaseState(ReleaseState.OFFLINE); dagDataSchedule.setSchedule(scheduleObj); } return dagDataSchedule; } /** * import process definition * * @param loginUser login user * @param projectCode project code * @param file process metadata json file * @return import process */ @Override @Transactional
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
public Map<String, Object> importProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result; String dagDataScheduleJson = FileUtils.file2String(file); List<DagDataSchedule> dagDataScheduleList = JSONUtils.toList(dagDataScheduleJson, DagDataSchedule.class); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_EXPORT); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (CollectionUtils.isEmpty(dagDataScheduleList)) { logger.warn("Process definition file content is empty."); putMsg(result, Status.DATA_IS_NULL, "fileContent"); return result; } for (DagDataSchedule dagDataSchedule : dagDataScheduleList) { if (!checkAndImport(loginUser, projectCode, result, dagDataSchedule, EMPTY_STRING)) { return result; } } return result; } @Override @Transactional public Map<String, Object> importSqlProcessDefinition(User loginUser, long projectCode, MultipartFile file) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_IMPORT); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} String processDefinitionName = file.getOriginalFilename() == null ? file.getName() : file.getOriginalFilename(); int index = processDefinitionName.lastIndexOf("."); if (index > 0) { processDefinitionName = processDefinitionName.substring(0, index); } processDefinitionName = getNewName(processDefinitionName, IMPORT_SUFFIX); ProcessDefinition processDefinition; List<TaskDefinitionLog> taskDefinitionList = new ArrayList<>(); List<ProcessTaskRelationLog> processTaskRelationList = new ArrayList<>(); final int THRESHOLD_ENTRIES = 10000; final int THRESHOLD_SIZE = 1000000000; final double THRESHOLD_RATIO = 10; int totalEntryArchive = 0; int totalSizeEntry = 0; Map<String, DataSource> dataSourceCache = new HashMap<>(1); Map<String, Long> taskNameToCode = new HashMap<>(16); Map<String, List<String>> taskNameToUpstream = new HashMap<>(16); try ( ZipInputStream zIn = new ZipInputStream(file.getInputStream()); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) { processDefinition = new ProcessDefinition(projectCode, processDefinitionName, CodeGenerateUtils.getInstance().genCode(), "", "[]", null, 0, loginUser.getId(), loginUser.getTenantId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ZipEntry entry; while ((entry = zIn.getNextEntry()) != null) { totalEntryArchive++; int totalSizeArchive = 0; if (!entry.isDirectory()) { StringBuilder sql = new StringBuilder(); String taskName = null; String datasourceName = null; List<String> upstreams = Collections.emptyList(); String line; while ((line = bufferedReader.readLine()) != null) { int nBytes = line.getBytes(StandardCharsets.UTF_8).length; totalSizeEntry += nBytes; totalSizeArchive += nBytes; long compressionRatio = totalSizeEntry / entry.getCompressedSize(); if (compressionRatio > THRESHOLD_RATIO) { throw new IllegalStateException( "Ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack."); } int commentIndex = line.indexOf("-- "); if (commentIndex >= 0) { int colonIndex = line.indexOf(":", commentIndex); if (colonIndex > 0) { String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase(); String value = line.substring(colonIndex + 1).trim(); switch (key) { case "name": taskName = value; line = line.substring(0, commentIndex); break;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
case "upstream": upstreams = Arrays.stream(value.split(",")).map(String::trim) .filter(s -> !"".equals(s)).collect(Collectors.toList()); line = line.substring(0, commentIndex); break; case "datasource": datasourceName = value; line = line.substring(0, commentIndex); break; default: break; } } } if (!"".equals(line)) { sql.append(line).append("\n"); } } if (taskName == null) { taskName = entry.getName(); index = taskName.indexOf("/"); if (index > 0) { taskName = taskName.substring(index + 1); } index = taskName.lastIndexOf("."); if (index > 0) { taskName = taskName.substring(0, index); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
DataSource dataSource = dataSourceCache.get(datasourceName); if (dataSource == null) { dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser); } if (dataSource == null) { logger.error("Datasource does not found, may be its name is illegal."); putMsg(result, Status.DATASOURCE_NAME_ILLEGAL); return result; } dataSourceCache.put(datasourceName, dataSource); TaskDefinitionLog taskDefinition = buildNormalSqlTaskDefinition(taskName, dataSource, sql.substring(0, sql.length() - 1)); taskDefinitionList.add(taskDefinition); taskNameToCode.put(taskDefinition.getName(), taskDefinition.getCode()); taskNameToUpstream.put(taskDefinition.getName(), upstreams); } if (totalSizeArchive > THRESHOLD_SIZE) { throw new IllegalStateException( "the uncompressed data size is too much for the application resource capacity"); } if (totalEntryArchive > THRESHOLD_ENTRIES) { throw new IllegalStateException( "too much entries in this archive, can lead to inodes exhaustion of the system"); } } } catch (Exception e) { logger.error("Import process definition error.", e); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) { List<String> upstreams = taskNameToUpstream.get(entry.getKey()); if (CollectionUtils.isEmpty(upstreams) || (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue()); processTaskRelationList.add(processTaskRelation); continue; } for (String upstream : upstreams) { ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue()); processTaskRelationList.add(processTaskRelation); } } return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING); } private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) { ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog(); processTaskRelation.setPreTaskCode(preTaskCode); processTaskRelation.setPreTaskVersion(0); processTaskRelation.setPostTaskCode(postTaskCode); processTaskRelation.setPostTaskVersion(0); processTaskRelation.setConditionType(ConditionType.NONE); processTaskRelation.setName(""); return processTaskRelation; } private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) { if (isAdmin(loginUser)) { List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (CollectionUtils.isNotEmpty(dataSources)) { return dataSources.get(0); } } else { return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName); } return null; } private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource, String sql) throws CodeGenerateException { TaskDefinitionLog taskDefinition = new TaskDefinitionLog(); taskDefinition.setName(taskName); taskDefinition.setFlag(Flag.YES); SqlParameters sqlParameters = new SqlParameters(); sqlParameters.setType(dataSource.getType().name()); sqlParameters.setDatasource(dataSource.getId()); sqlParameters.setSql(sql.substring(0, sql.length() - 1)); sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal()); sqlParameters.setLocalParams(Collections.emptyList()); taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters)); taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); taskDefinition.setTaskType(TASK_TYPE_SQL); taskDefinition.setFailRetryTimes(0); taskDefinition.setFailRetryInterval(0); taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE); taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP); taskDefinition.setTaskPriority(Priority.MEDIUM); taskDefinition.setEnvironmentCode(-1); taskDefinition.setTimeout(0);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
taskDefinition.setDelayTime(0); taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN); taskDefinition.setVersion(0); taskDefinition.setResourceIds(""); return taskDefinition; } /** * check and import */ protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result, DagDataSchedule dagDataSchedule, String otherParamsJson) { if (!checkImportanceParams(dagDataSchedule, result)) { return false; } ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition(); String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1); String importProcessDefinitionName = getNewName(processDefinitionName, IMPORT_SUFFIX); Map<String, Object> checkResult = verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName, 0); if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) { putMsg(result, Status.SUCCESS); } else { result.putAll(checkResult); return false; } processDefinition.setName(importProcessDefinitionName); processDefinition.setId(0); processDefinition.setProjectCode(projectCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
processDefinition.setUserId(loginUser.getId()); try { processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { logger.error("Save process definition error because generate process definition code error, projectCode:{}.", projectCode, e); putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); return false; } List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList(); Map<Long, Long> taskCodeMap = new HashMap<>(); Date now = new Date(); List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>(); for (TaskDefinition taskDefinition : taskDefinitionList) { TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition); taskDefinitionLog.setName(taskDefinitionLog.getName()); 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 = CodeGenerateUtils.getInstance().genCode(); taskCodeMap.put(taskDefinitionLog.getCode(), code); taskDefinitionLog.setCode(code); } catch (CodeGenerateException e) { logger.error("Generate task definition code error, projectCode:{}, processDefinitionCode:{}", projectCode, processDefinition.getCode(), e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code"); return false;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} taskDefinitionLogList.add(taskDefinitionLog); } int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList); int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList); if ((logInsert & insert) == 0) { logger.error("Save task definition error, projectCode:{}, processDefinitionCode:{}", projectCode, processDefinition.getCode()); putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR); } List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList(); List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>(); for (ProcessTaskRelation processTaskRelation : taskRelationList) { ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation); if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); } if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) { processTaskRelationLog.setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); } processTaskRelationLog.setPreTaskVersion(Constants.VERSION_FIRST); processTaskRelationLog.setPostTaskVersion(Constants.VERSION_FIRST); taskRelationLogList.add(processTaskRelationLog); } if (StringUtils.isNotEmpty(processDefinition.getLocations()) && JSONUtils.checkJsonValid(processDefinition.getLocations())) { ArrayNode arrayNode = JSONUtils.parseArray(processDefinition.getLocations()); ArrayNode newArrayNode = JSONUtils.createArrayNode(); for (int i = 0; i < arrayNode.size(); i++) { ObjectNode newObjectNode = newArrayNode.addObject();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
JsonNode jsonNode = arrayNode.get(i); Long taskCode = taskCodeMap.get(jsonNode.get("taskCode").asLong()); if (Objects.nonNull(taskCode)) { newObjectNode.put("taskCode", taskCode); newObjectNode.set("x", jsonNode.get("x")); newObjectNode.set("y", jsonNode.get("y")); } } processDefinition.setLocations(newArrayNode.toString()); } processDefinition.setCreateTime(new Date()); processDefinition.setUpdateTime(new Date()); Map<String, Object> createDagResult = createDagDefine(loginUser, taskRelationLogList, processDefinition, Lists.newArrayList(), otherParamsJson); if (Status.SUCCESS.equals(createDagResult.get(Constants.STATUS))) { putMsg(createDagResult, Status.SUCCESS); } else { result.putAll(createDagResult); logger.error("Import process definition error, projectCode:{}, processDefinitionCode:{}.", projectCode, processDefinition.getCode()); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } 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) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
logger.error("Import process definition error due to save schedule fail, projectCode:{}, processDefinitionCode:{}.", projectCode, processDefinition.getCode()); putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR); throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR); } } logger.info("Import process definition complete, projectCode:{}, processDefinitionCode:{}.", projectCode, processDefinition.getCode()); return true; } /** * check importance params */ private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) { if (dagDataSchedule.getProcessDefinition() == null) { logger.warn("Process definition is null."); putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) { logger.warn("Task definition list is null."); putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList"); return false; } if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) { logger.warn("Process task relation list is null."); putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList"); return false; } return true; } private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName); if (processDefinition != null) { if (num > 1) { String str = processDefinitionName.substring(0, processDefinitionName.length() - 3); processDefinitionName = str + "(" + num + ")"; } else { processDefinitionName = processDefinition.getName() + "(" + num + ")"; } } else { return processDefinitionName; } return recursionProcessDefinitionName(projectCode, processDefinitionName, num + 1); } /** * check the process task relation json * * @param processTaskRelationJson process task relation json * @return check result code */ @Override public Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogsList) { Map<String, Object> result = new HashMap<>(); try { if (processTaskRelationJson == null) { logger.error("Process task relation data is null."); putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<ProcessTaskRelation> taskRelationList = JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class); List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList); if (CollectionUtils.isEmpty(taskNodes)) { logger.error("Task node data is empty."); putMsg(result, Status.PROCESS_DAG_IS_EMPTY); return result; } if (graphHasCycle(taskNodes)) { logger.error("Process DAG has cycle."); putMsg(result, Status.PROCESS_NODE_HAS_CYCLE); return result; } for (TaskNode taskNode : taskNodes) { if (!taskPluginManager.checkTaskParameters(ParametersNode.builder() .taskType(taskNode.getType()) .taskParams(taskNode.getTaskParams()) .dependence(taskNode.getDependence()) .switchResult(taskNode.getSwitchResult()) .build())) { logger.error("Task node {} parameter invalid.", taskNode.getName()); putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName()); return result; } CheckUtils.checkOtherParams(taskNode.getExtras()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
putMsg(result, Status.SUCCESS); } catch (Exception e) { result.put(Constants.STATUS, Status.INTERNAL_SERVER_ERROR_ARGS); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, e.getMessage()); logger.error(Status.INTERNAL_SERVER_ERROR_ARGS.getMsg(), e); } return result; } /** * get task node details based on process definition * * @param loginUser loginUser * @param projectCode project code * @param code process definition code * @return task node list */ @Override public Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser, long projectCode, long code) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, processDefinitionCode:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
DagData dagData = processService.genDagData(processDefinition); result.put(Constants.DATA_LIST, dagData.getTaskDefinitionList()); putMsg(result, Status.SUCCESS); return result; } /** * get task node details map based on process definition * * @param loginUser loginUser * @param projectCode project code * @param codes define codes * @return task node list */ @Override public Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser, long projectCode, String codes) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, null); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } Set<Long> defineCodeSet = Lists.newArrayList(codes.split(Constants.COMMA)).stream().map(Long::parseLong) .collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(defineCodeSet); if (CollectionUtils.isEmpty(processDefinitionList)) { logger.error("Process definitions do not exist, codes:{}.", defineCodeSet); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result; } HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId()) .forEach(userProject -> userProjects.put(userProject.getCode(), userProject)); List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream() .filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList()); if (CollectionUtils.isEmpty(processDefinitionListInProject)) { Set<Long> codesInProject = processDefinitionListInProject.stream() .map(ProcessDefinition::getCode).collect(Collectors.toSet()); logger.error("Process definitions do not exist in project, projectCode:{}, processDefinitionsCodes:{}.", processDefinitionListInProject.get(0).getProjectCode(), codesInProject); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes); return result; } Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>(); for (ProcessDefinition processDefinition : processDefinitionListInProject) { DagData dagData = processService.genDagData(processDefinition); taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList()); } result.put(Constants.DATA_LIST, taskNodeMap); putMsg(result, Status.SUCCESS); return result; } /** * query process definition all by project code * * @param loginUser loginUser * @param projectCode project code * @return process definitions in the project */ @Override
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
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, WORKFLOW_DEFINITION); 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; } /** * query process definition list by project code * * @param projectCode project code * @return process definition list in the project */ @Override public Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode) { Map<String, Object> result = new HashMap<>(); List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper.queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, null); result.put(Constants.DATA_LIST, processDefinitions); putMsg(result, Status.SUCCESS); return result; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
/** * query process definition list by process definition code * * @param projectCode project code * @param processDefinitionCode process definition code * @return task definition list in the process definition */ @Override public Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode) { Map<String, Object> result = new HashMap<>(); Set<Long> definitionCodesSet = new HashSet<>(); definitionCodesSet.add(processDefinitionCode); List<DependentSimplifyDefinition> processDefinitions = processDefinitionMapper .queryDefinitionListByProjectCodeAndProcessDefinitionCodes(projectCode, definitionCodesSet); List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryProcessTaskRelationsByProcessDefinitionCode( processDefinitions.get(0).getCode(), processDefinitions.get(0).getVersion()); List<TaskDefinitionLog> taskDefinitionLogsList = processService.genTaskDefineList(processTaskRelations); List<DependentSimplifyDefinition> taskDefinitionList = new ArrayList<>(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogsList) { DependentSimplifyDefinition dependentSimplifyDefinition = new DependentSimplifyDefinition(); dependentSimplifyDefinition.setCode(taskDefinitionLog.getCode()); dependentSimplifyDefinition.setName(taskDefinitionLog.getName()); dependentSimplifyDefinition.setVersion(taskDefinitionLog.getVersion()); taskDefinitionList.add(dependentSimplifyDefinition); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
result.put(Constants.DATA_LIST, taskDefinitionList); putMsg(result, Status.SUCCESS); return result; } /** * Encapsulates the TreeView structure * * @param projectCode project code * @param code process definition code * @param limit limit * @return tree view json data */ @Override public Map<String, Object> viewTree(User loginUser, long projectCode, long code, Integer limit) { Map<String, Object> result = new HashMap<>(); Project project = projectMapper.queryByCode(projectCode); result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_TREE_VIEW); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (null == processDefinition || projectCode != processDefinition.getProjectCode()) { logger.error("Process definition does not exist, code:{}.", code); putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition); Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>(); List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit); processInstanceList.forEach(processInstance -> processInstance .setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime()))); List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper .queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode())); Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream() .collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog)); if (limit < 0) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR); return result; } if (limit > processInstanceList.size()) { limit = processInstanceList.size(); } TreeViewDto parentTreeViewDto = new TreeViewDto(); parentTreeViewDto.setName("DAG"); parentTreeViewDto.setType(""); parentTreeViewDto.setCode(0L); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime(); parentTreeViewDto.getInstances() .add(new Instance(processInstance.getId(), processInstance.getName(), processInstance.getProcessDefinitionCode(), "", processInstance.getState().toString(), processInstance.getStartTime(), endTime, processInstance.getHost(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime()))); } List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>(); parentTreeViewDtoList.add(parentTreeViewDto); for (String startNode : dag.getBeginNode()) { runningNodeMap.put(startNode, parentTreeViewDtoList); } while (!ServerLifeCycleManager.isStopped()) { Set<String> postNodeList; Iterator<Map.Entry<String, List<TreeViewDto>>> iter = runningNodeMap.entrySet().iterator(); while (iter.hasNext()) { Map.Entry<String, List<TreeViewDto>> en = iter.next(); String nodeCode = en.getKey(); parentTreeViewDtoList = en.getValue(); TreeViewDto treeViewDto = new TreeViewDto(); TaskNode taskNode = dag.getNode(nodeCode); treeViewDto.setType(taskNode.getType()); treeViewDto.setCode(taskNode.getCode()); treeViewDto.setName(taskNode.getName()); for (int i = limit - 1; i >= 0; i--) { ProcessInstance processInstance = processInstanceList.get(i); TaskInstance taskInstance = taskInstanceMapper.queryByInstanceIdAndCode(processInstance.getId(), Long.parseLong(nodeCode)); if (taskInstance == null) { treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null")); } else { Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime(); Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
long subProcessCode = 0L; if (taskInstance.isSubProcess()) { TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode()); subProcessCode = Long.parseLong(JSONUtils.parseObject( taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText()); } treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(), taskInstance.getTaskCode(), taskInstance.getTaskType(), taskInstance.getState().toString(), taskInstance.getStartTime(), taskInstance.getEndTime(), taskInstance.getHost(), DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode)); } } for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) { pTreeViewDto.getChildren().add(treeViewDto); } postNodeList = dag.getSubsequentNodes(nodeCode); if (CollectionUtils.isNotEmpty(postNodeList)) { for (String nextNodeCode : postNodeList) { List<TreeViewDto> treeViewDtoList = waitingRunningNodeMap.get(nextNodeCode); if (CollectionUtils.isEmpty(treeViewDtoList)) { treeViewDtoList = new ArrayList<>(); } treeViewDtoList.add(treeViewDto); waitingRunningNodeMap.put(nextNodeCode, treeViewDtoList); } } runningNodeMap.remove(nodeCode);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} if (waitingRunningNodeMap.size() == 0) { break; } else { runningNodeMap.putAll(waitingRunningNodeMap); waitingRunningNodeMap.clear(); } } result.put(Constants.DATA_LIST, parentTreeViewDto); result.put(Constants.STATUS, Status.SUCCESS); result.put(Constants.MSG, Status.SUCCESS.getMsg()); return result; } /** * whether the graph has a ring * * @param taskNodeResponseList task node response list * @return if graph has cycle flag */ private boolean graphHasCycle(List<TaskNode> taskNodeResponseList) { DAG<String, TaskNode, String> graph = new DAG<>(); for (TaskNode taskNodeResponse : taskNodeResponseList) { graph.addNode(Long.toString(taskNodeResponse.getCode()), taskNodeResponse); } for (TaskNode taskNodeResponse : taskNodeResponseList) { List<String> preTasks = JSONUtils.toList(taskNodeResponse.getPreTasks(), String.class); if (CollectionUtils.isNotEmpty(preTasks)) { for (String preTask : preTasks) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
if (!graph.addEdge(preTask, Long.toString(taskNodeResponse.getCode()))) { return true; } } } } return graph.hasCycle(); } /** * batch copy process definition * * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override @Transactional public Map<String, Object> batchCopyProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode, WORKFLOW_BATCH_COPY); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, true); if (result.get(Constants.STATUS) == Status.NOT_SUPPORT_COPY_TASK_TYPE) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, true); return result; } /** * batch move process definition * Will be deleted * @param loginUser loginUser * @param projectCode projectCode * @param codes processDefinitionCodes * @param targetProjectCode targetProjectCode */ @Override @Transactional public Map<String, Object> batchMoveProcessDefinition(User loginUser, long projectCode, String codes, long targetProjectCode) { Map<String, Object> result = checkParams(loginUser, projectCode, codes, targetProjectCode, TASK_DEFINITION_MOVE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (projectCode == targetProjectCode) { logger.warn("Project code is same as target project code, projectCode:{}.", projectCode); return result; } List<String> failedProcessList = new ArrayList<>(); doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false); checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
return result; } private Map<String, Object> checkParams(User loginUser, long projectCode, String processDefinitionCodes, long targetProjectCode, String perm) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, perm); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (StringUtils.isEmpty(processDefinitionCodes)) { logger.error("Parameter processDefinitionCodes is empty, projectCode is {}.", projectCode); putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes); return result; } if (projectCode != targetProjectCode) { Project targetProject = projectMapper.queryByCode(targetProjectCode); Map<String, Object> targetResult = projectService.checkProjectAndAuth(loginUser, targetProject, targetProjectCode, perm); if (targetResult.get(Constants.STATUS) != Status.SUCCESS) { return targetResult; } } return result; } protected void doBatchOperateProcessDefinition(User loginUser, long targetProjectCode,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
List<String> failedProcessList, String processDefinitionCodes, Map<String, Object> result, boolean isCopy) { Set<Long> definitionCodes = Arrays.stream(processDefinitionCodes.split(Constants.COMMA)).map(Long::parseLong) .collect(Collectors.toSet()); List<ProcessDefinition> processDefinitionList = processDefinitionMapper.queryByCodes(definitionCodes); Set<Long> queryCodes = processDefinitionList.stream().map(ProcessDefinition::getCode).collect(Collectors.toSet()); Set<Long> diffCode = definitionCodes.stream().filter(code -> !queryCodes.contains(code)).collect(Collectors.toSet()); diffCode.forEach(code -> failedProcessList.add(code + "[null]")); for (ProcessDefinition processDefinition : processDefinitionList) { List<ProcessTaskRelation> processTaskRelations = processTaskRelationMapper.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()); List<ProcessTaskRelationLog> taskRelationList = processTaskRelations.stream().map(ProcessTaskRelationLog::new).collect(Collectors.toList()); processDefinition.setProjectCode(targetProjectCode); String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition); if (isCopy) { logger.info("Copy process definition..."); List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations); Map<Long, Long> taskCodeMap = new HashMap<>(); for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) { if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) { logger.error("Task types {} do not support copy.", taskDefinitionLog.getTaskType()); putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType()); return;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} try { long taskCode = CodeGenerateUtils.getInstance().genCode(); taskCodeMap.put(taskDefinitionLog.getCode(), taskCode); taskDefinitionLog.setCode(taskCode); } catch (CodeGenerateException e) { logger.error("Generate task definition code error, projectCode:{}.", targetProjectCode, e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS); } taskDefinitionLog.setProjectCode(targetProjectCode); taskDefinitionLog.setVersion(0); taskDefinitionLog.setName(taskDefinitionLog.getName()); } for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) { if (processTaskRelationLog.getPreTaskCode() > 0) { processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode())); } if (processTaskRelationLog.getPostTaskCode() > 0) { processTaskRelationLog .setPostTaskCode(taskCodeMap.get(processTaskRelationLog.getPostTaskCode())); } } final long oldProcessDefinitionCode = processDefinition.getCode(); try { processDefinition.setCode(CodeGenerateUtils.getInstance().genCode()); } catch (CodeGenerateException e) { logger.error("Generate process definition code error, projectCode:{}.", targetProjectCode, e); putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,081
[Bug] [View workflow instance] Error copying workflow instance.
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened Error copying workflow instance ### What you expected to happen Copying workflow succeeded ### How to reproduce Error copying workflow instance ### Anything else ![image](https://user-images.githubusercontent.com/111988192/191444690-409233a6-9745-40d1-bd7d-b184d635b350.png) ### Version 3.1.0-prepare ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12081
https://github.com/apache/dolphinscheduler/pull/12092
9b3b4e22b42eb976a997f36310a26629142a5315
fba5a8eaa0945f399733275341dfdcec11ab6b3d
2022-09-21T07:41:22Z
java
2022-09-22T01:52:32Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
} processDefinition.setId(0); processDefinition.setUserId(loginUser.getId()); processDefinition.setName(getNewName(processDefinition.getName(), COPY_SUFFIX)); final Date date = new Date(); processDefinition.setCreateTime(date); processDefinition.setUpdateTime(date); processDefinition.setReleaseState(ReleaseState.OFFLINE); if (StringUtils.isNotBlank(processDefinition.getLocations())) { ArrayNode jsonNodes = JSONUtils.parseArray(processDefinition.getLocations()); for (int i = 0; i < jsonNodes.size(); i++) { ObjectNode node = (ObjectNode) jsonNodes.path(i); node.put("taskCode", taskCodeMap.get(node.get("taskCode").asLong())); jsonNodes.set(i, node); } processDefinition.setLocations(JSONUtils.toJsonString(jsonNodes)); } Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(oldProcessDefinitionCode); if (scheduleObj != null) { scheduleObj.setProcessDefinitionCode(processDefinition.getCode()); scheduleObj.setReleaseState(ReleaseState.OFFLINE); scheduleObj.setCreateTime(date); scheduleObj.setUpdateTime(date); int insertResult = scheduleMapper.insert(scheduleObj); if (insertResult != 1) { logger.error("Schedule create error, processDefinitionCode:{}.", processDefinition.getCode()); putMsg(result, Status.CREATE_SCHEDULE_ERROR); throw new ServiceException(Status.CREATE_SCHEDULE_ERROR); }