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
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
*/
package org.apache.dolphinscheduler.api.python;
import java.io.IOException;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dolphinscheduler.api.configuration.PythonGatewayConfiguration;
import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.service.ProcessDefinitionService;
import org.apache.dolphinscheduler.api.service.ProjectService;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.service.SchedulerService;
import org.apache.dolphinscheduler.api.service.TaskDefinitionService;
import org.apache.dolphinscheduler.api.service.TenantService;
import org.apache.dolphinscheduler.api.service.UsersService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ComplementDependentMode;
import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ProgramType;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
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.UserType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.CodeGenerateUtils;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.ProjectUser;
import org.apache.dolphinscheduler.dao.entity.Queue;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.Schedule;
import org.apache.dolphinscheduler.dao.entity.TaskDefinition;
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.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectMapper;
import org.apache.dolphinscheduler.dao.mapper.ProjectUserMapper;
import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper;
import org.apache.dolphinscheduler.spi.enums.ResourceType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import py4j.GatewayServer;
@Component
public class PythonGateway {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
private static final Logger logger = LoggerFactory.getLogger(PythonGateway.class);
private static final FailureStrategy DEFAULT_FAILURE_STRATEGY = FailureStrategy.CONTINUE;
private static final Priority DEFAULT_PRIORITY = Priority.MEDIUM;
private static final Long DEFAULT_ENVIRONMENT_CODE = -1L;
private static final TaskDependType DEFAULT_TASK_DEPEND_TYPE = TaskDependType.TASK_POST;
private static final RunMode DEFAULT_RUN_MODE = RunMode.RUN_MODE_SERIAL;
private static final int DEFAULT_DRY_RUN = 0;
private static final ComplementDependentMode COMPLEMENT_DEPENDENT_MODE = ComplementDependentMode.OFF_MODE;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Autowired
private ProjectService projectService;
@Autowired
private TenantService tenantService;
@Autowired
private ExecutorService executorService;
@Autowired
private ProcessDefinitionService processDefinitionService;
@Autowired
private TaskDefinitionService taskDefinitionService;
@Autowired
private UsersService usersService;
@Autowired
private ResourcesService resourceService;
@Autowired
private ProjectMapper projectMapper;
@Autowired
private TaskDefinitionMapper taskDefinitionMapper;
@Autowired
private SchedulerService schedulerService;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private PythonGatewayConfiguration pythonGatewayConfiguration;
@Autowired
private ProjectUserMapper projectUserMapper;
private final User dummyAdminUser = new User() {
{
setId(Integer.MAX_VALUE);
setUserName("dummyUser");
setUserType(UserType.ADMIN_USER);
}
};
private final Queue queuePythonGateway = new Queue() {
{
setId(Integer.MAX_VALUE);
setQueueName("queuePythonGateway");
}
};
public String ping() {
return "PONG";
}
public Map<String, Object> genTaskCodeList(Integer genNum) {
return taskDefinitionService.genTaskCodeList(genNum);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
public Map<String, Long> getCodeAndVersion(String projectName, String processDefinitionName, String taskName) throws CodeGenerateUtils.CodeGenerateException {
Project project = projectMapper.queryByName(projectName);
Map<String, Long> result = new HashMap<>();
if (project == null) {
result.put("code", CodeGenerateUtils.getInstance().genCode());
result.put("version", 0L);
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName);
if (processDefinition == null) {
result.put("code", CodeGenerateUtils.getInstance().genCode());
result.put("version", 0L);
return result;
}
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(project.getCode(), processDefinition.getCode(), taskName);
if (taskDefinition == null) {
result.put("code", CodeGenerateUtils.getInstance().genCode());
result.put("version", 0L);
} else {
result.put("code", taskDefinition.getCode());
result.put("version", (long) taskDefinition.getVersion());
}
return result;
}
/**
* create or update process definition.
* If process definition do not exists in Project=`projectCode` would create a new one
* If process definition already exists in Project=`projectCode` would update it
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
*
* @param userName user name who create or update process definition
* @param projectName project name which process definition belongs to
* @param name process definition name
* @param description description
* @param globalParams global params
* @param schedule schedule for process definition, will not set schedule if null,
* and if would always fresh exists schedule if not null
* @param warningType warning type
* @param warningGroupId warning group id
* @param locations locations json object about all tasks
* @param timeout timeout for process definition working, if running time longer than timeout,
* task will mark as fail
* @param workerGroup run task in which worker group
* @param tenantCode tenantCode
* @param taskRelationJson relation json for nodes
* @param taskDefinitionJson taskDefinitionJson
* @param otherParamsJson otherParamsJson handle other params
* @return create result code
*/
public Long createOrUpdateProcessDefinition(String userName,
String projectName,
String name,
String description,
String globalParams,
String schedule,
String warningType,
int warningGroupId,
String locations,
int timeout,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
String workerGroup,
String tenantCode,
int releaseState,
String taskRelationJson,
String taskDefinitionJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType) {
User user = usersService.queryUser(userName);
Project project = projectMapper.queryByName(projectName);
long projectCode = project.getCode();
ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, name);
long processDefinitionCode;
if (processDefinition != null) {
processDefinitionCode = processDefinition.getCode();
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
Map<String, Object> result = processDefinitionService.updateProcessDefinition(user, projectCode, name, processDefinitionCode, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
} else {
Map<String, Object> result = processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams,
locations, timeout, tenantCode, taskRelationJson, taskDefinitionJson, otherParamsJson, executionType);
processDefinition = (ProcessDefinition) result.get(Constants.DATA_LIST);
processDefinitionCode = processDefinition.getCode();
}
if (schedule != null) {
createOrUpdateSchedule(user, projectCode, processDefinitionCode, schedule, workerGroup, warningType, warningGroupId);
}
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.getEnum(releaseState));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
return processDefinitionCode;
}
/**
* get process definition
*
* @param user user who create or update schedule
* @param projectCode project which process definition belongs to
* @param processDefinitionName process definition name
*/
private ProcessDefinition getProcessDefinition(User user, long projectCode, String processDefinitionName) {
Map<String, Object> verifyProcessDefinitionExists = processDefinitionService.verifyProcessDefinitionName(user, projectCode, processDefinitionName);
Status verifyStatus = (Status) verifyProcessDefinitionExists.get(Constants.STATUS);
ProcessDefinition processDefinition = null;
if (verifyStatus == Status.PROCESS_DEFINITION_NAME_EXIST) {
processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
} else if (verifyStatus != Status.SUCCESS) {
String msg = "Verify process definition exists status is invalid, neither SUCCESS or PROCESS_DEFINITION_NAME_EXIST.";
logger.error(msg);
throw new RuntimeException(msg);
}
return processDefinition;
}
/**
* create or update process definition schedule.
* It would always use latest schedule define in workflow-as-code, and set schedule online when
* it's not null
*
* @param user user who create or update schedule
* @param projectCode project which process definition belongs to
* @param processDefinitionCode process definition code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
* @param schedule schedule expression
* @param workerGroup work group
* @param warningType warning type
* @param warningGroupId warning group id
*/
private void createOrUpdateSchedule(User user,
long projectCode,
long processDefinitionCode,
String schedule,
String workerGroup,
String warningType,
int warningGroupId) {
Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(processDefinitionCode);
int scheduleId;
if (scheduleObj == null) {
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.ONLINE);
Map<String, Object> result = schedulerService.insertSchedule(user, projectCode, processDefinitionCode, schedule, WarningType.valueOf(warningType),
warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
scheduleId = (int) result.get("scheduleId");
} else {
scheduleId = scheduleObj.getId();
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinitionCode, ReleaseState.OFFLINE);
schedulerService.updateSchedule(user, projectCode, scheduleId, schedule, WarningType.valueOf(warningType),
warningGroupId, DEFAULT_FAILURE_STRATEGY, DEFAULT_PRIORITY, workerGroup, DEFAULT_ENVIRONMENT_CODE);
}
schedulerService.setScheduleState(user, projectCode, scheduleId, ReleaseState.ONLINE);
}
public void execProcessInstance(String userName,
String projectName,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
String processDefinitionName,
String cronTime,
String workerGroup,
String warningType,
int warningGroupId,
Integer timeout
) {
User user = usersService.queryUser(userName);
Project project = projectMapper.queryByName(projectName);
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(project.getCode(), processDefinitionName);
processDefinitionService.releaseProcessDefinition(user, project.getCode(), processDefinition.getCode(), ReleaseState.ONLINE);
executorService.execProcessInstance(user,
project.getCode(),
processDefinition.getCode(),
cronTime,
null,
DEFAULT_FAILURE_STRATEGY,
null,
DEFAULT_TASK_DEPEND_TYPE,
WarningType.valueOf(warningType),
warningGroupId,
DEFAULT_RUN_MODE,
DEFAULT_PRIORITY,
workerGroup,
DEFAULT_ENVIRONMENT_CODE,
timeout,
null,
null,
DEFAULT_DRY_RUN,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
COMPLEMENT_DEPENDENT_MODE
);
}
/*
Grant project's permission to user. Use when project's created user not current but
Python API use it to change process definition.
*/
private Integer grantProjectToUser(Project project, User user) {
Date now = new Date();
ProjectUser projectUser = new ProjectUser();
projectUser.setUserId(user.getId());
projectUser.setProjectId(project.getId());
projectUser.setPerm(Constants.AUTHORIZE_WRITABLE_PERM);
projectUser.setCreateTime(now);
projectUser.setUpdateTime(now);
return projectUserMapper.insert(projectUser);
}
/*
Grant or create project. Create a new project if project do not exists, and grant the project
permission to user if project exists but without permission to this user.
*/
public void createOrGrantProject(String userName, String name, String desc) {
User user = usersService.queryUser(userName);
Project project;
project = projectMapper.queryByName(name);
if (project == null) {
projectService.createProject(user, name, desc);
} else if (project.getUserId() != user.getId()) {
ProjectUser projectUser = projectUserMapper.queryProjectRelation(project.getId(), user.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
if (projectUser == null) {
grantProjectToUser(project, user);
}
}
}
public Project queryProjectByName(String userName, String projectName) {
User user = usersService.queryUser(userName);
return (Project) projectService.queryByName(user, projectName);
}
public void updateProject(String userName, Long projectCode, String projectName, String desc) {
User user = usersService.queryUser(userName);
projectService.update(user, projectCode, projectName, desc, userName);
}
public void deleteProject(String userName, Long projectCode) {
User user = usersService.queryUser(userName);
projectService.deleteProject(user, projectCode);
}
public Tenant createTenant(String tenantCode, String desc, String queueName) {
return tenantService.createTenantIfNotExists(tenantCode, desc, queueName, queueName);
}
public Result queryTenantList(String userName, String searchVal, Integer pageNo, Integer pageSize) {
User user = usersService.queryUser(userName);
return tenantService.queryTenantList(user, searchVal, pageNo, pageSize);
}
public void updateTenant(String userName, int id, String tenantCode, int queueId, String desc) throws Exception {
User user = usersService.queryUser(userName);
tenantService.updateTenant(user, id, tenantCode, queueId, desc);
}
public void deleteTenantById(String userName, Integer tenantId) throws Exception {
User user = usersService.queryUser(userName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
tenantService.deleteTenantById(user, tenantId);
}
public void createUser(String userName,
String userPassword,
String email,
String phone,
String tenantCode,
String queue,
int state) throws IOException {
usersService.createUserIfNotExists(userName, userPassword, email, phone, tenantCode, queue, state);
}
public User queryUser(int id) {
return usersService.queryUser(id);
}
public void updateUser(String userName, String userPassword, String email, String phone, String tenantCode, String queue, int state) throws Exception {
usersService.createUserIfNotExists(userName, userPassword, email, phone, tenantCode, queue, state);
}
public void deleteUser(String userName, int id) throws Exception {
User user = usersService.queryUser(userName);
usersService.deleteUserById(user, id);
}
/**
* Get datasource by given datasource name. It return map contain datasource id, type, name.
* Useful in Python API create sql task which need datasource information.
*
* @param datasourceName user who create or update schedule
*/
public Map<String, Object> getDatasourceInfo(String datasourceName) {
Map<String, Object> result = new HashMap<>();
List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName(datasourceName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
if (dataSourceList == null || dataSourceList.isEmpty()) {
String msg = String.format("Can not find any datasource by name %s", datasourceName);
logger.error(msg);
throw new IllegalArgumentException(msg);
} else if (dataSourceList.size() > 1) {
String msg = String.format("Get more than one datasource by name %s", datasourceName);
logger.error(msg);
throw new IllegalArgumentException(msg);
} else {
DataSource dataSource = dataSourceList.get(0);
result.put("id", dataSource.getId());
result.put("type", dataSource.getType().name());
result.put("name", dataSource.getName());
}
return result;
}
/**
* Get processDefinition by given processDefinitionName name. It return map contain processDefinition id, name, code.
* Useful in Python API create subProcess task which need processDefinition information.
*
* @param userName user who create or update schedule
* @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name
*/
public Map<String, Object> getProcessDefinitionInfo(String userName, String projectName, String processDefinitionName) {
Map<String, Object> result = new HashMap<>();
User user = usersService.queryUser(userName);
Project project = (Project) projectService.queryByName(user, projectName).get(Constants.DATA_LIST);
long projectCode = project.getCode();
ProcessDefinition processDefinition = getProcessDefinition(user, projectCode, processDefinitionName);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
if (processDefinition != null) {
processDefinitionService.releaseProcessDefinition(user, projectCode, processDefinition.getCode(), ReleaseState.ONLINE);
result.put("id", processDefinition.getId());
result.put("name", processDefinition.getName());
result.put("code", processDefinition.getCode());
} else {
String msg = String.format("Can not find valid process definition by name %s", processDefinitionName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
return result;
}
/**
* Get project, process definition, task code.
* Useful in Python API create dependent task which need processDefinition information.
*
* @param projectName project name which process definition belongs to
* @param processDefinitionName process definition name
* @param taskName task name
*/
public Map<String, Object> getDependentInfo(String projectName, String processDefinitionName, String taskName) {
Map<String, Object> result = new HashMap<>();
Project project = projectMapper.queryByName(projectName);
if (project == null) {
String msg = String.format("Can not find valid project by name %s", projectName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
long projectCode = project.getCode();
result.put("projectCode", projectCode);
ProcessDefinition processDefinition = processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition == null) {
String msg = String.format("Can not find valid process definition by name %s", processDefinitionName);
logger.error(msg);
throw new IllegalArgumentException(msg);
}
result.put("processDefinitionCode", processDefinition.getCode());
if (taskName != null) {
TaskDefinition taskDefinition = taskDefinitionMapper.queryByName(projectCode, processDefinition.getCode(), taskName);
result.put("taskDefinitionCode", taskDefinition.getCode());
}
return result;
}
/**
* Get resource by given program type and full name. It return map contain resource id, name.
* Useful in Python API create flink or spark task which need processDefinition information.
*
* @param programType program type one of SCALA, JAVA and PYTHON
* @param fullName full name of the resource
*/
public Map<String, Object> getResourcesFileInfo(String programType, String fullName) {
Map<String, Object> result = new HashMap<>();
Result<Object> resources = resourceService.queryResourceByProgramType(dummyAdminUser, ResourceType.FILE, ProgramType.valueOf(programType));
List<ResourceComponent> resourcesComponent = (List<ResourceComponent>) resources.getData();
List<ResourceComponent> namedResources = resourcesComponent.stream().filter(s -> fullName.equals(s.getFullName())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(namedResources)) {
String msg = String.format("Can not find valid resource by program type %s and name %s", programType, fullName);
logger.error(msg);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
throw new IllegalArgumentException(msg);
}
result.put("id", namedResources.get(0).getId());
result.put("name", namedResources.get(0).getName());
return result;
}
/**
* Get resource by given resource type and full name. It return map contain resource id, name.
* Useful in Python API create task which need processDefinition information.
*
* @param userName user who query resource
* @param fullName full name of the resource
*/
public Resource queryResourcesFileInfo(String userName, String fullName) {
return resourceService.queryResourcesFileInfo(userName, fullName);
}
/**
* create or update resource.
* If the folder is not already created, it will be
*
* @param userName user who create or update resource
* @param fullName The fullname of resource.Includes path and suffix.
* @param description description of resource
* @param resourceContent content of resource
* @return id of resource
*/
public Integer createOrUpdateResource(
String userName, String fullName, String description, String resourceContent) {
return resourceService.createOrUpdateResource(userName, fullName, description, resourceContent);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
|
@PostConstruct
public void init() {
if (pythonGatewayConfiguration.getEnabled()) {
this.start();
}
}
private void start() {
GatewayServer server;
try {
InetAddress gatewayHost = InetAddress.getByName(pythonGatewayConfiguration.getGatewayServerAddress());
InetAddress pythonHost = InetAddress.getByName(pythonGatewayConfiguration.getPythonAddress());
server = new GatewayServer(
this,
pythonGatewayConfiguration.getGatewayServerPort(),
pythonGatewayConfiguration.getPythonPort(),
gatewayHost,
pythonHost,
pythonGatewayConfiguration.getConnectTimeout(),
pythonGatewayConfiguration.getReadTimeout(),
null
);
GatewayServer.turnLoggingOn();
logger.info("PythonGatewayService started on: " + gatewayHost.toString());
server.start();
} catch (UnknownHostException e) {
logger.error("exception occurred while constructing PythonGatewayService().", e);
}
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.enums.ProcessExecutionTypeEnum;
import org.apache.dolphinscheduler.common.enums.ReleaseState;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition;
import org.apache.dolphinscheduler.dao.entity.Project;
import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog;
import org.apache.dolphinscheduler.dao.entity.User;
import org.springframework.web.multipart.MultipartFile;
/**
* process definition service
*/
public interface ProcessDefinitionService {
/**
* create process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* @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 create result code
*/
Map<String, Object> createProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
String locations,
int timeout,
String tenantCode,
String taskRelationJson,
String taskDefinitionJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType);
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
* @return definition list
*/
Map<String, Object> queryProcessDefinitionList(User loginUser,
long projectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
/**
* query process definition simple list
*
* @param loginUser login user
* @param projectCode project code
* @return definition simple list
*/
Map<String, Object> queryProcessDefinitionSimpleList(User loginUser,
long projectCode);
/**
* query process definition list paging
*
* @param loginUser login user
* @param projectCode project code
* @param searchVal search value
* @param otherParamsJson otherParamsJson handle other params
* @param pageNo page number
* @param pageSize page size
* @param userId user id
* @return process definition page
*/
Result queryProcessDefinitionListPaging(User loginUser,
long projectCode,
String searchVal,
String otherParamsJson,
Integer userId,
Integer pageNo,
Integer pageSize);
/**
* query detail of process definition
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionByCode(User loginUser,
long projectCode,
long code);
/**
* query detail of process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @return process definition detail
*/
Map<String, Object> queryProcessDefinitionByName(User loginUser,
long projectCode,
String name);
/**
* batch copy process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
Map<String, Object> batchCopyProcessDefinition(User loginUser,
long projectCode,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
String codes,
long targetProjectCode);
/**
* batch move process definition
*
* @param loginUser loginUser
* @param projectCode projectCode
* @param codes processDefinitionCodes
* @param targetProjectCode targetProjectCode
*/
Map<String, Object> batchMoveProcessDefinition(User loginUser,
long projectCode,
String codes,
long targetProjectCode);
/**
* update process definition, with whole process definition object including task definition, task relation and location.
*
* @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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
*/
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);
/**
* 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
*/
Map<String, Object> verifyProcessDefinitionName(User loginUser,
long projectCode,
String name);
/**
* delete process definition by code
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* @param code process definition code
* @return delete result code
*/
Map<String, Object> deleteProcessDefinitionByCode(User loginUser,
long projectCode,
long code);
/**
* 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
*/
Map<String, Object> releaseProcessDefinition(User loginUser,
long projectCode,
long code,
ReleaseState releaseState);
/**
* batch export process definition by codes
*
* @param loginUser login user
* @param projectCode project code
* @param codes process definition codes
* @param response http servlet response
*/
void batchExportProcessDefinitionByCodes(User loginUser,
long projectCode,
String codes,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
HttpServletResponse response);
/**
* import process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file process metadata json file
* @return import process
*/
Map<String, Object> importProcessDefinition(User loginUser,
long projectCode,
MultipartFile file);
/**
* import sql process definition
*
* @param loginUser login user
* @param projectCode project code
* @param file sql file, zip
* @return import process
*/
Map<String, Object> importSqlProcessDefinition(User loginUser,
long projectCode,
MultipartFile file);
/**
* check the process task relation json
*
* @param processTaskRelationJson process task relation json
* @return check result code
*/
Map<String, Object> checkProcessNodeList(String processTaskRelationJson, List<TaskDefinitionLog> taskDefinitionLogs);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
/**
* get task node details based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param code processDefinition code
* @return task node list
*/
Map<String, Object> getTaskNodeListByDefinitionCode(User loginUser,
long projectCode,
long code);
/**
* get task node details map based on process definition
*
* @param loginUser loginUser
* @param projectCode project code
* @param codes define code list
* @return task node list
*/
Map<String, Object> getNodeListMapByDefinitionCodes(User loginUser,
long projectCode,
String codes);
/**
* query process definition all by project code
*
* @param projectCode project code
* @return process definitions in the project
*/
Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode);
/**
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* query process definition list by project code
*
* @param projectCode project code
* @return process definitions in the project
*/
Map<String, Object> queryProcessDefinitionListByProjectCode(long projectCode);
/**
* query process definition list by project code
*
* @param projectCode project code
* @param processDefinitionCode process definition code
* @return process definitions in the project
*/
Map<String, Object> queryTaskDefinitionListByProcessDefinitionCode(long projectCode, Long processDefinitionCode);
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
Map<String, Object> viewTree(User loginUser,long projectCode, long code, Integer limit);
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* @return switch process definition version result code
*/
Map<String, Object> switchProcessDefinitionVersion(User loginUser,
long projectCode,
long code,
int version);
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
*/
Result queryProcessDefinitionVersions(User loginUser,
long projectCode,
int pageNo,
int pageSize,
long code);
/**
* delete one certain process definition by version number and process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param code process definition code
* @param version version number
* @return delele result code
*/
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
Map<String, Object> deleteProcessDefinitionVersion(User loginUser,
long projectCode,
long code,
int version);
/**
* create empty process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @return process definition code
*/
Map<String, Object> createEmptyProcessDefinition(User loginUser,
long projectCode,
String name,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
ProcessExecutionTypeEnum executionType);
/**
* update process definition basic info, not including task definition, task relation and location.
*
* @param loginUser login user
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams globalParams
* @param timeout timeout
* @param tenantCode tenantCode
* @param scheduleJson scheduleJson
* @param otherParamsJson otherParamsJson handle other params
* @param executionType executionType
* @return update result code
*/
Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
long projectCode,
String name,
long code,
String description,
String globalParams,
int timeout,
String tenantCode,
String scheduleJson,
String otherParamsJson,
ProcessExecutionTypeEnum executionType);
/**
* release process definition and schedule
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param releaseState releaseState
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java
|
* @return update result code
*/
Map<String, Object> releaseWorkflowAndSchedule(User loginUser,
long projectCode,
long code,
ReleaseState releaseState);
/**
* delete other relation
* @param project
* @param result
* @param processDefinition
*/
void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition);
/**
* save other relation
* @param loginUser
* @param processDefinition
* @param result
* @param otherParamsJson
*/
void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result, String otherParamsJson);
/**
* get Json String
* @param loginUser
* @param processDefinition
* @return Json String
*/
String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
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.
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.service.impl;
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;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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;
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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;
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.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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_SWITCH_TO_THIS_VERSION;
import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW;
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 javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public class ProcessDefinitionServiceImpl extends BaseServiceImpl implements ProcessDefinitionService {
private static final Logger logger = LoggerFactory.getLogger(ProcessDefinitionServiceImpl.class);
private static final String RELEASESTATE = "releaseState";
@Autowired
private ProjectMapper projectMapper;
@Autowired
private ProjectService projectService;
@Autowired
private UserMapper userMapper;
@Autowired
private ProcessDefinitionLogMapper processDefinitionLogMapper;
@Autowired
private ProcessDefinitionMapper processDefinitionMapper;
@Lazy
@Autowired
private ProcessInstanceService processInstanceService;
@Autowired
private TaskInstanceMapper taskInstanceMapper;
@Autowired
private ScheduleMapper scheduleMapper;
@Autowired
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @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,
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)){
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList =
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson =
checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
long processDefinitionCode;
try {
processDefinitionCode = CodeGenerateUtils.getInstance().genCode();
} catch (CodeGenerateException e) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
return result;
}
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) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
if (insertVersion == 0) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR);
}
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(),
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.CREATE_PROCESS_TASK_RELATION_ERROR);
throw new ServiceException(Status.CREATE_PROCESS_TASK_RELATION_ERROR);
}
saveOtherRelation(loginUser, processDefinition, result, otherParamsJson);
return result;
}
private Map<String, Object> checkTaskDefinitionList(List<TaskDefinitionLog> taskDefinitionLogs,
String taskDefinitionJson) {
Map<String, Object> result = new HashMap<>();
try {
if (taskDefinitionLogs.isEmpty()) {
logger.error("taskDefinitionJson invalid: {}", taskDefinitionJson);
putMsg(result, Status.DATA_IS_NOT_VALID, taskDefinitionJson);
return result;
}
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskDefinitionLog.getTaskType())
.taskParams(taskDefinitionLog.getTaskParams())
.dependence(taskDefinitionLog.getDependence())
.build())) {
logger.error("task definition {} parameter invalid", taskDefinitionLog.getName());
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskDefinitionLog.getName());
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
private Map<String, Object> checkTaskRelationList(List<ProcessTaskRelationLog> taskRelationList,
String taskRelationJson,
List<TaskDefinitionLog> taskDefinitionLogs) {
Map<String, Object> result = new HashMap<>();
try {
if (taskRelationList == null || taskRelationList.isEmpty()) {
logger.error("task relation list is null");
putMsg(result, Status.DATA_IS_NOT_VALID, taskRelationJson);
return result;
}
List<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());
Collection<Long> codes = CollectionUtils.subtract(postTaskCodes, taskNodeCodes);
if (CollectionUtils.isNotEmpty(codes)) {
logger.error("the task code is not exist");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.TASK_DEFINE_NOT_EXIST,
org.apache.commons.lang.StringUtils.join(codes, Constants.COMMA));
return result;
}
}
if (graphHasCycle(taskNodeList)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (ProcessTaskRelationLog processTaskRelationLog : taskRelationList) {
if (processTaskRelationLog.getPostTaskCode() == 0) {
logger.error("the post_task_code or post_task_version can't be zero");
putMsg(result, Status.CHECK_PROCESS_TASK_RELATION_ERROR);
return result;
}
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.REQUEST_PARAMS_NOT_VALID_ERROR);
result.put(Constants.MSG, e.getMessage());
}
return result;
}
/**
* query process definition list
*
* @param loginUser login user
* @param projectCode project code
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @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);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
*/
@Override
public Result queryProcessDefinitionListPaging(User loginUser, long projectCode, String searchVal,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String otherParamsJson, Integer userId, Integer pageNo,
Integer pageSize) {
Result result = new Result();
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> checkResult =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
Status resultStatus = (Status) checkResult.get(Constants.STATUS);
if (resultStatus != Status.SUCCESS) {
putMsg(result, resultStatus);
return result;
}
Page<ProcessDefinition> page = new Page<>(pageNo, pageSize);
IPage<ProcessDefinition> processDefinitionIPage = processDefinitionMapper.queryDefineListPaging(
page, searchVal, userId, project.getCode(), isAdmin(loginUser));
List<ProcessDefinition> records = processDefinitionIPage.getRecords();
for (ProcessDefinition pd : records) {
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(pd.getCode(), pd.getVersion());
User user = userMapper.selectById(processDefinitionLog.getOperator());
pd.setModifyBy(user.getUserName());
}
processDefinitionIPage.setRecords(records);
PageInfo<ProcessDefinition> pageInfo = new PageInfo<>(pageNo, pageSize);
pageInfo.setTotal((int) processDefinitionIPage.getTotal());
pageInfo.setTotalList(processDefinitionIPage.getRecords());
result.setData(pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
/**
* 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()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
} else {
Tenant tenant = tenantMapper.queryById(processDefinition.getTenantId());
if (tenant != null) {
processDefinition.setTenantCode(tenant.getTenantCode());
}
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
@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) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, name);
} else {
DagData dagData = processService.genDagData(processDefinition);
result.put(Constants.DATA_LIST, dagData);
putMsg(result, Status.SUCCESS);
}
return result;
}
/**
* update process definition
*
* @param loginUser login user
* @param projectCode project code
* @param name process definition name
* @param code process definition code
* @param description description
* @param globalParams global params
* @param locations locations for nodes
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @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);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if(checkDescriptionLength(description)){
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR);
return result;
}
List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class);
Map<String, Object> checkTaskDefinitions = checkTaskDefinitionList(taskDefinitionLogs, taskDefinitionJson);
if (checkTaskDefinitions.get(Constants.STATUS) != Status.SUCCESS) {
return checkTaskDefinitions;
}
List<ProcessTaskRelationLog> taskRelationList =
JSONUtils.toList(taskRelationJson, ProcessTaskRelationLog.class);
Map<String, Object> checkRelationJson =
checkTaskRelationList(taskRelationList, taskRelationJson, taskDefinitionLogs);
if (checkRelationJson.get(Constants.STATUS) != Status.SUCCESS) {
return checkRelationJson;
}
int tenantId = -1;
if (!Constants.DEFAULT.equals(tenantCode)) {
Tenant tenant = tenantMapper.queryByTenantCode(tenantCode);
if (tenant == null) {
putMsg(result, Status.TENANT_NOT_EXIST);
return result;
}
tenantId = tenant.getId();
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (processDefinition.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName());
return result;
}
if (!name.equals(processDefinition.getName())) {
ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name);
if (definition != null) {
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name);
return result;
}
}
ProcessDefinition processDefinitionDeepCopy =
JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class);
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
* @param taskRelationList All the latest task relation list from process definition
*/
private void taskUsedInOtherTaskValid(ProcessDefinition processDefinition,
List<ProcessTaskRelationLog> taskRelationList) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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) {
throw new ServiceException(sb.toString());
}
}
}
protected Map<String, Object> updateDagDefine(User loginUser,
List<ProcessTaskRelationLog> taskRelationList,
ProcessDefinition processDefinition,
ProcessDefinition processDefinitionDeepCopy,
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");
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
if (saveTaskResult == Constants.DEFINITION_FAILURE) {
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 {
isChange = true;
}
if (isChange) {
processDefinition.setUpdateTime(new Date());
int insertVersion =
processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (insertVersion <= 0) {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
taskUsedInOtherTaskValid(processDefinition, taskRelationList);
int insertResult = processService.saveTaskRelation(loginUser, processDefinition.getProjectCode(),
processDefinition.getCode(), insertVersion, taskRelationList, taskDefinitionLogs, Boolean.TRUE);
if (insertResult == Constants.EXIT_CODE_SUCCESS) {
putMsg(result, Status.SUCCESS);
result.put(Constants.DATA_LIST, processDefinition);
} else {
putMsg(result, Status.UPDATE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.UPDATE_PROCESS_DEFINITION_ERROR);
}
saveOtherRelation(loginUser, processDefinition, result, otherParamsJson);
} else {
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
public Map<String, Object> verifyProcessDefinitionName(User loginUser, long projectCode, String name) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, 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);
} else {
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) {
throw new ServiceException(Status.PROCESS_DEFINE_STATE_ONLINE, processDefinition.getName());
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<ProcessInstance> processInstances = processInstanceService
.queryByProcessDefineCodeAndStatus(processDefinition.getCode(), Constants.NOT_TERMINATED_STATES);
if (CollectionUtils.isNotEmpty(processInstances)) {
throw new ServiceException(Status.DELETE_PROCESS_DEFINITION_EXECUTING_FAIL, processInstances.size());
}
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));
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 =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
if (loginUser.getId() != processDefinition.getUserId() && loginUser.getUserType() != UserType.ADMIN_USER) {
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) {
putMsg(result, Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
throw new ServiceException(Status.DELETE_SCHEDULE_CRON_BY_ID_ERROR);
}
}
if (scheduleObj.getReleaseState() == ReleaseState.ONLINE) {
putMsg(result, Status.SCHEDULE_CRON_STATE_ONLINE, scheduleObj.getId());
return result;
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int delete = processDefinitionMapper.deleteById(processDefinition.getId());
if (delete == 0) {
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");
}
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) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_ONLINE_OFFLINE);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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()) {
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)) {
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
processDefinition.setReleaseState(releaseState);
processDefinitionMapper.updateById(processDefinition);
break;
case OFFLINE:
processDefinition.setReleaseState(releaseState);
int updateProcess = processDefinitionMapper.updateById(processDefinition);
Schedule schedule = scheduleMapper.queryByProcessDefinitionCode(code);
if (updateProcess > 0 && schedule != null) {
logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}",
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
projectCode, schedule.getId(), code);
schedule.setReleaseState(releaseState);
int updateSchedule = scheduleMapper.updateById(schedule);
if (updateSchedule == 0) {
putMsg(result, Status.OFFLINE_SCHEDULE_ERROR);
throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR);
}
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
*/
@Override
public void batchExportProcessDefinitionByCodes(User loginUser, long projectCode, String codes,
HttpServletResponse response) {
if (org.apache.commons.lang.StringUtils.isEmpty(codes)) {
return;
}
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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)) {
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)) {
downloadProcessDefinitionFile(response, dagDataSchedules);
}
}
/**
* 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));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
buff.flush();
buff.close();
} catch (IOException e) {
logger.warn("export process fail", e);
} finally {
if (null != buff) {
try {
buff.close();
} catch (Exception e) {
logger.warn("export process buffer not close", e);
}
}
if (null != out) {
try {
out.close();
} catch (Exception e) {
logger.warn("export process output stream not close", e);
}
}
}
}
/**
* 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));
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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
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)) {
putMsg(result, Status.DATA_IS_NULL, "fileContent");
return result;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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;
}
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;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int totalSizeEntry = 0;
Map<String, DataSource> dataSourceCache = new HashMap<>(1);
Map<String, Long> taskNameToCode = new HashMap<>(16);
Map<String, List<String>> taskNameToUpstream = new HashMap<>(16);
try (
ZipInputStream zIn = new ZipInputStream(file.getInputStream());
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(zIn))) {
processDefinition = new ProcessDefinition(projectCode,
processDefinitionName,
CodeGenerateUtils.getInstance().genCode(),
"",
"[]", null,
0, loginUser.getId(), loginUser.getTenantId());
ZipEntry entry;
while ((entry = zIn.getNextEntry()) != null) {
totalEntryArchive++;
int totalSizeArchive = 0;
if (!entry.isDirectory()) {
StringBuilder sql = new StringBuilder();
String taskName = null;
String datasourceName = null;
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();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (compressionRatio > THRESHOLD_RATIO) {
throw new IllegalStateException(
"ratio between compressed and uncompressed data is highly suspicious, looks like a Zip Bomb Attack");
}
int commentIndex = line.indexOf("-- ");
if (commentIndex >= 0) {
int colonIndex = line.indexOf(":", commentIndex);
if (colonIndex > 0) {
String key = line.substring(commentIndex + 3, colonIndex).trim().toLowerCase();
String value = line.substring(colonIndex + 1).trim();
switch (key) {
case "name":
taskName = value;
line = line.substring(0, commentIndex);
break;
case "upstream":
upstreams = Arrays.stream(value.split(",")).map(String::trim)
.filter(s -> !"".equals(s)).collect(Collectors.toList());
line = line.substring(0, commentIndex);
break;
case "datasource":
datasourceName = value;
line = line.substring(0, commentIndex);
break;
default:
break;
}
}
}
if (!"".equals(line)) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
sql.append(line).append("\n");
}
}
if (taskName == null) {
taskName = entry.getName();
index = taskName.indexOf("/");
if (index > 0) {
taskName = taskName.substring(index + 1);
}
index = taskName.lastIndexOf(".");
if (index > 0) {
taskName = taskName.substring(0, index);
}
}
DataSource dataSource = dataSourceCache.get(datasourceName);
if (dataSource == null) {
dataSource = queryDatasourceByNameAndUser(datasourceName, loginUser);
}
if (dataSource == null) {
putMsg(result, Status.DATASOURCE_NAME_ILLEGAL);
return result;
}
dataSourceCache.put(datasourceName, dataSource);
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);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (totalSizeArchive > THRESHOLD_SIZE) {
throw new IllegalStateException(
"the uncompressed data size is too much for the application resource capacity");
}
if (totalEntryArchive > THRESHOLD_ENTRIES) {
throw new IllegalStateException(
"too much entries in this archive, can lead to inodes exhaustion of the system");
}
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
return result;
}
for (Map.Entry<String, Long> entry : taskNameToCode.entrySet()) {
List<String> upstreams = taskNameToUpstream.get(entry.getKey());
if (CollectionUtils.isEmpty(upstreams)
|| (upstreams.size() == 1 && upstreams.contains("root") && !taskNameToCode.containsKey("root"))) {
ProcessTaskRelationLog processTaskRelation = buildNormalTaskRelation(0, entry.getValue());
processTaskRelationList.add(processTaskRelation);
continue;
}
for (String upstream : upstreams) {
ProcessTaskRelationLog processTaskRelation =
buildNormalTaskRelation(taskNameToCode.get(upstream), entry.getValue());
processTaskRelationList.add(processTaskRelation);
}
}
return createDagDefine(loginUser, processTaskRelationList, processDefinition, taskDefinitionList, EMPTY_STRING);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
}
private ProcessTaskRelationLog buildNormalTaskRelation(long preTaskCode, long postTaskCode) {
ProcessTaskRelationLog processTaskRelation = new ProcessTaskRelationLog();
processTaskRelation.setPreTaskCode(preTaskCode);
processTaskRelation.setPreTaskVersion(0);
processTaskRelation.setPostTaskCode(postTaskCode);
processTaskRelation.setPostTaskVersion(0);
processTaskRelation.setConditionType(ConditionType.NONE);
processTaskRelation.setName("");
return processTaskRelation;
}
private DataSource queryDatasourceByNameAndUser(String datasourceName, User loginUser) {
if (isAdmin(loginUser)) {
List<DataSource> dataSources = dataSourceMapper.queryDataSourceByName(datasourceName);
if (CollectionUtils.isNotEmpty(dataSources)) {
return dataSources.get(0);
}
} else {
return dataSourceMapper.queryDataSourceByNameAndUserId(loginUser.getId(), datasourceName);
}
return null;
}
private TaskDefinitionLog buildNormalSqlTaskDefinition(String taskName, DataSource dataSource,
String sql) throws CodeGenerateException {
TaskDefinitionLog taskDefinition = new TaskDefinitionLog();
taskDefinition.setName(taskName);
taskDefinition.setFlag(Flag.YES);
SqlParameters sqlParameters = new SqlParameters();
sqlParameters.setType(dataSource.getType().name());
sqlParameters.setDatasource(dataSource.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
sqlParameters.setSql(sql.substring(0, sql.length() - 1));
sqlParameters.setSqlType(SqlType.NON_QUERY.ordinal());
sqlParameters.setLocalParams(Collections.emptyList());
taskDefinition.setTaskParams(JSONUtils.toJsonString(sqlParameters));
taskDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
taskDefinition.setTaskType(TASK_TYPE_SQL);
taskDefinition.setFailRetryTimes(0);
taskDefinition.setFailRetryInterval(0);
taskDefinition.setTimeoutFlag(TimeoutFlag.CLOSE);
taskDefinition.setWorkerGroup(DEFAULT_WORKER_GROUP);
taskDefinition.setTaskPriority(Priority.MEDIUM);
taskDefinition.setEnvironmentCode(-1);
taskDefinition.setTimeout(0);
taskDefinition.setDelayTime(0);
taskDefinition.setTimeoutNotifyStrategy(TaskTimeoutStrategy.WARN);
taskDefinition.setVersion(0);
taskDefinition.setResourceIds("");
return taskDefinition;
}
/**
* check and import
*/
protected boolean checkAndImport(User loginUser, long projectCode, Map<String, Object> result,
DagDataSchedule dagDataSchedule, String otherParamsJson) {
if (!checkImportanceParams(dagDataSchedule, result)) {
return false;
}
ProcessDefinition processDefinition = dagDataSchedule.getProcessDefinition();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String processDefinitionName = recursionProcessDefinitionName(projectCode, processDefinition.getName(), 1);
String importProcessDefinitionName = getNewName(processDefinitionName, IMPORT_SUFFIX);
Map<String, Object> checkResult =
verifyProcessDefinitionName(loginUser, projectCode, importProcessDefinitionName);
if (Status.SUCCESS.equals(checkResult.get(Constants.STATUS))) {
putMsg(result, Status.SUCCESS);
} else {
result.putAll(checkResult);
return false;
}
processDefinition.setName(importProcessDefinitionName);
processDefinition.setId(0);
processDefinition.setProjectCode(projectCode);
processDefinition.setUserId(loginUser.getId());
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR);
return false;
}
List<TaskDefinition> taskDefinitionList = dagDataSchedule.getTaskDefinitionList();
Map<Long, Long> taskCodeMap = new HashMap<>();
Date now = new Date();
List<TaskDefinitionLog> taskDefinitionLogList = new ArrayList<>();
for (TaskDefinition taskDefinition : taskDefinitionList) {
TaskDefinitionLog taskDefinitionLog = new TaskDefinitionLog(taskDefinition);
taskDefinitionLog.setName(taskDefinitionLog.getName());
taskDefinitionLog.setProjectCode(projectCode);
taskDefinitionLog.setUserId(loginUser.getId());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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("Task code get error, ", e);
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS, "Error generating task definition code");
return false;
}
taskDefinitionLogList.add(taskDefinitionLog);
}
int insert = taskDefinitionMapper.batchInsert(taskDefinitionLogList);
int logInsert = taskDefinitionLogMapper.batchInsert(taskDefinitionLogList);
if ((logInsert & insert) == 0) {
putMsg(result, Status.CREATE_TASK_DEFINITION_ERROR);
throw new ServiceException(Status.CREATE_TASK_DEFINITION_ERROR);
}
List<ProcessTaskRelation> taskRelationList = dagDataSchedule.getProcessTaskRelationList();
List<ProcessTaskRelationLog> taskRelationLogList = new ArrayList<>();
for (ProcessTaskRelation processTaskRelation : taskRelationList) {
ProcessTaskRelationLog processTaskRelationLog = new ProcessTaskRelationLog(processTaskRelation);
if (taskCodeMap.containsKey(processTaskRelationLog.getPreTaskCode())) {
processTaskRelationLog.setPreTaskCode(taskCodeMap.get(processTaskRelationLog.getPreTaskCode()));
}
if (taskCodeMap.containsKey(processTaskRelationLog.getPostTaskCode())) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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();
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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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) {
putMsg(result, Status.IMPORT_PROCESS_DEFINE_ERROR);
throw new ServiceException(Status.IMPORT_PROCESS_DEFINE_ERROR);
}
}
return true;
}
/**
* check importance params
*/
private boolean checkImportanceParams(DagDataSchedule dagDataSchedule, Map<String, Object> result) {
if (dagDataSchedule.getProcessDefinition() == null) {
putMsg(result, Status.DATA_IS_NULL, "ProcessDefinition");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getTaskDefinitionList())) {
putMsg(result, Status.DATA_IS_NULL, "TaskDefinitionList");
return false;
}
if (CollectionUtils.isEmpty(dagDataSchedule.getProcessTaskRelationList())) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.DATA_IS_NULL, "ProcessTaskRelationList");
return false;
}
return true;
}
private String recursionProcessDefinitionName(long projectCode, String processDefinitionName, int num) {
ProcessDefinition processDefinition =
processDefinitionMapper.queryByDefineName(projectCode, processDefinitionName);
if (processDefinition != null) {
if (num > 1) {
String str = processDefinitionName.substring(0, processDefinitionName.length() - 3);
processDefinitionName = str + "(" + num + ")";
} else {
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<>();
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
try {
if (processTaskRelationJson == null) {
logger.error("process data is null");
putMsg(result, Status.DATA_IS_NOT_VALID, processTaskRelationJson);
return result;
}
List<ProcessTaskRelation> taskRelationList =
JSONUtils.toList(processTaskRelationJson, ProcessTaskRelation.class);
List<TaskNode> taskNodes = processService.transformTask(taskRelationList, taskDefinitionLogsList);
if (CollectionUtils.isEmpty(taskNodes)) {
logger.error("process node info is empty");
putMsg(result, Status.PROCESS_DAG_IS_EMPTY);
return result;
}
if (graphHasCycle(taskNodes)) {
logger.error("process DAG has cycle");
putMsg(result, Status.PROCESS_NODE_HAS_CYCLE);
return result;
}
for (TaskNode taskNode : taskNodes) {
if (!taskPluginManager.checkTaskParameters(ParametersNode.builder()
.taskType(taskNode.getType())
.taskParams(taskNode.getTaskParams())
.dependence(taskNode.getDependence())
.switchResult(taskNode.getSwitchResult())
.build())) {
logger.error("task node {} parameter invalid", taskNode.getName());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
putMsg(result, Status.PROCESS_NODE_S_PARAMETER_INVALID, taskNode.getName());
return result;
}
CheckUtils.checkOtherParams(taskNode.getExtras());
}
putMsg(result, Status.SUCCESS);
} catch (Exception e) {
result.put(Constants.STATUS, Status.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;
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (processDefinition == null || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
if (CollectionUtils.isEmpty(processDefinitionList)) {
logger.info("process definition not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
HashMap<Long, Project> userProjects = new HashMap<>(Constants.DEFAULT_HASH_MAP_SIZE);
projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())
.forEach(userProject -> userProjects.put(userProject.getCode(), userProject));
List<ProcessDefinition> processDefinitionListInProject = processDefinitionList.stream()
.filter(o -> userProjects.containsKey(o.getProjectCode())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(processDefinitionListInProject)) {
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, codes);
return result;
}
Map<Long, List<TaskDefinition>> taskNodeMap = new HashMap<>();
for (ProcessDefinition processDefinition : processDefinitionListInProject) {
DagData dagData = processService.genDagData(processDefinition);
taskNodeMap.put(processDefinition.getCode(), dagData.getTaskDefinitionList());
}
result.put(Constants.DATA_LIST, taskNodeMap);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query process definition all by project code
*
* @param loginUser loginUser
* @param projectCode project code
* @return process definitions in the project
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
@Override
public Map<String, Object> queryAllProcessDefinitionByProjectCode(User loginUser, long projectCode) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
return result;
}
/**
* query process definition list by process definition code
*
* @param projectCode project code
* @param processDefinitionCode process definition code
* @return task definition list in the process definition
*/
@Override
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());
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
taskDefinitionList.add(dependentSimplifyDefinition);
}
result.put(Constants.DATA_LIST, taskDefinitionList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* Encapsulates the TreeView structure
*
* @param projectCode project code
* @param code process definition code
* @param limit limit
* @return tree view json data
*/
@Override
public Map<String, Object> viewTree(User loginUser, long projectCode, long code, Integer limit) {
Map<String, Object> result;
Project project = projectMapper.queryByCode(projectCode);
result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_TREE_VIEW);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (null == processDefinition || projectCode != processDefinition.getProjectCode()) {
logger.info("process define not exists");
putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code));
return result;
}
DAG<String, TaskNode, TaskNodeRelation> dag = processService.genDagGraph(processDefinition);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, List<TreeViewDto>> runningNodeMap = new ConcurrentHashMap<>();
Map<String, List<TreeViewDto>> waitingRunningNodeMap = new ConcurrentHashMap<>();
List<ProcessInstance> processInstanceList = processInstanceService.queryByProcessDefineCode(code, limit);
processInstanceList.forEach(processInstance -> processInstance
.setDuration(DateUtils.format2Duration(processInstance.getStartTime(), processInstance.getEndTime())));
List<TaskDefinitionLog> taskDefinitionList = processService.genTaskDefineList(processTaskRelationMapper
.queryByProcessCode(processDefinition.getProjectCode(), processDefinition.getCode()));
Map<Long, TaskDefinitionLog> taskDefinitionMap = taskDefinitionList.stream()
.collect(Collectors.toMap(TaskDefinitionLog::getCode, taskDefinitionLog -> taskDefinitionLog));
if (limit > processInstanceList.size()) {
limit = processInstanceList.size();
}
TreeViewDto parentTreeViewDto = new TreeViewDto();
parentTreeViewDto.setName("DAG");
parentTreeViewDto.setType("");
parentTreeViewDto.setCode(0L);
for (int i = limit - 1; i >= 0; i--) {
ProcessInstance processInstance = processInstanceList.get(i);
Date endTime = processInstance.getEndTime() == null ? new Date() : processInstance.getEndTime();
parentTreeViewDto.getInstances()
.add(new Instance(processInstance.getId(), processInstance.getName(),
processInstance.getProcessDefinitionCode(),
"", processInstance.getState().toString(), processInstance.getStartTime(), endTime,
processInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - processInstance.getStartTime().getTime())));
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
List<TreeViewDto> parentTreeViewDtoList = new ArrayList<>();
parentTreeViewDtoList.add(parentTreeViewDto);
for (String startNode : dag.getBeginNode()) {
runningNodeMap.put(startNode, parentTreeViewDtoList);
}
while (!ServerLifeCycleManager.isStopped()) {
Set<String> postNodeList;
Set<Map.Entry<String, List<TreeViewDto>>> entries = runningNodeMap.entrySet();
List<Integer> processInstanceIds = processInstanceList.stream()
.limit(limit).map(ProcessInstance::getId).collect(Collectors.toList());
List<Long> nodeCodes = entries.stream().map(e -> Long.parseLong(e.getKey())).collect(Collectors.toList());
List<TaskInstance> taskInstances;
if (processInstanceIds.isEmpty() || nodeCodes.isEmpty()) {
taskInstances = Collections.emptyList();
} else {
taskInstances = taskInstanceMapper.queryByProcessInstanceIdsAndTaskCodes(processInstanceIds, nodeCodes);
}
for (Map.Entry<String, List<TreeViewDto>> en : entries) {
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 = null;
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
for (TaskInstance instance : taskInstances) {
if (instance.getTaskCode() == Long.parseLong(nodeCode)
&& instance.getProcessInstanceId() == processInstance.getId()) {
taskInstance = instance;
break;
}
}
if (taskInstance == null) {
treeViewDto.getInstances().add(new Instance(-1, "not running", 0, "null"));
} else {
Date startTime = taskInstance.getStartTime() == null ? new Date() : taskInstance.getStartTime();
Date endTime = taskInstance.getEndTime() == null ? new Date() : taskInstance.getEndTime();
long subProcessCode = 0L;
if (taskInstance.isSubProcess()) {
TaskDefinition taskDefinition = taskDefinitionMap.get(taskInstance.getTaskCode());
subProcessCode = Long.parseLong(JSONUtils.parseObject(
taskDefinition.getTaskParams()).path(CMD_PARAM_SUB_PROCESS_DEFINE_CODE).asText());
}
treeViewDto.getInstances().add(new Instance(taskInstance.getId(), taskInstance.getName(),
taskInstance.getTaskCode(),
taskInstance.getTaskType(), taskInstance.getState().toString(),
taskInstance.getStartTime(), taskInstance.getEndTime(),
taskInstance.getHost(),
DateUtils.format2Readable(endTime.getTime() - startTime.getTime()), subProcessCode));
}
}
for (TreeViewDto pTreeViewDto : parentTreeViewDtoList) {
pTreeViewDto.getChildren().add(treeViewDto);
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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);
}
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*/
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) {
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
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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;
}
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) {
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
Map<String, Object> result =
checkParams(loginUser, projectCode, codes, targetProjectCode, TASK_DEFINITION_MOVE);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (projectCode == targetProjectCode) {
return result;
}
List<String> failedProcessList = new ArrayList<>();
doBatchOperateProcessDefinition(loginUser, targetProjectCode, failedProcessList, codes, result, false);
checkBatchOperateResult(projectCode, targetProjectCode, result, failedProcessList, false);
return result;
}
private Map<String, Object> checkParams(User loginUser,
long projectCode,
String processDefinitionCodes,
long targetProjectCode, String perm) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, perm);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
if (org.apache.commons.lang.StringUtils.isEmpty(processDefinitionCodes)) {
putMsg(result, Status.PROCESS_DEFINITION_CODES_IS_EMPTY, processDefinitionCodes);
return result;
}
if (projectCode != targetProjectCode) {
Project targetProject = projectMapper.queryByCode(targetProjectCode);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
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,
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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
String otherParamsJson = doOtherOperateProcess(loginUser, processDefinition);
if (isCopy) {
List<TaskDefinitionLog> taskDefinitionLogs = processService.genTaskDefineList(processTaskRelations);
Map<Long, Long> taskCodeMap = new HashMap<>();
for (TaskDefinitionLog taskDefinitionLog : taskDefinitionLogs) {
if (COMPLEX_TASK_TYPES.contains(taskDefinitionLog.getTaskType())) {
putMsg(result, Status.NOT_SUPPORT_COPY_TASK_TYPE, taskDefinitionLog.getTaskType());
return;
}
try {
long taskCode = CodeGenerateUtils.getInstance().genCode();
taskCodeMap.put(taskDefinitionLog.getCode(), taskCode);
taskDefinitionLog.setCode(taskCode);
} catch (CodeGenerateException e) {
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()));
}
}
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
final long oldProcessDefinitionCode = processDefinition.getCode();
try {
processDefinition.setCode(CodeGenerateUtils.getInstance().genCode());
} catch (CodeGenerateException e) {
putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS);
throw new ServiceException(Status.INTERNAL_SERVER_ERROR_ARGS);
}
processDefinition.setId(0);
processDefinition.setUserId(loginUser.getId());
processDefinition.setName(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);
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int insertResult = scheduleMapper.insert(scheduleObj);
if (insertResult != 1) {
putMsg(result, Status.CREATE_SCHEDULE_ERROR);
throw new ServiceException(Status.CREATE_SCHEDULE_ERROR);
}
}
try {
result.putAll(createDagDefine(loginUser, taskRelationList, processDefinition, taskDefinitionLogs,
otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.COPY_PROCESS_DEFINITION_ERROR);
}
} else {
try {
result.putAll(updateDagDefine(loginUser, taskRelationList, processDefinition, null,
Lists.newArrayList(), otherParamsJson));
} catch (Exception e) {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR);
throw new ServiceException(Status.MOVE_PROCESS_DEFINITION_ERROR);
}
}
if (result.get(Constants.STATUS) != Status.SUCCESS) {
failedProcessList.add(processDefinition.getCode() + "[" + processDefinition.getName() + "]");
}
}
}
/**
* get new Task name or Process name when copy or import operate
* @param originalName Task or Process original name
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
* @param suffix "_copy_" or "_import_"
* @return
*/
public String getNewName(String originalName, String suffix) {
StringBuilder newName = new StringBuilder();
String regex = String.format(".*%s\\d{17}$", suffix);
if (originalName.matches(regex)) {
return newName.append(originalName, 0, originalName.lastIndexOf(suffix))
.append(suffix)
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
return newName.append(originalName)
.append(suffix)
.append(DateUtils.getCurrentTimeStamp())
.toString();
}
/**
* switch the defined process definition version
*
* @param loginUser login user
* @param projectCode project code
* @param code process definition code
* @param version the version user want to switch
* @return switch process definition version result code
*/
@Override
@Transactional
public Map<String, Object> switchProcessDefinitionVersion(User loginUser, long projectCode, long code,
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
int version) {
Project project = projectMapper.queryByCode(projectCode);
Map<String, Object> result =
projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_SWITCH_TO_THIS_VERSION);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return result;
}
ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code);
if (Objects.isNull(processDefinition) || projectCode != processDefinition.getProjectCode()) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_ERROR, code);
return result;
}
ProcessDefinitionLog processDefinitionLog =
processDefinitionLogMapper.queryByDefinitionCodeAndVersion(code, version);
if (Objects.isNull(processDefinitionLog)) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_NOT_EXIST_PROCESS_DEFINITION_VERSION_ERROR,
processDefinition.getCode(), version);
return result;
}
int switchVersion = processService.switchVersion(processDefinition, processDefinitionLog);
if (switchVersion <= 0) {
putMsg(result, Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
throw new ServiceException(Status.SWITCH_PROCESS_DEFINITION_VERSION_ERROR);
}
putMsg(result, Status.SUCCESS);
return result;
}
/**
* check batch operate result
|
closed
|
apache/dolphinscheduler
|
https://github.com/apache/dolphinscheduler
| 11,616 |
[Bug] Modify workflow definition name validation error
|
### Search before asking
- [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues.
### What happened
Modify workflow definition name validation error
### What you expected to happen
Normal
### How to reproduce
Change the existed workflow name.
### Anything else
No
### Version
dev
### Are you willing to submit PR?
- [X] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
|
https://github.com/apache/dolphinscheduler/issues/11616
|
https://github.com/apache/dolphinscheduler/pull/11617
|
b96d69701a08f25cf43313df80a96d23c35ee36e
|
cf3b4424d7125a5513bb744f4dd964ac879dd607
| 2022-08-23T10:50:52Z |
java
| 2022-08-24T11:59:38Z |
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java
|
*
* @param srcProjectCode srcProjectCode
* @param targetProjectCode targetProjectCode
* @param result result
* @param failedProcessList failedProcessList
* @param isCopy isCopy
*/
private void checkBatchOperateResult(long srcProjectCode, long targetProjectCode,
Map<String, Object> result, List<String> failedProcessList, boolean isCopy) {
if (!failedProcessList.isEmpty()) {
if (isCopy) {
putMsg(result, Status.COPY_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
String.join(",", failedProcessList));
} else {
putMsg(result, Status.MOVE_PROCESS_DEFINITION_ERROR, srcProjectCode, targetProjectCode,
String.join(",", failedProcessList));
}
} else {
putMsg(result, Status.SUCCESS);
}
}
/**
* query the pagination versions info by one certain process definition code
*
* @param loginUser login user info to check auth
* @param projectCode project code
* @param pageNo page number
* @param pageSize page size
* @param code process definition code
* @return the pagination process definition versions info of the certain process definition
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.