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/service/impl/ProcessDefinitionServiceImpl.java
*/ @Override public Result queryProcessDefinitionVersions(User loginUser, long projectCode, int pageNo, int pageSize, long code) { Result result = new Result(); Project project = projectMapper.queryByCode(projectCode); Map<String, Object> checkResult = projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_LIST); Status resultStatus = (Status) checkResult.get(Constants.STATUS); if (resultStatus != Status.SUCCESS) { putMsg(result, resultStatus); return result; } PageInfo<ProcessDefinitionLog> pageInfo = new PageInfo<>(pageNo, pageSize); Page<ProcessDefinitionLog> page = new Page<>(pageNo, pageSize); IPage<ProcessDefinitionLog> processDefinitionVersionsPaging = processDefinitionLogMapper.queryProcessDefinitionVersionsPaging(page, code, projectCode); List<ProcessDefinitionLog> processDefinitionLogs = processDefinitionVersionsPaging.getRecords(); pageInfo.setTotalList(processDefinitionLogs); pageInfo.setTotal((int) processDefinitionVersionsPaging.getTotal()); result.setData(pageInfo); putMsg(result, Status.SUCCESS); return result; } /** * delete one certain process definition by version number and process definition code * * @param loginUser login user info to check auth * @param projectCode project code
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 code process definition code * @param version version number * @return delete result code */ @Override @Transactional public Map<String, Object> deleteProcessDefinitionVersion(User loginUser, long projectCode, long code, int version) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, VERSION_DELETE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null || projectCode != processDefinition.getProjectCode()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); } else { if (processDefinition.getVersion() == version) { putMsg(result, Status.MAIN_TABLE_USING_VERSION); return result; } int deleteLog = processDefinitionLogMapper.deleteByProcessDefinitionCodeAndVersion(code, version); int deleteRelationLog = processTaskRelationLogMapper.deleteByCode(code, version); if (deleteLog == 0 || deleteRelationLog == 0) { putMsg(result, Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); throw new ServiceException(Status.DELETE_PROCESS_DEFINE_BY_CODE_ERROR); } deleteOtherRelation(project, result, processDefinition);
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); } return result; } /** * create empty process definition * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param description description * @param globalParams globalParams * @param timeout timeout * @param tenantCode tenantCode * @param scheduleJson scheduleJson * @return process definition code */ @Override @Transactional public Map<String, Object> createEmptyProcessDefinition(User loginUser, long projectCode, String name, String description, String globalParams, int timeout, String tenantCode, String scheduleJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode);
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 = 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; } ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); } long processDefinitionCode; try { processDefinitionCode = CodeGenerateUtils.getInstance().genCode(); } catch (CodeGenerateException e) { putMsg(result, Status.INTERNAL_SERVER_ERROR_ARGS); return result;
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 = new ProcessDefinition(projectCode, name, processDefinitionCode, description, globalParams, "", timeout, loginUser.getId(), tenantId); processDefinition.setExecutionType(executionType); result = createEmptyDagDefine(loginUser, processDefinition); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (StringUtils.isBlank(scheduleJson)) { return result; } Map<String, Object> scheduleResult = createDagSchedule(loginUser, processDefinition, scheduleJson); if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) { Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS); putMsg(result, scheduleResultStatus); throw new ServiceException(scheduleResultStatus); } return result; } protected Map<String, Object> createEmptyDagDefine(User loginUser, ProcessDefinition processDefinition) { Map<String, Object> result = new HashMap<>(); int insertVersion = processService.saveProcessDefine(loginUser, processDefinition, Boolean.TRUE, Boolean.TRUE); if (insertVersion == 0) { putMsg(result, Status.CREATE_PROCESS_DEFINITION_ERROR); throw new ServiceException(Status.CREATE_PROCESS_DEFINITION_ERROR); } putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition);
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; } protected Map<String, Object> createDagSchedule(User loginUser, ProcessDefinition processDefinition, String scheduleJson) { Map<String, Object> result = new HashMap<>(); Schedule scheduleObj = JSONUtils.parseObject(scheduleJson, Schedule.class); if (scheduleObj == null) { putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson); throw new ServiceException(Status.DATA_IS_NOT_VALID); } Date now = new Date(); scheduleObj.setProcessDefinitionCode(processDefinition.getCode()); if (DateUtils.differSec(scheduleObj.getStartTime(), scheduleObj.getEndTime()) == 0) { logger.warn("The start time must not be the same as the end"); putMsg(result, Status.SCHEDULE_START_TIME_END_TIME_SAME); return result; } if (!org.quartz.CronExpression.isValidExpression(scheduleObj.getCrontab())) { logger.error("{} verify failure", scheduleObj.getCrontab()); putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, scheduleObj.getCrontab()); return result; } scheduleObj .setWarningType(scheduleObj.getWarningType() == null ? WarningType.NONE : scheduleObj.getWarningType()); scheduleObj.setWarningGroupId(scheduleObj.getWarningGroupId() == 0 ? 1 : scheduleObj.getWarningGroupId()); scheduleObj.setFailureStrategy( scheduleObj.getFailureStrategy() == null ? FailureStrategy.CONTINUE : scheduleObj.getFailureStrategy()); scheduleObj.setCreateTime(now); scheduleObj.setUpdateTime(now); scheduleObj.setUserId(loginUser.getId());
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
scheduleObj.setReleaseState(ReleaseState.OFFLINE); scheduleObj.setProcessInstancePriority(scheduleObj.getProcessInstancePriority() == null ? Priority.MEDIUM : scheduleObj.getProcessInstancePriority()); scheduleObj.setWorkerGroup(scheduleObj.getWorkerGroup() == null ? "default" : scheduleObj.getWorkerGroup()); scheduleObj .setEnvironmentCode(scheduleObj.getEnvironmentCode() == null ? -1 : scheduleObj.getEnvironmentCode()); scheduleMapper.insert(scheduleObj); putMsg(result, Status.SUCCESS); result.put("scheduleId", scheduleObj.getId()); return result; } /** * update process definition basic info * * @param loginUser login user * @param projectCode project code * @param name process definition name * @param code process definition code * @param description description * @param globalParams globalParams * @param timeout timeout * @param tenantCode tenantCode * @param scheduleJson scheduleJson * @param otherParamsJson otherParamsJson handle other params * @param executionType executionType * @return update result code */ @Override @Transactional public Map<String, Object> updateProcessDefinitionBasicInfo(User loginUser,
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
long projectCode, String name, long code, String description, String globalParams, int timeout, String tenantCode, String scheduleJson, String otherParamsJson, ProcessExecutionTypeEnum executionType) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if(checkDescriptionLength(description)){ putMsg(result, Status.DESCRIPTION_TOO_LONG_ERROR); return result; } int tenantId = -1; if (!Constants.DEFAULT.equals(tenantCode)) { Tenant tenant = tenantMapper.queryByTenantCode(tenantCode); if (tenant == null) { putMsg(result, Status.TENANT_NOT_EXIST); return result; } tenantId = tenant.getId(); }
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()) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } if (processDefinition.getReleaseState() == ReleaseState.ONLINE) { putMsg(result, Status.PROCESS_DEFINE_NOT_ALLOWED_EDIT, processDefinition.getName()); return result; } if (!name.equals(processDefinition.getName())) { ProcessDefinition definition = processDefinitionMapper.verifyByDefineName(project.getCode(), name); if (definition != null) { putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST, name); return result; } } ProcessDefinition processDefinitionDeepCopy = JSONUtils.parseObject(JSONUtils.toJsonString(processDefinition), ProcessDefinition.class); processDefinition.set(projectCode, name, description, globalParams, "", timeout, tenantId); processDefinition.setExecutionType(executionType); List<ProcessTaskRelationLog> taskRelationList = processTaskRelationLogMapper .queryByProcessCodeAndVersion(processDefinition.getCode(), processDefinition.getVersion()); result = updateDagDefine(loginUser, taskRelationList, processDefinition, processDefinitionDeepCopy, Lists.newArrayList(), otherParamsJson); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; }
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 (StringUtils.isBlank(scheduleJson)) { return result; } Map<String, Object> scheduleResult = updateDagSchedule(loginUser, projectCode, code, scheduleJson); if (scheduleResult.get(Constants.STATUS) != Status.SUCCESS) { Status scheduleResultStatus = (Status) scheduleResult.get(Constants.STATUS); putMsg(result, scheduleResultStatus); throw new ServiceException(scheduleResultStatus); } return result; } protected Map<String, Object> updateDagSchedule(User loginUser, long projectCode, long processDefinitionCode, String scheduleJson) { Map<String, Object> result = new HashMap<>(); Schedule schedule = JSONUtils.parseObject(scheduleJson, Schedule.class); if (schedule == null) { putMsg(result, Status.DATA_IS_NOT_VALID, scheduleJson); throw new ServiceException(Status.DATA_IS_NOT_VALID); } FailureStrategy failureStrategy = schedule.getFailureStrategy() == null ? FailureStrategy.CONTINUE : schedule.getFailureStrategy(); WarningType warningType = schedule.getWarningType() == null ? WarningType.NONE : schedule.getWarningType(); Priority processInstancePriority = schedule.getProcessInstancePriority() == null ? Priority.MEDIUM : schedule.getProcessInstancePriority(); int warningGroupId = schedule.getWarningGroupId() == 0 ? 1 : schedule.getWarningGroupId(); String workerGroup = schedule.getWorkerGroup() == null ? "default" : schedule.getWorkerGroup();
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
long environmentCode = schedule.getEnvironmentCode() == null ? -1 : schedule.getEnvironmentCode(); ScheduleParam param = new ScheduleParam(); param.setStartTime(schedule.getStartTime()); param.setEndTime(schedule.getEndTime()); param.setCrontab(schedule.getCrontab()); param.setTimezoneId(schedule.getTimezoneId()); return schedulerService.updateScheduleByProcessDefinitionCode( loginUser, projectCode, processDefinitionCode, JSONUtils.toJsonString(param), warningType, warningGroupId, failureStrategy, processInstancePriority, workerGroup, environmentCode); } /** * release process definition and schedule * * @param loginUser login user * @param projectCode project code * @param code process definition code * @param releaseState releaseState * @return update result code */ @Transactional @Override public Map<String, Object> releaseWorkflowAndSchedule(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
ReleaseState releaseState) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_ONLINE_OFFLINE); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result; } if (null == releaseState) { putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } ProcessDefinition processDefinition = processDefinitionMapper.queryByCode(code); if (processDefinition == null) { putMsg(result, Status.PROCESS_DEFINE_NOT_EXIST, String.valueOf(code)); return result; } Schedule scheduleObj = scheduleMapper.queryByProcessDefinitionCode(code); if (scheduleObj == null) { putMsg(result, Status.SCHEDULE_CRON_NOT_EXISTS, "processDefinitionCode:" + code); return result; } switch (releaseState) { case ONLINE: List<ProcessTaskRelation> relationList = processService.findRelationByCode(code, processDefinition.getVersion()); if (CollectionUtils.isEmpty(relationList)) { putMsg(result, Status.PROCESS_DAG_IS_EMPTY); 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.setReleaseState(releaseState); processDefinitionMapper.updateById(processDefinition); schedulerService.setScheduleState(loginUser, projectCode, scheduleObj.getId(), ReleaseState.ONLINE); break; case OFFLINE: processDefinition.setReleaseState(releaseState); int updateProcess = processDefinitionMapper.updateById(processDefinition); if (updateProcess > 0) { logger.info("set schedule offline, project code: {}, schedule id: {}, process definition code: {}", projectCode, scheduleObj.getId(), code); scheduleObj.setReleaseState(ReleaseState.OFFLINE); int updateSchedule = scheduleMapper.updateById(scheduleObj); if (updateSchedule == 0) { putMsg(result, Status.OFFLINE_SCHEDULE_ERROR); throw new ServiceException(Status.OFFLINE_SCHEDULE_ERROR); } schedulerService.deleteSchedule(project.getId(), scheduleObj.getId()); } break; default: putMsg(result, Status.REQUEST_PARAMS_NOT_VALID_ERROR, RELEASESTATE); return result; } putMsg(result, Status.SUCCESS); return result; } /** * save other relation
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 loginUser * @param processDefinition * @param result * @param otherParamsJson */ @Override public void saveOtherRelation(User loginUser, ProcessDefinition processDefinition, Map<String, Object> result, String otherParamsJson) { } /** * get Json String * @param loginUser * @param processDefinition * @return Json String */ @Override public String doOtherOperateProcess(User loginUser, ProcessDefinition processDefinition) { return null; } /** * delete other relation * @param project * @param result * @param processDefinition */ @Override public void deleteOtherRelation(Project project, Map<String, Object> result, ProcessDefinition processDefinition) { } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.controller; import java.text.MessageFormat; import java.util.ArrayList;
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletResponse; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl; 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.ProcessExecutionTypeEnum; import org.apache.dolphinscheduler.common.enums.ReleaseState; import org.apache.dolphinscheduler.common.enums.UserType; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessDefinitionLog; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.User; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.mock.web.MockHttpServletResponse; /** * process definition controller test */ @RunWith(MockitoJUnitRunner.Silent.class) public class ProcessDefinitionControllerTest {
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
@InjectMocks private ProcessDefinitionController processDefinitionController; @Mock private ProcessDefinitionServiceImpl processDefinitionService; protected User user; @Before public void before() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); loginUser.setUserName("admin"); user = loginUser; } @Test public void testCreateProcessDefinition() { String relationJson = "[{\"name\":\"\",\"pre_task_code\":0,\"pre_task_version\":0,\"post_task_code\":123456789,\"post_task_version\":1," + "\"condition_type\":0,\"condition_params\":\"{}\"},{\"name\":\"\",\"pre_task_code\":123456789,\"pre_task_version\":1," + "\"post_task_code\":123451234,\"post_task_version\":1,\"condition_type\":0,\"condition_params\":\"{}\"}]"; String taskDefinitionJson = "[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":" + "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\"," + "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":" + "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"]," + "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0," + "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0," + "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]"; long projectCode = 1L; String name = "dag_test"; String description = "desc test"; String globalParams = "[]"; String locations = "[]";
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
int timeout = 0; String tenantCode = "root"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, 1); Mockito.when(processDefinitionService.createProcessDefinition(user, projectCode, name, description, globalParams, locations, timeout, tenantCode, relationJson, taskDefinitionJson,"", ProcessExecutionTypeEnum.PARALLEL)).thenReturn(result); Result response = processDefinitionController.createProcessDefinition(user, projectCode, name, description, globalParams, locations, timeout, tenantCode, relationJson, taskDefinitionJson,"", ProcessExecutionTypeEnum.PARALLEL); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } public void putMsg(Result result, Status status, Object... statusParams) { result.setCode(status.getCode()); if (statusParams != null && statusParams.length > 0) { result.setMsg(MessageFormat.format(status.getMsg(), statusParams)); } else { result.setMsg(status.getMsg()); } } @Test public void testVerifyProcessDefinitionName() { 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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
putMsg(result, Status.PROCESS_DEFINITION_NAME_EXIST); long projectCode = 1L; String name = "dag_test"; Mockito.when(processDefinitionService.verifyProcessDefinitionName(user, projectCode, name)).thenReturn(result); Result response = processDefinitionController.verifyProcessDefinitionName(user, projectCode, name); Assert.assertTrue(response.isStatus(Status.PROCESS_DEFINITION_NAME_EXIST)); } @Test public void updateProcessDefinition() { String relationJson = "[{\"name\":\"\",\"pre_task_code\":0,\"pre_task_version\":0,\"post_task_code\":123456789,\"post_task_version\":1," + "\"condition_type\":0,\"condition_params\":\"{}\"},{\"name\":\"\",\"pre_task_code\":123456789,\"pre_task_version\":1," + "\"post_task_code\":123451234,\"post_task_version\":1,\"condition_type\":0,\"condition_params\":\"{}\"}]"; String taskDefinitionJson = "[{\"name\":\"detail_up\",\"description\":\"\",\"taskType\":\"SHELL\",\"taskParams\":" + "\"{\\\"resourceList\\\":[],\\\"localParams\\\":[{\\\"prop\\\":\\\"datetime\\\",\\\"direct\\\":\\\"IN\\\"," + "\\\"type\\\":\\\"VARCHAR\\\",\\\"value\\\":\\\"${system.datetime}\\\"}],\\\"rawScript\\\":" + "\\\"echo ${datetime}\\\",\\\"conditionResult\\\":\\\"{\\\\\\\"successNode\\\\\\\":[\\\\\\\"\\\\\\\"]," + "\\\\\\\"failedNode\\\\\\\":[\\\\\\\"\\\\\\\"]}\\\",\\\"dependence\\\":{}}\",\"flag\":0,\"taskPriority\":0," + "\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":0,\"timeoutFlag\":0," + "\"timeoutNotifyStrategy\":0,\"timeout\":0,\"delayTime\":0,\"resourceIds\":\"\"}]"; String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; long projectCode = 1L; String name = "dag_test"; String description = "desc test"; String globalParams = "[]"; int timeout = 0; String tenantCode = "root"; long code = 123L; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put("processDefinitionId", 1);
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Mockito.when(processDefinitionService.updateProcessDefinition(user, projectCode, name, code, description, globalParams, locations, timeout, tenantCode, relationJson, taskDefinitionJson, "", ProcessExecutionTypeEnum.PARALLEL)).thenReturn(result); Result response = processDefinitionController.updateProcessDefinition(user, projectCode, name, code, description, globalParams, locations, timeout, tenantCode, relationJson, taskDefinitionJson, "", ProcessExecutionTypeEnum.PARALLEL, ReleaseState.OFFLINE); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testReleaseProcessDefinition() { long projectCode = 1L; int id = 1; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.releaseProcessDefinition(user, projectCode, id, ReleaseState.OFFLINE)).thenReturn(result); Result response = processDefinitionController.releaseProcessDefinition(user, projectCode, id, ReleaseState.OFFLINE); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testQueryProcessDefinitionByCode() { String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; long projectCode = 1L; String name = "dag_test"; String description = "desc test"; long code = 1L; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectCode(projectCode); processDefinition.setDescription(description); processDefinition.setCode(code); processDefinition.setLocations(locations); processDefinition.setName(name); 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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, processDefinition); Mockito.when(processDefinitionService.queryProcessDefinitionByCode(user, projectCode, code)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionByCode(user, projectCode, code); Assert.assertEquals(Status.SUCCESS.getCode(), response.getCode().intValue()); } @Test public void testBatchCopyProcessDefinition() { long projectCode = 1L; long targetProjectCode = 2L; String code = "1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.batchCopyProcessDefinition(user, projectCode, code, targetProjectCode)).thenReturn(result); Result response = processDefinitionController.copyProcessDefinition(user, projectCode, code, targetProjectCode); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testBatchMoveProcessDefinition() { long projectCode = 1L; long targetProjectCode = 2L; String id = "1"; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.batchMoveProcessDefinition(user, projectCode, id, targetProjectCode)).thenReturn(result); Result response = processDefinitionController.moveProcessDefinition(user, projectCode, id, targetProjectCode); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testQueryProcessDefinitionList() {
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
long projectCode = 1L; List<ProcessDefinition> resourceList = getDefinitionList(); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); result.put(Constants.DATA_LIST, resourceList); Mockito.when(processDefinitionService.queryProcessDefinitionList(user, projectCode)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionList(user, projectCode); Assert.assertTrue(response != null && response.isSuccess()); } public List<ProcessDefinition> getDefinitionList() { List<ProcessDefinition> resourceList = new ArrayList<>(); String locations = "{\"tasks-36196\":{\"name\":\"ssh_test1\",\"targetarr\":\"\",\"x\":141,\"y\":70}}"; String projectName = "test"; String name = "dag_test"; String description = "desc test"; int id = 1; ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setProjectName(projectName); processDefinition.setDescription(description); processDefinition.setId(id); processDefinition.setLocations(locations); processDefinition.setName(name); String name2 = "dag_test"; int id2 = 2; ProcessDefinition processDefinition2 = new ProcessDefinition(); processDefinition2.setProjectName(projectName); processDefinition2.setDescription(description); processDefinition2.setId(id2); processDefinition2.setLocations(locations); processDefinition2.setName(name2);
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
resourceList.add(processDefinition); resourceList.add(processDefinition2); return resourceList; } @Test public void testDeleteProcessDefinitionByCode() { long projectCode = 1L; long code = 1L; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.deleteProcessDefinitionByCode(user, projectCode, code)).thenReturn(result); Result response = processDefinitionController.deleteProcessDefinitionByCode(user, projectCode, code); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testGetNodeListByDefinitionId() { long projectCode = 1L; Long code = 1L; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.getTaskNodeListByDefinitionCode(user, projectCode, code)).thenReturn(result); Result response = processDefinitionController.getNodeListByDefinitionCode(user, projectCode, code); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testGetNodeListByDefinitionIdList() { long projectCode = 1L; String codeList = "1,2,3"; Map<String, Object> result = new HashMap<>(); 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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Mockito.when(processDefinitionService.getNodeListMapByDefinitionCodes(user, projectCode, codeList)).thenReturn(result); Result response = processDefinitionController.getNodeListMapByDefinitionCodes(user, projectCode, codeList); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testQueryProcessDefinitionAllByProjectId() { long projectCode = 1L; Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.queryAllProcessDefinitionByProjectCode(user, projectCode)).thenReturn(result); Result response = processDefinitionController.queryAllProcessDefinitionByProjectCode(user, projectCode); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testViewTree() throws Exception { long projectCode = 1L; int processId = 1; int limit = 2; User user = new User(); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); Mockito.when(processDefinitionService.viewTree(user,projectCode, processId, limit)).thenReturn(result); Result response = processDefinitionController.viewTree(user, projectCode, processId, limit); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testQueryProcessDefinitionListPaging() { long projectCode = 1L; int pageNo = 1; int pageSize = 10;
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
String searchVal = ""; int userId = 1; Result result = new Result(); putMsg(result, Status.SUCCESS); result.setData(new PageInfo<Resource>(1, 10)); Mockito.when(processDefinitionService.queryProcessDefinitionListPaging(user, projectCode, searchVal, "", userId, pageNo, pageSize)).thenReturn(result); Result response = processDefinitionController.queryProcessDefinitionListPaging(user, projectCode, searchVal, "", userId, pageNo, pageSize); Assert.assertTrue(response != null && response.isSuccess()); } @Test public void testBatchExportProcessDefinitionByCodes() { String processDefinitionIds = "1,2"; long projectCode = 1L; HttpServletResponse response = new MockHttpServletResponse(); Mockito.doNothing().when(this.processDefinitionService).batchExportProcessDefinitionByCodes(user, projectCode, processDefinitionIds, response); processDefinitionController.batchExportProcessDefinitionByCodes(user, projectCode, processDefinitionIds, response); } @Test public void testQueryProcessDefinitionVersions() { long projectCode = 1L; Result resultMap = new Result(); putMsg(resultMap, Status.SUCCESS); resultMap.setData(new PageInfo<ProcessDefinitionLog>(1, 10)); Mockito.when(processDefinitionService.queryProcessDefinitionVersions( user , projectCode , 1 , 10 , 1)) .thenReturn(resultMap);
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/test/java/org/apache/dolphinscheduler/api/controller/ProcessDefinitionControllerTest.java
Result result = processDefinitionController.queryProcessDefinitionVersions( user , projectCode , 1 , 10 , 1); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); } @Test public void testSwitchProcessDefinitionVersion() { long projectCode = 1L; Map<String, Object> resultMap = new HashMap<>(); putMsg(resultMap, Status.SUCCESS); Mockito.when(processDefinitionService.switchProcessDefinitionVersion(user, projectCode, 1, 10)).thenReturn(resultMap); Result result = processDefinitionController.switchProcessDefinitionVersion(user, projectCode, 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.getCode()); } @Test public void testDeleteProcessDefinitionVersion() { long projectCode = 1L; Map<String, Object> resultMap = new HashMap<>(); putMsg(resultMap, Status.SUCCESS); Mockito.when(processDefinitionService.deleteProcessDefinitionVersion( user, projectCode, 1, 10)).thenReturn(resultMap); Result result = processDefinitionController.deleteProcessDefinitionVersion( user, projectCode, 1, 10); Assert.assertEquals(Status.SUCCESS.getCode(), (int) result.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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
*/ package org.apache.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.TASK_DEFINITION_MOVE; 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_IMPORT; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_TREE_VIEW; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_UPDATE; import static org.powermock.api.mockito.PowerMockito.mock; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.impl.ProcessDefinitionServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; 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.ReleaseState; 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.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.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessTaskRelation;
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskDefinitionLog; import org.apache.dolphinscheduler.dao.entity.TaskMainInfo; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.ScheduleMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.service.process.ProcessService; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.commons.lang3.StringUtils; import java.io.ByteArrayOutputStream; import java.nio.charset.StandardCharsets; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; import javax.servlet.http.HttpServletResponse;
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.junit.jupiter.api.Assertions; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.MockitoJUnitRunner; import org.springframework.mock.web.MockMultipartFile; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Lists; /** * process definition service test */ @RunWith(MockitoJUnitRunner.class) public class ProcessDefinitionServiceTest { private static final String taskRelationJson = "[{\"name\":\"\",\"preTaskCode\":0,\"preTaskVersion\":0,\"postTaskCode\":123456789," + "\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"},{\"name\":\"\",\"preTaskCode\":123456789," + "\"preTaskVersion\":1,\"postTaskCode\":123451234,\"postTaskVersion\":1,\"conditionType\":0,\"conditionParams\":\"{}\"}]"; private static final String taskDefinitionJson = "[{\"code\":123456789,\"name\":\"test1\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\"," + "\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 1\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{}," + "\"switchResult\":{}},\"flag\":\"YES\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\"," + "\"timeoutNotifyStrategy\":null,\"timeout\":0,\"environmentCode\":-1},{\"code\":123451234,\"name\":\"test2\",\"version\":1,\"description\":\"\",\"delayTime\":0,\"taskType\":\"SHELL\"," + "\"taskParams\":{\"resourceList\":[],\"localParams\":[],\"rawScript\":\"echo 2\",\"dependence\":{},\"conditionResult\":{\"successNode\":[],\"failedNode\":[]},\"waitStartTimeout\":{}," + "\"switchResult\":{}},\"flag\":\"YES\",\"taskPriority\":\"MEDIUM\",\"workerGroup\":\"default\",\"failRetryTimes\":0,\"failRetryInterval\":1,\"timeoutFlag\":\"CLOSE\"," + "\"timeoutNotifyStrategy\":\"WARN\",\"timeout\":0,\"environmentCode\":-1}]"; @InjectMocks
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
private ProcessDefinitionServiceImpl processDefinitionService; @Mock private ProcessDefinitionMapper processDefineMapper; @Mock private ProcessTaskRelationMapper processTaskRelationMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Mock private ScheduleMapper scheduleMapper; @Mock private ProcessService processService; @Mock private ProcessInstanceService processInstanceService; @Mock private TenantMapper tenantMapper; @Mock private DataSourceMapper dataSourceMapper; @Mock private WorkFlowLineageService workFlowLineageService; @Test public void testQueryProcessDefinitionList() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); 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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode); Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); List<ProcessDefinition> resourceList = new ArrayList<>(); resourceList.add(getProcessDefinition()); Mockito.when(processDefineMapper.queryAllDefinitionList(project.getCode())).thenReturn(resourceList); Map<String, Object> checkSuccessRes = processDefinitionService.queryProcessDefinitionList(loginUser, projectCode); Assert.assertEquals(Status.SUCCESS, checkSuccessRes.get(Constants.STATUS)); } @Test @SuppressWarnings("unchecked") public void testQueryProcessDefinitionListPaging() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Result map = processDefinitionService.queryProcessDefinitionListPaging(loginUser, projectCode, "", "", 1, 5, 0); Assert.assertEquals(Status.PROJECT_NOT_FOUND.getCode(), (int) map.getCode()); putMsg(result, Status.SUCCESS, 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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
loginUser.setId(1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Page<ProcessDefinition> page = new Page<>(1, 10); page.setTotal(30); Mockito.when(processDefineMapper.queryDefineListPaging( Mockito.any(IPage.class) , Mockito.eq("") , Mockito.eq(loginUser.getId()) , Mockito.eq(project.getCode()) , Mockito.anyBoolean())).thenReturn(page); Result map1 = processDefinitionService.queryProcessDefinitionListPaging( loginUser, 1L, "", "",1, 10, loginUser.getId()); Assert.assertEquals(Status.SUCCESS.getMsg(), map1.getMsg()); } @Test public void testQueryProcessDefinitionByCode() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Tenant tenant = new Tenant(); tenant.setId(1); tenant.setTenantCode("root"); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionByCode(loginUser, 1L, 1L);
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); DagData dagData = new DagData(getProcessDefinition(), null, null); Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData); Map<String, Object> instanceNotexitRes = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, 1L); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotexitRes.get(Constants.STATUS)); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(getProcessDefinition()); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Mockito.when(tenantMapper.queryById(1)).thenReturn(tenant); Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testQueryProcessDefinitionByName() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Map<String, Object> map = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test_def")).thenReturn(null); Map<String, Object> instanceNotExitRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test_def"); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS)); Mockito.when(processDefineMapper.queryByDefineName(project.getCode(), "test")).thenReturn(getProcessDefinition()); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); Map<String, Object> successRes = processDefinitionService.queryProcessDefinitionByName(loginUser, projectCode, "test"); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testBatchCopyProcessDefinition() { long projectCode = 1L; Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(result); Map<String, Object> map = processDefinitionService.batchCopyProcessDefinition(loginUser, projectCode, StringUtils.EMPTY, 2L); Assert.assertEquals(Status.PROCESS_DEFINITION_CODES_IS_EMPTY, map.get(Constants.STATUS)); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> map1 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectCode, String.valueOf(project.getId()), 2L); Assert.assertEquals(Status.PROJECT_NOT_FOUND, map1.get(Constants.STATUS)); projectCode = 2L; Project project1 = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_BATCH_COPY)).thenReturn(result); putMsg(result, Status.SUCCESS, projectCode); ProcessDefinition definition = getProcessDefinition(); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(definition); Set<Long> definitionCodes = Arrays.stream("46".split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); Mockito.when(processDefineMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList); Mockito.when(processService.saveProcessDefine(loginUser, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2); Map<String, Object> map3 = processDefinitionService.batchCopyProcessDefinition( loginUser, projectCode, "46", 1L); Assert.assertEquals(Status.SUCCESS, map3.get(Constants.STATUS)); } @Test public void testBatchMoveProcessDefinition() { long projectCode = 1L; Project project1 = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project1); long projectCode2 = 2L; Project project2 = getProject(projectCode2); Mockito.when(projectMapper.queryByCode(projectCode2)).thenReturn(project2); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, TASK_DEFINITION_MOVE)).thenReturn(result); Mockito.when(projectService.checkProjectAndAuth(loginUser, project2, projectCode2, TASK_DEFINITION_MOVE)).thenReturn(result); ProcessDefinition definition = getProcessDefinition(); definition.setVersion(1); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(definition); Set<Long> definitionCodes = Arrays.stream("46".split(Constants.COMMA)).map(Long::parseLong).collect(Collectors.toSet()); Mockito.when(processDefineMapper.queryByCodes(definitionCodes)).thenReturn(processDefinitionList); Mockito.when(processService.saveProcessDefine(loginUser, definition, Boolean.TRUE, Boolean.TRUE)).thenReturn(2); Mockito.when(processTaskRelationMapper.queryByProcessCode(projectCode, 46L)).thenReturn(getProcessTaskRelation(projectCode)); putMsg(result, Status.SUCCESS); Map<String, Object> successRes = processDefinitionService.batchMoveProcessDefinition( loginUser, projectCode, "46", projectCode2); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void deleteProcessDefinitionByCodeTest() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result); Map<String, Object> map = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 6L);
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result); Mockito.when(processDefineMapper.queryByCode(1L)).thenReturn(null); Map<String, Object> instanceNotExitRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 1L); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, instanceNotExitRes.get(Constants.STATUS)); ProcessDefinition processDefinition = getProcessDefinition(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_DEFINITION_DELETE)).thenReturn(result); loginUser.setUserType(UserType.GENERAL_USER); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); Map<String, Object> userNoAuthRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.USER_NO_OPERATION_PERM, userNoAuthRes.get(Constants.STATUS)); loginUser.setUserType(UserType.ADMIN_USER); putMsg(result, Status.SUCCESS, projectCode); processDefinition.setReleaseState(ReleaseState.ONLINE); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); Throwable exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L)); String formatter = MessageFormat.format(Status.PROCESS_DEFINE_STATE_ONLINE.getMsg(), processDefinition.getName()); Assertions.assertEquals(formatter, exception.getMessage()); processDefinition.setReleaseState(ReleaseState.OFFLINE); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule()); Mockito.when(scheduleMapper.deleteById(46)).thenReturn(1); Mockito.when(processDefineMapper.deleteById(processDefinition.getId())).thenReturn(1);
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode())).thenReturn(1); Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet()); Map<String, Object> schedulerGreaterThanOneRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.SUCCESS, schedulerGreaterThanOneRes.get(Constants.STATUS)); Schedule schedule = getSchedule(); schedule.setReleaseState(ReleaseState.ONLINE); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(schedule); Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet()); Map<String, Object> schedulerOnlineRes = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.SCHEDULE_CRON_STATE_ONLINE, schedulerOnlineRes.get(Constants.STATUS)); loginUser.setUserType(UserType.ADMIN_USER); putMsg(result, Status.SUCCESS, projectCode); TaskMainInfo taskMainInfo = getTaskMainInfo().get(0); Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(ImmutableSet.copyOf(getTaskMainInfo())); exception = Assertions.assertThrows(ServiceException.class, () -> processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L)); formatter = MessageFormat.format(Status.DELETE_PROCESS_DEFINITION_USE_BY_OTHER_FAIL.getMsg(), String.format("%s:%s", taskMainInfo.getProcessDefinitionName(), taskMainInfo.getTaskName())); Assertions.assertEquals(formatter, exception.getMessage()); schedule.setReleaseState(ReleaseState.OFFLINE); Mockito.when(processDefineMapper.deleteById(46)).thenReturn(1); Mockito.when(scheduleMapper.deleteById(schedule.getId())).thenReturn(1); Mockito.when(processTaskRelationMapper.deleteByCode(project.getCode(), processDefinition.getCode())).thenReturn(1); Mockito.when(scheduleMapper.queryByProcessDefinitionCode(46L)).thenReturn(getSchedule()); Mockito.when(workFlowLineageService.queryTaskDepOnProcess(project.getCode(), processDefinition.getCode())).thenReturn(Collections.emptySet()); putMsg(result, Status.SUCCESS, projectCode); Map<String, Object> deleteSuccess = processDefinitionService.deleteProcessDefinitionByCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.SUCCESS, deleteSuccess.get(Constants.STATUS));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
} @Test @Ignore public void testReleaseProcessDefinition() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result); Map<String, Object> map = processDefinitionService.releaseProcessDefinition(loginUser, projectCode, 6, ReleaseState.OFFLINE); Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(getProcessDefinition()); List<ProcessTaskRelation> processTaskRelationList = new ArrayList<>(); ProcessTaskRelation processTaskRelation = new ProcessTaskRelation(); processTaskRelation.setProjectCode(projectCode); processTaskRelation.setProcessDefinitionCode(46L); processTaskRelation.setPostTaskCode(123L); processTaskRelationList.add(processTaskRelation); Mockito.when(processService.findRelationByCode(46L, 1)).thenReturn(processTaskRelationList); Map<String, Object> onlineRes = processDefinitionService.releaseProcessDefinition( loginUser, projectCode, 46, ReleaseState.ONLINE); Assert.assertEquals(Status.SUCCESS, onlineRes.get(Constants.STATUS));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Map<String, Object> onlineWithResourceRes = processDefinitionService.releaseProcessDefinition( loginUser, projectCode, 46, ReleaseState.ONLINE); Assert.assertEquals(Status.SUCCESS, onlineWithResourceRes.get(Constants.STATUS)); Map<String, Object> failRes = processDefinitionService.releaseProcessDefinition( loginUser, projectCode, 46, ReleaseState.getEnum(2)); Assert.assertEquals(Status.REQUEST_PARAMS_NOT_VALID_ERROR, failRes.get(Constants.STATUS)); } @Test public void testVerifyProcessDefinitionName() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_CREATE)).thenReturn(result); Map<String, Object> map = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, "test_pdf"); Assert.assertEquals(Status.PROJECT_NOT_FOUND, map.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(processDefineMapper.verifyByDefineName(project.getCode(), "test_pdf")).thenReturn(null); Map<String, Object> processNotExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, "test_pdf"); Assert.assertEquals(Status.SUCCESS, processNotExistRes.get(Constants.STATUS));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processDefineMapper.verifyByDefineName(project.getCode(), "test_pdf")).thenReturn(getProcessDefinition()); Map<String, Object> processExistRes = processDefinitionService.verifyProcessDefinitionName(loginUser, projectCode, "test_pdf"); Assert.assertEquals(Status.PROCESS_DEFINITION_NAME_EXIST, processExistRes.get(Constants.STATUS)); } @Test public void testCheckProcessNodeList() { Map<String, Object> dataNotValidRes = processDefinitionService.checkProcessNodeList(null, null); Assert.assertEquals(Status.DATA_IS_NOT_VALID, dataNotValidRes.get(Constants.STATUS)); List<TaskDefinitionLog> taskDefinitionLogs = JSONUtils.toList(taskDefinitionJson, TaskDefinitionLog.class); Map<String, Object> taskEmptyRes = processDefinitionService.checkProcessNodeList(taskRelationJson, taskDefinitionLogs); Assert.assertEquals(Status.PROCESS_DAG_IS_EMPTY, taskEmptyRes.get(Constants.STATUS)); } @Test public void testGetTaskNodeListByDefinitionCode() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(null); Map<String, Object> processDefinitionNullRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
ProcessDefinition processDefinition = getProcessDefinition(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null)); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); Map<String, Object> dataNotValidRes = processDefinitionService.getTaskNodeListByDefinitionCode(loginUser, projectCode, 46L); Assert.assertEquals(Status.SUCCESS, dataNotValidRes.get(Constants.STATUS)); } @Test public void testGetTaskNodeListByDefinitionCodes() { long projectCode = 1L; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Project project = getProject(projectCode); User loginUser = new User(); loginUser.setId(-1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,null)).thenReturn(result); String defineCodes = "46"; Set<Long> defineCodeSet = Lists.newArrayList(defineCodes.split(Constants.COMMA)).stream().map(Long::parseLong).collect(Collectors.toSet()); Mockito.when(processDefineMapper.queryByCodes(defineCodeSet)).thenReturn(null); Map<String, Object> processNotExistRes = processDefinitionService.getNodeListMapByDefinitionCodes(loginUser, projectCode, defineCodes); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processNotExistRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); ProcessDefinition processDefinition = getProcessDefinition(); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Mockito.when(processDefineMapper.queryByCodes(defineCodeSet)).thenReturn(processDefinitionList); Mockito.when(processService.genDagData(Mockito.any())).thenReturn(new DagData(processDefinition, null, null)); Project project1 = getProject(projectCode); List<Project> projects = new ArrayList<>(); projects.add(project1); Mockito.when(projectMapper.queryProjectCreatedAndAuthorizedByUserId(loginUser.getId())).thenReturn(projects); Map<String, Object> successRes = processDefinitionService.getNodeListMapByDefinitionCodes(loginUser, projectCode, defineCodes); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testQueryAllProcessDefinitionByProjectCode() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.GENERAL_USER); Map<String, Object> result = new HashMap<>(); long projectCode = 2L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode,WORKFLOW_DEFINITION)).thenReturn(result); ProcessDefinition processDefinition = getProcessDefinition(); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); processDefinitionList.add(processDefinition); Mockito.when(processDefineMapper.queryAllDefinitionList(projectCode)).thenReturn(processDefinitionList); Map<String, Object> successRes = processDefinitionService.queryAllProcessDefinitionByProjectCode(loginUser, projectCode); Assert.assertEquals(Status.SUCCESS, successRes.get(Constants.STATUS)); } @Test public void testViewTree() { User loginUser = new 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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
loginUser.setId(1); loginUser.setTenantId(1); loginUser.setUserType(UserType.ADMIN_USER); long projectCode = 1; Project project1 = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, WORKFLOW_TREE_VIEW)).thenReturn(result); ProcessDefinition processDefinition = getProcessDefinition(); Map<String, Object> processDefinitionNullRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10); Assert.assertEquals(Status.PROCESS_DEFINE_NOT_EXIST, processDefinitionNullRes.get(Constants.STATUS)); putMsg(result, Status.SUCCESS, projectCode); Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>()); Map<String, Object> taskNullRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10); Assert.assertEquals(Status.SUCCESS, taskNullRes.get(Constants.STATUS)); Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(),46, 10); Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS)); } @Test public void testSubProcessViewTree() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
ProcessDefinition processDefinition = getProcessDefinition(); Mockito.when(processDefineMapper.queryByCode(46L)).thenReturn(processDefinition); Project project1 = getProject(1); Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, Status.SUCCESS); Mockito.when(projectMapper.queryByCode(1)).thenReturn(project1); Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, 1, WORKFLOW_TREE_VIEW)).thenReturn(result); Mockito.when(processService.genDagGraph(processDefinition)).thenReturn(new DAG<>()); Map<String, Object> taskNotNuLLRes = processDefinitionService.viewTree(loginUser,processDefinition.getProjectCode(), 46, 10); Assert.assertEquals(Status.SUCCESS, taskNotNuLLRes.get(Constants.STATUS)); } @Test public void testUpdateProcessDefinition() { User loginUser = new User(); loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.SUCCESS); long projectCode = 1L; Project project = getProject(projectCode); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_UPDATE)).thenReturn(result); Map<String, Object> updateResult = processDefinitionService.updateProcessDefinition(loginUser, projectCode, "test", 1, "", "", "", 0, "root", null,"",null, ProcessExecutionTypeEnum.PARALLEL); Assert.assertEquals(Status.DATA_IS_NOT_VALID, updateResult.get(Constants.STATUS)); } @Test public void testBatchExportProcessDefinitionByCodes() { processDefinitionService.batchExportProcessDefinitionByCodes(null, 1L, null, null); User loginUser = new 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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
loginUser.setId(1); loginUser.setUserType(UserType.ADMIN_USER); long projectCode = 1L; Project project = getProject(projectCode); Map<String, Object> result = new HashMap<>(); putMsg(result, Status.PROJECT_NOT_FOUND); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); processDefinitionService.batchExportProcessDefinitionByCodes( loginUser, projectCode, "1", null); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(1); Map<String, Object> checkResult = new HashMap<>(); checkResult.put(Constants.STATUS, Status.SUCCESS); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); HttpServletResponse response = mock(HttpServletResponse.class); DagData dagData = new DagData(getProcessDefinition(), null, null); Mockito.when(processService.genDagData(Mockito.any())).thenReturn(dagData); processDefinitionService.batchExportProcessDefinitionByCodes(loginUser, projectCode, "1", response); Assert.assertNotNull(processDefinitionService.exportProcessDagData(processDefinition)); } @Test public void testImportSqlProcessDefinition() throws Exception { int userId = 10; User loginUser = Mockito.mock(User.class); Mockito.when(loginUser.getId()).thenReturn(userId); Mockito.when(loginUser.getTenantId()).thenReturn(2); Mockito.when(loginUser.getUserType()).thenReturn(UserType.GENERAL_USER); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); ZipOutputStream outputStream = new ZipOutputStream(byteArrayOutputStream); outputStream.putNextEntry(new ZipEntry("import_sql/"));
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
outputStream.putNextEntry(new ZipEntry("import_sql/a.sql")); outputStream.write("-- upstream: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8)); outputStream.putNextEntry(new ZipEntry("import_sql/b.sql")); outputStream.write("-- name: start_auto_dag\n-- datasource: mysql_1\nselect 1;".getBytes(StandardCharsets.UTF_8)); outputStream.close(); MockMultipartFile mockMultipartFile = new MockMultipartFile("import_sql.zip", byteArrayOutputStream.toByteArray()); DataSource dataSource = Mockito.mock(DataSource.class); Mockito.when(dataSource.getId()).thenReturn(1); Mockito.when(dataSource.getType()).thenReturn(DbType.MYSQL); Mockito.when(dataSourceMapper.queryDataSourceByNameAndUserId(userId, "mysql_1")).thenReturn(dataSource); long projectCode = 1001; Project project1 = getProject(projectCode); Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, Status.SUCCESS); Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(getProject(projectCode)); Mockito.when(projectService.checkProjectAndAuth(loginUser, project1, projectCode, WORKFLOW_IMPORT)).thenReturn(result); Mockito.when(processService.saveTaskDefine(Mockito.same(loginUser), Mockito.eq(projectCode), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(2); Mockito.when(processService.saveProcessDefine(Mockito.same(loginUser), Mockito.notNull(), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(1); Mockito.when(processService.saveTaskRelation(Mockito.same(loginUser), Mockito.eq(projectCode), Mockito.anyLong(), Mockito.eq(1), Mockito.notNull(), Mockito.notNull(), Mockito.anyBoolean())).thenReturn(0); result = processDefinitionService.importSqlProcessDefinition(loginUser, projectCode, mockMultipartFile); Assert.assertEquals(result.get(Constants.STATUS), Status.SUCCESS); } @Test public void testGetNewProcessName() { String processName1 = "test_copy_" + DateUtils.getCurrentTimeStamp(); final String newName1 = processDefinitionService.getNewName(processName1, Constants.COPY_SUFFIX); Assert.assertEquals(2, newName1.split(Constants.COPY_SUFFIX).length); String processName2 = "wf_copy_all_ods_data_to_d"; final String newName2 = processDefinitionService.getNewName(processName2, Constants.COPY_SUFFIX);
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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
Assert.assertEquals(3, newName2.split(Constants.COPY_SUFFIX).length); String processName3 = "test_import_" + DateUtils.getCurrentTimeStamp(); final String newName3 = processDefinitionService.getNewName(processName3, Constants.IMPORT_SUFFIX); Assert.assertEquals(2, newName3.split(Constants.IMPORT_SUFFIX).length); } /** * get mock processDefinition * * @return ProcessDefinition */ private ProcessDefinition getProcessDefinition() { ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(46); processDefinition.setProjectCode(1L); processDefinition.setName("test_pdf"); processDefinition.setTenantId(1); processDefinition.setDescription(""); processDefinition.setCode(46L); processDefinition.setVersion(1); return processDefinition; } /** * get mock Project * * @param projectCode projectCode * @return Project */ private Project getProject(long projectCode) { Project project = new Project(); project.setCode(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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
project.setId(1); project.setName("test"); project.setUserId(1); return project; } private List<ProcessTaskRelation> getProcessTaskRelation(long projectCode) { List<ProcessTaskRelation> processTaskRelations = new ArrayList<>(); ProcessTaskRelation processTaskRelation = new ProcessTaskRelation(); processTaskRelation.setProjectCode(projectCode); processTaskRelation.setProcessDefinitionCode(46L); processTaskRelation.setProcessDefinitionVersion(1); processTaskRelations.add(processTaskRelation); return processTaskRelations; } /** * get mock schedule * * @return schedule */ private Schedule getSchedule() { Date date = new Date(); Schedule schedule = new Schedule(); schedule.setId(46); schedule.setProcessDefinitionCode(1); schedule.setStartTime(date); schedule.setEndTime(date); schedule.setCrontab("0 0 5 * * ? *"); schedule.setFailureStrategy(FailureStrategy.END); schedule.setUserId(1); schedule.setReleaseState(ReleaseState.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/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java
schedule.setProcessInstancePriority(Priority.MEDIUM); schedule.setWarningType(WarningType.NONE); schedule.setWarningGroupId(1); schedule.setWorkerGroup(Constants.DEFAULT_WORKER_GROUP); return schedule; } private void putMsg(Map<String, Object> result, Status status, Object... statusParams) { result.put(Constants.STATUS, status); if (statusParams != null && statusParams.length > 0) { result.put(Constants.MSG, MessageFormat.format(status.getMsg(), statusParams)); } else { result.put(Constants.MSG, status.getMsg()); } } /** * get mock task main info * * @return schedule */ private List<TaskMainInfo> getTaskMainInfo() { List<TaskMainInfo> taskMainInfos = new ArrayList<>(); TaskMainInfo taskMainInfo = new TaskMainInfo(); taskMainInfo.setId(1); taskMainInfo.setProcessDefinitionName("process"); taskMainInfo.setTaskName("task"); taskMainInfos.add(taskMainInfo); return taskMainInfos; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/python/PythonGateway.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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, 0); 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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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
8,254
[Feature][python] Find a way to add attr location to process definition
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar feature requirement. ### Description Separate from #6407 **Beautify workflow DAG graphic**: when workflow create by Python API, we set default location as `{"x": 0, "y": 0}` in [this PR change][task-location] which means all of tasks in the same place when we open it in UI. we certainly have `format` button in UI, but just a javascript lib and could not call in backend. IMO, I thinks we should also add attribute `graph` or others name to show the view of DAG ### Use case _No response_ ### Related issues _No response_ ### Are you willing to submit a PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/8254
https://github.com/apache/dolphinscheduler/pull/11681
635fde19817800221903034c58c858df86e54714
4dca488cd50b4392d222167c01ae2a79fd295e77
2022-01-29T07:57:47Z
java
2022-08-27T15:38:46Z
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,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
* limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.datax; import com.alibaba.druid.sql.ast.SQLStatement; import com.alibaba.druid.sql.ast.expr.SQLIdentifierExpr; import com.alibaba.druid.sql.ast.expr.SQLPropertyExpr; import com.alibaba.druid.sql.ast.statement.SQLSelect; import com.alibaba.druid.sql.ast.statement.SQLSelectItem; import com.alibaba.druid.sql.ast.statement.SQLSelectQueryBlock; import com.alibaba.druid.sql.ast.statement.SQLSelectStatement; import com.alibaba.druid.sql.ast.statement.SQLUnionQuery; import com.alibaba.druid.sql.parser.SQLStatementParser; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SystemUtils; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.task.api.AbstractTaskExecutor; import org.apache.dolphinscheduler.plugin.task.api.ShellCommandExecutor; import org.apache.dolphinscheduler.plugin.task.api.TaskConstants; import org.apache.dolphinscheduler.plugin.task.api.TaskException; import org.apache.dolphinscheduler.plugin.task.api.TaskExecutionContext; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskResponse; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parser.ParamUtils; import org.apache.dolphinscheduler.plugin.task.api.parser.ParameterUtils; import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.enums.Flag; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import java.io.File; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.nio.file.attribute.FileAttribute; import java.nio.file.attribute.PosixFilePermission; import java.nio.file.attribute.PosixFilePermissions; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.ExecutionException; import java.util.regex.Matcher; import java.util.regex.Pattern; import static org.apache.dolphinscheduler.plugin.datasource.api.utils.PasswordUtils.decodePassword; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.EXIT_CODE_FAILURE; import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.RWXR_XR_X; public class DataxTask extends AbstractTaskExecutor { /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
* jvm parameters */ public static final String JVM_PARAM = " --jvm=\"-Xms%sG -Xmx%sG\" "; public static final String CUSTOM_PARAM = " -D%s=%s"; /** * python process(datax only supports version 2.7 by default) */ private static final String DATAX_PYTHON = "python2.7"; private static final Pattern PYTHON_PATH_PATTERN = Pattern.compile("/bin/python[\\d.]*$"); /** * datax path */ private static final String DATAX_PATH = "${DATAX_HOME}/bin/datax.py"; /** * datax channel count */ private static final int DATAX_CHANNEL_COUNT = 1; /** * datax parameters */ private DataxParameters dataXParameters; /** * shell command executor */ private ShellCommandExecutor shellCommandExecutor; /** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; private DataxTaskExecutionContext dataxTaskExecutionContext;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
/** * constructor * * @param taskExecutionContext taskExecutionContext */ public DataxTask(TaskExecutionContext taskExecutionContext) { super(taskExecutionContext); this.taskExecutionContext = taskExecutionContext; this.shellCommandExecutor = new ShellCommandExecutor(this::logHandle, taskExecutionContext, logger); } /** * init DataX config */ @Override public void init() { logger.info("datax task params {}", taskExecutionContext.getTaskParams()); dataXParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), DataxParameters.class); if (!dataXParameters.checkParameters()) { throw new RuntimeException("datax task params is not valid"); } dataxTaskExecutionContext = dataXParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper()); } /** * run DataX process * * @throws Exception if error throws Exception */ @Override public void handle() throws TaskException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
try { Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap(); String jsonFilePath = buildDataxJsonFile(paramsMap); String shellCommandFilePath = buildShellCommandFile(jsonFilePath, paramsMap); TaskResponse commandExecuteResult = shellCommandExecutor.run(shellCommandFilePath); setExitStatusCode(commandExecuteResult.getExitStatusCode()); setAppIds(String.join(TaskConstants.COMMA, getApplicationIds())); setProcessId(commandExecuteResult.getProcessId()); } catch (InterruptedException e) { Thread.currentThread().interrupt(); logger.error("The current DataX task has been interrupted", e); setExitStatusCode(EXIT_CODE_FAILURE); throw new TaskException("The current DataX task has been interrupted", e); } catch (Exception e) { logger.error("datax task error", e); setExitStatusCode(EXIT_CODE_FAILURE); throw new TaskException("Execute DataX task failed", e); } } /** * cancel DataX process * * @param cancelApplication cancelApplication * @throws Exception if error throws Exception */ @Override public void cancelApplication(boolean cancelApplication) throws Exception {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
shellCommandExecutor.cancelApplication(); } /** * build datax configuration file * * @return datax json file name * @throws Exception if error throws Exception */ private String buildDataxJsonFile(Map<String, Property> paramsMap) throws Exception { String fileName = String.format("%s/%s_job.json", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId()); String json; Path path = new File(fileName).toPath(); if (Files.exists(path)) { return fileName; } if (dataXParameters.getCustomConfig() == Flag.YES.ordinal()) { json = dataXParameters.getJson().replaceAll("\\r\\n", "\n"); } else { ObjectNode job = JSONUtils.createObjectNode(); job.putArray("content").addAll(buildDataxJobContentJson()); job.set("setting", buildDataxJobSettingJson()); ObjectNode root = JSONUtils.createObjectNode(); root.set("job", job); root.set("core", buildDataxCoreJson()); json = root.toString();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
} json = ParameterUtils.convertParameterPlaceholders(json, ParamUtils.convert(paramsMap)); logger.debug("datax job json : {}", json); FileUtils.writeStringToFile(new File(fileName), json, StandardCharsets.UTF_8); return fileName; } /** * build datax job config * * @return collection of datax job config JSONObject * @throws SQLException if error throws SQLException */ private List<ObjectNode> buildDataxJobContentJson() { BaseConnectionParam dataSourceCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( dataxTaskExecutionContext.getSourcetype(), dataxTaskExecutionContext.getSourceConnectionParams()); BaseConnectionParam dataTargetCfg = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( dataxTaskExecutionContext.getTargetType(), dataxTaskExecutionContext.getTargetConnectionParams()); List<ObjectNode> readerConnArr = new ArrayList<>(); ObjectNode readerConn = JSONUtils.createObjectNode(); ArrayNode sqlArr = readerConn.putArray("querySql"); for (String sql : new String[]{dataXParameters.getSql()}) { sqlArr.add(sql); } ArrayNode urlArr = readerConn.putArray("jdbcUrl"); urlArr.add(DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDsType()), dataSourceCfg)); readerConnArr.add(readerConn);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
ObjectNode readerParam = JSONUtils.createObjectNode(); readerParam.put("username", dataSourceCfg.getUser()); readerParam.put("password", decodePassword(dataSourceCfg.getPassword())); readerParam.putArray("connection").addAll(readerConnArr); ObjectNode reader = JSONUtils.createObjectNode(); reader.put("name", DataxUtils.getReaderPluginName(dataxTaskExecutionContext.getSourcetype())); reader.set("parameter", readerParam); List<ObjectNode> writerConnArr = new ArrayList<>(); ObjectNode writerConn = JSONUtils.createObjectNode(); ArrayNode tableArr = writerConn.putArray("table"); tableArr.add(dataXParameters.getTargetTable()); writerConn.put("jdbcUrl", DataSourceUtils.getJdbcUrl(DbType.valueOf(dataXParameters.getDtType()), dataTargetCfg)); writerConnArr.add(writerConn); ObjectNode writerParam = JSONUtils.createObjectNode(); writerParam.put("username", dataTargetCfg.getUser()); writerParam.put("password", decodePassword(dataTargetCfg.getPassword())); String[] columns = parsingSqlColumnNames(dataxTaskExecutionContext.getSourcetype(), dataxTaskExecutionContext.getTargetType(), dataSourceCfg, dataXParameters.getSql()); ArrayNode columnArr = writerParam.putArray("column"); for (String column : columns) { columnArr.add(column); } writerParam.putArray("connection").addAll(writerConnArr); if (CollectionUtils.isNotEmpty(dataXParameters.getPreStatements())) { ArrayNode preSqlArr = writerParam.putArray("preSql"); for (String preSql : dataXParameters.getPreStatements()) { preSqlArr.add(preSql); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
if (CollectionUtils.isNotEmpty(dataXParameters.getPostStatements())) { ArrayNode postSqlArr = writerParam.putArray("postSql"); for (String postSql : dataXParameters.getPostStatements()) { postSqlArr.add(postSql); } } ObjectNode writer = JSONUtils.createObjectNode(); writer.put("name", DataxUtils.getWriterPluginName(dataxTaskExecutionContext.getTargetType())); writer.set("parameter", writerParam); List<ObjectNode> contentList = new ArrayList<>(); ObjectNode content = JSONUtils.createObjectNode(); content.set("reader", reader); content.set("writer", writer); contentList.add(content); return contentList; } /** * build datax setting config * * @return datax setting config JSONObject */ private ObjectNode buildDataxJobSettingJson() { ObjectNode speed = JSONUtils.createObjectNode(); speed.put("channel", DATAX_CHANNEL_COUNT); if (dataXParameters.getJobSpeedByte() > 0) { speed.put("byte", dataXParameters.getJobSpeedByte()); } if (dataXParameters.getJobSpeedRecord() > 0) { speed.put("record", dataXParameters.getJobSpeedRecord()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
ObjectNode errorLimit = JSONUtils.createObjectNode(); errorLimit.put("record", 0); errorLimit.put("percentage", 0); ObjectNode setting = JSONUtils.createObjectNode(); setting.set("speed", speed); setting.set("errorLimit", errorLimit); return setting; } private ObjectNode buildDataxCoreJson() { ObjectNode speed = JSONUtils.createObjectNode(); speed.put("channel", DATAX_CHANNEL_COUNT); if (dataXParameters.getJobSpeedByte() > 0) { speed.put("byte", dataXParameters.getJobSpeedByte()); } if (dataXParameters.getJobSpeedRecord() > 0) { speed.put("record", dataXParameters.getJobSpeedRecord()); } ObjectNode channel = JSONUtils.createObjectNode(); channel.set("speed", speed); ObjectNode transport = JSONUtils.createObjectNode(); transport.set("channel", channel); ObjectNode core = JSONUtils.createObjectNode(); core.set("transport", transport); return core; } /** * create command * * @return shell command file name * @throws Exception if error throws Exception
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
*/ private String buildShellCommandFile(String jobConfigFilePath, Map<String, Property> paramsMap) throws Exception { String fileName = String.format("%s/%s_node.%s", taskExecutionContext.getExecutePath(), taskExecutionContext.getTaskAppId(), SystemUtils.IS_OS_WINDOWS ? "bat" : "sh"); Path path = new File(fileName).toPath(); if (Files.exists(path)) { return fileName; } StringBuilder sbr = new StringBuilder(); sbr.append(getPythonCommand()); sbr.append(" "); sbr.append(DATAX_PATH); sbr.append(" "); sbr.append(loadJvmEnv(dataXParameters)); sbr.append(addCustomParameters(paramsMap)); sbr.append(" "); sbr.append(jobConfigFilePath); String dataxCommand = ParameterUtils.convertParameterPlaceholders(sbr.toString(), ParamUtils.convert(paramsMap)); logger.debug("raw script : {}", dataxCommand); Set<PosixFilePermission> perms = PosixFilePermissions.fromString(RWXR_XR_X); FileAttribute<Set<PosixFilePermission>> attr = PosixFilePermissions.asFileAttribute(perms); if (SystemUtils.IS_OS_WINDOWS) { Files.createFile(path);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
} else { Files.createFile(path, attr); } Files.write(path, dataxCommand.getBytes(), StandardOpenOption.APPEND); return fileName; } private StringBuilder addCustomParameters(Map<String, Property> paramsMap) { StringBuilder customParameters = new StringBuilder("-p\""); for (Map.Entry<String, Property> entry : paramsMap.entrySet()) { customParameters.append(String.format(CUSTOM_PARAM, entry.getKey(), entry.getValue().getValue())); } customParameters.append("\""); return customParameters; } public String getPythonCommand() { String pythonHome = System.getenv("PYTHON_HOME"); return getPythonCommand(pythonHome); } public String getPythonCommand(String pythonHome) { if (StringUtils.isEmpty(pythonHome)) { return DATAX_PYTHON; } String pythonBinPath = "/bin/" + DATAX_PYTHON; Matcher matcher = PYTHON_PATH_PATTERN.matcher(pythonHome); if (matcher.find()) { return matcher.replaceAll(pythonBinPath); } return Paths.get(pythonHome, pythonBinPath).toString(); } public String loadJvmEnv(DataxParameters dataXParameters) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
int xms = Math.max(dataXParameters.getXms(), 1); int xmx = Math.max(dataXParameters.getXmx(), 1); return String.format(JVM_PARAM, xms, xmx); } /** * parsing synchronized column names in SQL statements * * @param sourceType the database type of the data source * @param targetType the database type of the data target * @param dataSourceCfg the database connection parameters of the data source * @param sql sql for data synchronization * @return Keyword converted column names */ private String[] parsingSqlColumnNames(DbType sourceType, DbType targetType, BaseConnectionParam dataSourceCfg, String sql) { String[] columnNames = tryGrammaticalAnalysisSqlColumnNames(sourceType, sql); if (columnNames == null || columnNames.length == 0) { logger.info("try to execute sql analysis query column name"); columnNames = tryExecuteSqlResolveColumnNames(sourceType, dataSourceCfg, sql); } notNull(columnNames, String.format("parsing sql columns failed : %s", sql)); return DataxUtils.convertKeywordsColumns(targetType, columnNames); } /** * try grammatical parsing column * * @param dbType database type * @param sql sql for data synchronization * @return column name array * @throws RuntimeException if error throws RuntimeException */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
private String[] tryGrammaticalAnalysisSqlColumnNames(DbType dbType, String sql) { String[] columnNames; try { SQLStatementParser parser = DataxUtils.getSqlStatementParser(dbType, sql); if (parser == null) { logger.warn("database driver [{}] is not support grammatical analysis sql", dbType); return new String[0]; } SQLStatement sqlStatement = parser.parseStatement(); SQLSelectStatement sqlSelectStatement = (SQLSelectStatement) sqlStatement; SQLSelect sqlSelect = sqlSelectStatement.getSelect(); List<SQLSelectItem> selectItemList = null; if (sqlSelect.getQuery() instanceof SQLSelectQueryBlock) { SQLSelectQueryBlock block = (SQLSelectQueryBlock) sqlSelect.getQuery(); selectItemList = block.getSelectList(); } else if (sqlSelect.getQuery() instanceof SQLUnionQuery) { SQLUnionQuery unionQuery = (SQLUnionQuery) sqlSelect.getQuery(); SQLSelectQueryBlock block = (SQLSelectQueryBlock) unionQuery.getRight(); selectItemList = block.getSelectList(); } notNull(selectItemList, String.format("select query type [%s] is not support", sqlSelect.getQuery().toString())); columnNames = new String[selectItemList.size()]; for (int i = 0; i < selectItemList.size(); i++) { SQLSelectItem item = selectItemList.get(i); String columnName = null; if (item.getAlias() != null) { columnName = item.getAlias(); } else if (item.getExpr() != null) { if (item.getExpr() instanceof SQLPropertyExpr) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
SQLPropertyExpr expr = (SQLPropertyExpr) item.getExpr(); columnName = expr.getName(); } else if (item.getExpr() instanceof SQLIdentifierExpr) { SQLIdentifierExpr expr = (SQLIdentifierExpr) item.getExpr(); columnName = expr.getName(); } } else { throw new RuntimeException( String.format("grammatical analysis sql column [ %s ] failed", item.toString())); } if (columnName == null) { throw new RuntimeException( String.format("grammatical analysis sql column [ %s ] failed", item.toString())); } columnNames[i] = columnName; } } catch (Exception e) { logger.warn(e.getMessage(), e); return new String[0]; } return columnNames; } /** * try to execute sql to resolve column names * * @param baseDataSource the database connection parameters * @param sql sql for data synchronization * @return column name array */ public String[] tryExecuteSqlResolveColumnNames(DbType sourceType, BaseConnectionParam baseDataSource, String sql) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,689
[Bug] [DataX] change replaceAll to replace
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened <img width="788" alt="image" src="https://user-images.githubusercontent.com/33984497/187155685-68f82729-7c35-4902-ba59-44b99d0140b6.png"> if use replaceAll which parses a regular expression .so create_time be changed to crea_me ### What you expected to happen be right ### How to reproduce change to replace ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11689
https://github.com/apache/dolphinscheduler/pull/11696
554562bfa93d4fc8f0fc8c50fe77153e2db3f3f2
f8b9aad2394a63c8e10edf7bb15d62853e941406
2022-08-29T08:16:05Z
java
2022-09-05T01:54:18Z
dolphinscheduler-task-plugin/dolphinscheduler-task-datax/src/main/java/org/apache/dolphinscheduler/plugin/task/datax/DataxTask.java
String[] columnNames; sql = String.format("SELECT t.* FROM ( %s ) t WHERE 0 = 1", sql); sql = sql.replace(";", ""); try ( Connection connection = DataSourceClientProvider.getInstance().getConnection(sourceType, baseDataSource); PreparedStatement stmt = connection.prepareStatement(sql); ResultSet resultSet = stmt.executeQuery()) { ResultSetMetaData md = resultSet.getMetaData(); int num = md.getColumnCount(); columnNames = new String[num]; for (int i = 1; i <= num; i++) { columnNames[i - 1] = md.getColumnName(i).replaceAll("t.",""); } } catch (SQLException | ExecutionException e) { logger.error(e.getMessage(), e); return null; } return columnNames; } @Override public AbstractParameters getParameters() { return dataXParameters; } private void notNull(Object obj, String message) { if (obj == null) { throw new RuntimeException(message); } } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; import org.apache.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; import java.time.Duration; import java.util.regex.Pattern; public final class Constants {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
private Constants() { throw new UnsupportedOperationException("Construct Constants"); } /** * common properties path */ public static final String COMMON_PROPERTIES_PATH = "/common.properties"; /** * registry properties */ public static final String REGISTRY_DOLPHINSCHEDULER_MASTERS = "/nodes/master"; public static final String REGISTRY_DOLPHINSCHEDULER_WORKERS = "/nodes/worker"; public static final String REGISTRY_DOLPHINSCHEDULER_NODE = "/nodes"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_MASTERS = "/lock/masters"; public static final String REGISTRY_DOLPHINSCHEDULER_LOCK_FAILOVER_MASTERS = "/lock/failover/masters"; public static final String FORMAT_SS = "%s%s";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String FORMAT_S_S = "%s/%s"; public static final String FORMAT_S_S_COLON = "%s:%s"; public static final String FOLDER_SEPARATOR = "/"; public static final String RESOURCE_TYPE_FILE = "resources"; public static final String RESOURCE_TYPE_UDF = "udfs"; public static final String STORAGE_S3 = "S3"; public static final String STORAGE_HDFS = "HDFS"; public static final String EMPTY_STRING = ""; /** * resource.hdfs.fs.defaultFS */ public static final String FS_DEFAULT_FS = "resource.hdfs.fs.defaultFS"; /** * hadoop configuration */ public static final String HADOOP_RM_STATE_ACTIVE = "ACTIVE"; public static final String HADOOP_RESOURCE_MANAGER_HTTPADDRESS_PORT = "resource.manager.httpaddress.port"; /** * yarn.resourcemanager.ha.rm.ids */ public static final String YARN_RESOURCEMANAGER_HA_RM_IDS = "yarn.resourcemanager.ha.rm.ids"; /** * yarn.application.status.address */ public static final String YARN_APPLICATION_STATUS_ADDRESS = "yarn.application.status.address"; /** * yarn.job.history.status.address */ public static final String YARN_JOB_HISTORY_STATUS_ADDRESS = "yarn.job.history.status.address"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* hdfs configuration * resource.hdfs.root.user */ public static final String HDFS_ROOT_USER = "resource.hdfs.root.user"; /** * hdfs/s3 configuration * resource.storage.upload.base.path */ public static final String RESOURCE_UPLOAD_PATH = "resource.storage.upload.base.path"; /** * data basedir path */ public static final String DATA_BASEDIR_PATH = "data.basedir.path"; /** * dolphinscheduler.env.path */ public static final String DOLPHINSCHEDULER_ENV_PATH = "dolphinscheduler.env.path"; /** * environment properties default path */ public static final String ENV_PATH = "dolphinscheduler_env.sh"; /** * resource.view.suffixs */ public static final String RESOURCE_VIEW_SUFFIXES = "resource.view.suffixs"; public static final String RESOURCE_VIEW_SUFFIXES_DEFAULT_VALUE = "txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js"; /** * development.state */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String DEVELOPMENT_STATE = "development.state"; /** * sudo enable */ public static final String SUDO_ENABLE = "sudo.enable"; /** * string true */ public static final String STRING_TRUE = "true"; /** * resource storage type */ public static final String RESOURCE_STORAGE_TYPE = "resource.storage.type"; public static final String AWS_S3_BUCKET_NAME = "resource.aws.s3.bucket.name"; public static final String AWS_END_POINT = "resource.aws.s3.endpoint"; /** * comma , */ public static final String COMMA = ","; /** * COLON : */ public static final String COLON = ":"; /** * period . */ public static final String PERIOD = "."; /** * QUESTION ? */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String QUESTION = "?"; /** * SPACE " " */ public static final String SPACE = " "; /** * SINGLE_SLASH / */ public static final String SINGLE_SLASH = "/"; /** * DOUBLE_SLASH // */ public static final String DOUBLE_SLASH = "//"; /** * EQUAL SIGN */ public static final String EQUAL_SIGN = "="; /** * AT SIGN */ public static final String AT_SIGN = "@"; /** * date format of yyyy-MM-dd HH:mm:ss */ public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss"; /** * date format of yyyyMMdd */ public static final String YYYYMMDD = "yyyyMMdd"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* date format of yyyyMMddHHmmss */ public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss"; /** * date format of yyyyMMddHHmmssSSS */ public static final String YYYYMMDDHHMMSSSSS = "yyyyMMddHHmmssSSS"; public static final String IMPORT_SUFFIX = "_import_"; public static final String COPY_SUFFIX = "_copy_"; /** * http connect time out */ public static final int HTTP_CONNECT_TIMEOUT = 60 * 1000; /** * http connect request time out */ public static final int HTTP_CONNECTION_REQUEST_TIMEOUT = 60 * 1000; /** * httpclient soceket time out */ public static final int SOCKET_TIMEOUT = 60 * 1000; /** * registry session timeout */ public static final int REGISTRY_SESSION_TIMEOUT = 10 * 1000; /** * http header */ public static final String HTTP_HEADER_UNKNOWN = "unKnown"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* http X-Forwarded-For */ public static final String HTTP_X_FORWARDED_FOR = "X-Forwarded-For"; /** * http X-Real-IP */ public static final String HTTP_X_REAL_IP = "X-Real-IP"; /** * UTF-8 */ public static final String UTF_8 = "UTF-8"; /** * user name regex */ public static final Pattern REGEX_USER_NAME = Pattern.compile("^[a-zA-Z0-9._-]{3,39}$"); /** * read permission */ public static final int READ_PERMISSION = 2; /** * write permission */ public static final int WRITE_PERMISSION = 2 * 2; /** * execute permission */ public static final int EXECUTE_PERMISSION = 1; /** * default admin permission */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int DEFAULT_ADMIN_PERMISSION = 7; /** * default hash map size */ public static final int DEFAULT_HASH_MAP_SIZE = 16; /** * all permissions */ public static final int ALL_PERMISSIONS = READ_PERMISSION | WRITE_PERMISSION | EXECUTE_PERMISSION; /** * max task timeout */ public static final int MAX_TASK_TIMEOUT = 24 * 3600; /** * worker host weight */ public static final int DEFAULT_WORKER_HOST_WEIGHT = 100; /** * time unit secong to minutes */ public static final int SEC_2_MINUTES_TIME_UNIT = 60; /*** * * rpc port */ public static final String RPC_PORT = "rpc.port"; /** * forbid running task */ public static final String FLOWNODE_RUN_FLAG_FORBIDDEN = "FORBIDDEN";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * normal running task */ public static final String FLOWNODE_RUN_FLAG_NORMAL = "NORMAL"; public static final String COMMON_TASK_TYPE = "common"; public static final String DEFAULT = "default"; public static final String PASSWORD = "password"; public static final String XXXXXX = "******"; public static final String NULL = "NULL"; public static final String THREAD_NAME_MASTER_SERVER = "Master-Server"; public static final String THREAD_NAME_WORKER_SERVER = "Worker-Server"; public static final String THREAD_NAME_ALERT_SERVER = "Alert-Server"; /** * command parameter keys */ public static final String CMD_PARAM_RECOVER_PROCESS_ID_STRING = "ProcessInstanceId"; public static final String CMD_PARAM_RECOVERY_START_NODE_STRING = "StartNodeIdList"; public static final String CMD_PARAM_RECOVERY_WAITING_THREAD = "WaitingThreadInstanceId"; public static final String CMD_PARAM_SUB_PROCESS = "processInstanceId"; public static final String CMD_PARAM_EMPTY_SUB_PROCESS = "0"; public static final String CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID = "parentProcessInstanceId"; public static final String CMD_PARAM_SUB_PROCESS_DEFINE_CODE = "processDefinitionCode"; public static final String CMD_PARAM_START_NODES = "StartNodeList"; public static final String CMD_PARAM_START_PARAMS = "StartParams"; public static final String CMD_PARAM_FATHER_PARAMS = "fatherParams"; /** * complement data start date */ public static final String CMDPARAM_COMPLEMENT_DATA_START_DATE = "complementStartDate"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* complement data end date */ public static final String CMDPARAM_COMPLEMENT_DATA_END_DATE = "complementEndDate"; /** * complement data Schedule date */ public static final String CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST = "complementScheduleDateList"; /** * complement date default cron string */ public static final String DEFAULT_CRON_STRING = "0 0 0 * * ? *"; /** * sleep 1000ms */ public static final long SLEEP_TIME_MILLIS = 1_000L; /** * short sleep 100ms */ public static final long SLEEP_TIME_MILLIS_SHORT = 100L; public static final Duration SERVER_CLOSE_WAIT_TIME = Duration.ofSeconds(3); /** * one second mils */ public static final long SECOND_TIME_MILLIS = 1_000L; /** * master task instance cache-database refresh interval */ public static final long CACHE_REFRESH_TIME_MILLIS = 20 * 1_000L; /** * heartbeat for zk info length
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final int HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH = 14; /** * jar */ public static final String JAR = "jar"; /** * hadoop */ public static final String HADOOP = "hadoop"; /** * -D <property>=<value> */ public static final String D = "-D"; /** * exit code success */ public static final int EXIT_CODE_SUCCESS = 0; /** * exit code failure */ public static final int EXIT_CODE_FAILURE = -1; /** * process or task definition failure */ public static final int DEFINITION_FAILURE = -1; public static final int OPPOSITE_VALUE = -1; /** * process or task definition first version */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,821
[Bug] [Resource Center] HDFS can only use local mode, not cluster mode
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened HDFS can only use local mode, not cluster mode ### What you expected to happen running cluster mode successfully. ### How to reproduce aboved. ### Anything else _No response_ ### Version dev ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11821
https://github.com/apache/dolphinscheduler/pull/11823
ea0b5acccb07474b5c4f0a08eecaa06c55f24d9e
ebcffb04aad9db8ec6df1105e4770b187088e701
2022-09-07T04:07:07Z
java
2022-09-07T08:40:43Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int VERSION_FIRST = 1; /** * date format of yyyyMMdd */ public static final String PARAMETER_FORMAT_DATE = "yyyyMMdd"; /** * date format of yyyyMMddHHmmss */ public static final String PARAMETER_FORMAT_TIME = "yyyyMMddHHmmss"; /** * system date(yyyyMMddHHmmss) */ public static final String PARAMETER_DATETIME = "system.datetime"; /** * system date(yyyymmdd) today */ public static final String PARAMETER_CURRENT_DATE = "system.biz.curdate"; /** * system date(yyyymmdd) yesterday */ public static final String PARAMETER_BUSINESS_DATE = "system.biz.date"; /** * ACCEPTED */ public static final String ACCEPTED = "ACCEPTED"; /** * SUCCEEDED */ public static final String SUCCEEDED = "SUCCEEDED"; /**