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,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
/** * instantiate command schedule instance */ Command command = new Command(); Map<String, String> cmdParam = new HashMap<>(); if (commandType == null) { command.setCommandType(CommandType.START_PROCESS); } else { command.setCommandType(commandType); } command.setProcessDefinitionCode(processDefineCode); if (nodeDep != null) { command.setTaskDependType(nodeDep); } if (failureStrategy != null) { command.setFailureStrategy(failureStrategy); } if (!StringUtils.isEmpty(startNodeList)) { cmdParam.put(CMD_PARAM_START_NODES, startNodeList); } if (warningType != null) { command.setWarningType(warningType); } if (startParams != null && startParams.size() > 0) { cmdParam.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams)); } command.setCommandParam(JSONUtils.toJsonString(cmdParam)); command.setExecutorId(executorId); command.setWarningGroupId(warningGroupId); command.setProcessInstancePriority(processInstancePriority);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
command.setWorkerGroup(workerGroup); command.setEnvironmentCode(environmentCode); command.setDryRun(dryRun); ProcessDefinition processDefinition = processService.findProcessDefinitionByCode(processDefineCode); if (processDefinition != null) { command.setProcessDefinitionVersion(processDefinition.getVersion()); } command.setProcessInstanceId(0); // d if (commandType == CommandType.COMPLEMENT_DATA) { if (schedule == null || StringUtils.isEmpty(schedule)) { return 0; } if (!isValidateScheduleTime(schedule)) { return 0; } try { return createComplementCommandList(schedule, runMode, command, expectedParallelismNumber, complementDependentMode); } catch (CronParseException cronParseException) { // W // c return 0; } } else { command.setCommandParam(JSONUtils.toJsonString(cmdParam)); return processService.createCommand(command); } } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* create complement command * close left and close right * * @param scheduleTimeParam * @param runMode * @return */ protected int createComplementCommandList(String scheduleTimeParam, RunMode runMode, Command command, Integer expectedParallelismNumber, ComplementDependentMode complementDependentMode) throws CronParseException { int createCount = 0; String startDate = null; String endDate = null; String dateList = null; int dependentProcessDefinitionCreateCount = 0; runMode = (runMode == null) ? RunMode.RUN_MODE_SERIAL : runMode; Map<String, String> cmdParam = JSONUtils.toMap(command.getCommandParam()); Map<String, String> scheduleParam = JSONUtils.toMap(scheduleTimeParam); if (scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { dateList = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST); dateList = removeDuplicates(dateList); } if (scheduleParam.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE) && scheduleParam.containsKey( CMDPARAM_COMPLEMENT_DATA_END_DATE)) { startDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); endDate = scheduleParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); } switch (runMode) { case RUN_MODE_SERIAL: { if (StringUtils.isNotEmpty(dateList)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, dateList); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); createCount = processService.createCommand(command); } if (startDate != null && endDate != null) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startDate); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endDate); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); createCount = processService.createCommand(command); // d List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode( command.getProcessDefinitionCode()); if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) { logger.info("process code: {} complement dependent in off mode or schedule's size is 0, skip " + "dependent complement data", command.getProcessDefinitionCode()); } else { dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } break; } case RUN_MODE_PARALLEL: { if (startDate != null && endDate != null) { List<Schedule> schedules = processService.queryReleaseSchedulerListByProcessDefinitionCode( command.getProcessDefinitionCode()); List<ZonedDateTime> listDate = new ArrayList<>( CronUtils.getSelfFireDateList(DateUtils.stringToZoneDateTime(startDate), DateUtils.stringToZoneDateTime(endDate), schedules)); int listDateSize = listDate.size(); createCount = listDate.size();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (!CollectionUtils.isEmpty(listDate)) { if (expectedParallelismNumber != null && expectedParallelismNumber != 0) { createCount = Math.min(createCount, expectedParallelismNumber); } logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount); // D // T int itemsPerCommand = (listDateSize / createCount); int remainingItems = (listDateSize % createCount); int startDateIndex = 0; int endDateIndex = 0; for (int i = 1; i <= createCount; i++) { int extra = (i <= remainingItems) ? 1 : 0; int singleCommandItems = (itemsPerCommand + extra); if (i == 1) { endDateIndex += singleCommandItems - 1; } else { startDateIndex = endDateIndex + 1; endDateIndex += singleCommandItems; } cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, DateUtils.dateToString(listDate.get(startDateIndex))); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, DateUtils.dateToString(listDate.get(endDateIndex))); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); if (schedules.isEmpty() || complementDependentMode == ComplementDependentMode.OFF_MODE) { logger.info( "process code: {} complement dependent in off mode or schedule's size is 0, skip " + "dependent complement data",
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
command.getProcessDefinitionCode()); } else { dependentProcessDefinitionCreateCount += createComplementDependentCommand(schedules, command); } } } } if (StringUtils.isNotEmpty(dateList)) { List<String> listDate = Arrays.asList(dateList.split(COMMA)); createCount = listDate.size(); if (!CollectionUtils.isEmpty(listDate)) { if (expectedParallelismNumber != null && expectedParallelismNumber != 0) { createCount = Math.min(createCount, expectedParallelismNumber); } logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount); for (List<String> stringDate : Lists.partition(listDate, createCount)) { cmdParam.put(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST, String.join(COMMA, stringDate)); command.setCommandParam(JSONUtils.toJsonString(cmdParam)); processService.createCommand(command); } } } break; } default: break; } logger.info("create complement command count: {}, create dependent complement command count: {}", createCount, dependentProcessDefinitionCreateCount);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
return createCount; } /** * create complement dependent command */ protected int createComplementDependentCommand(List<Schedule> schedules, Command command) { int dependentProcessDefinitionCreateCount = 0; Command dependentCommand; try { dependentCommand = (Command) BeanUtils.cloneBean(command); } catch (Exception e) { logger.error("copy dependent command error: ", e); return dependentProcessDefinitionCreateCount; } List<DependentProcessDefinition> dependentProcessDefinitionList = getComplementDependentDefinitionList(dependentCommand.getProcessDefinitionCode(), CronUtils.getMaxCycle(schedules.get(0).getCrontab()), dependentCommand.getWorkerGroup()); dependentCommand.setTaskDependType(TaskDependType.TASK_POST); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { dependentCommand.setProcessDefinitionCode(dependentProcessDefinition.getProcessDefinitionCode()); dependentCommand.setProcessDefinitionVersion(dependentProcessDefinition.getProcessDefinitionVersion()); dependentCommand.setWorkerGroup(dependentProcessDefinition.getWorkerGroup()); Map<String, String> cmdParam = JSONUtils.toMap(dependentCommand.getCommandParam()); cmdParam.put(CMD_PARAM_START_NODES, String.valueOf(dependentProcessDefinition.getTaskDefinitionCode())); dependentCommand.setCommandParam(JSONUtils.toJsonString(cmdParam)); dependentProcessDefinitionCreateCount += processService.createCommand(dependentCommand); } return dependentProcessDefinitionCreateCount; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
* get complement d list */ private List<DependentProcessDefinition> getComplementDependentDefinitionList(long processDefinitionCode, CycleEnum processDefinitionCycle, String workerGroup) { List<DependentProcessDefinition> dependentProcessDefinitionList = processService.queryDependentProcessDefinitionByProcessDefinitionCode(processDefinitionCode); return checkDependentProcessDefinitionValid(dependentProcessDefinitionList, processDefinitionCycle, workerGroup, processDefinitionCode); } /** * Check whether the dependency cycle of the dependent node is consistent with the schedule cycle of * the d and if there is no worker group in the schedule, use the complement selection's * worker group */ private List<DependentProcessDefinition> checkDependentProcessDefinitionValid( List<DependentProcessDefinition> dependentProcessDefinitionList, CycleEnum processDefinitionCycle, String workerGroup, long upstreamProcessDefinitionCode) { List<DependentProcessDefinition> validDependentProcessDefinitionList = new ArrayList<>(); List<Long> processDefinitionCodeList = dependentProcessDefinitionList.stream().map(DependentProcessDefinition::getProcessDefinitionCode) .collect(Collectors.toList()); Map<Long, String> processDefinitionWorkerGroupMap = processService.queryWorkerGroupByProcessDefinitionCodes(processDefinitionCodeList); for (DependentProcessDefinition dependentProcessDefinition : dependentProcessDefinitionList) { if (dependentProcessDefinition.getDependentCycle(upstreamProcessDefinitionCode) == processDefinitionCycle) { if (processDefinitionWorkerGroupMap .get(dependentProcessDefinition.getProcessDefinitionCode()) == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
dependentProcessDefinition.setWorkerGroup(workerGroup); } validDependentProcessDefinitionList.add(dependentProcessDefinition); } } return validDependentProcessDefinitionList; } /** * @param schedule * @return check error return 0, otherwise 1 */ private boolean isValidateScheduleTime(String schedule) { Map<String, String> scheduleResult = JSONUtils.toMap(schedule); if (scheduleResult == null) { return false; } if (scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST)) { if (scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_SCHEDULE_DATE_LIST) == null) { return false; } } if (scheduleResult.containsKey(CMDPARAM_COMPLEMENT_DATA_START_DATE)) { String startDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); String endDate = scheduleResult.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); if (startDate == null || endDate == null) { return false; } try { ZonedDateTime start = DateUtils.stringToZoneDateTime(startDate); ZonedDateTime end = DateUtils.stringToZoneDateTime(endDate);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
if (start == null || end == null) { return false; } if (start.isAfter(end)) { logger.error("complement data error, wrong date start:{} and end date:{} ", start, end); return false; } } catch (Exception ex) { logger.warn("Parse schedule time error, startDate: {}, endDate: {}", startDate, endDate); return false; } } return true; } /** * @param scheduleTimeList * @return remove duplicate date list */ private String removeDuplicates(String scheduleTimeList) { if (StringUtils.isNotEmpty(scheduleTimeList)) { Set<String> dateSet = Arrays.stream(scheduleTimeList.split(COMMA)).map(String::trim).collect(Collectors.toSet()); return String.join(COMMA, dateSet); } return null; } /** * query executing data of processInstance by master * @param processInstanceId * @return
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
*/ @Override public WorkflowExecuteDto queryExecutingWorkflowByProcessInstanceId(Integer processInstanceId) { ProcessInstance processInstance = processService.findProcessInstanceDetailById(processInstanceId).orElse(null); if (processInstance == null) { return null; } Host host = new Host(processInstance.getHost()); WorkflowExecutingDataRequestCommand requestCommand = new WorkflowExecutingDataRequestCommand(); requestCommand.setProcessInstanceId(processInstanceId); org.apache.dolphinscheduler.remote.command.Command command = stateEventCallbackService.sendSync(host, requestCommand.convert2Command()); if (command == null) { return null; } WorkflowExecutingDataResponseCommand responseCommand = JSONUtils.parseObject(command.getBody(), WorkflowExecutingDataResponseCommand.class); return responseCommand.getWorkflowExecuteDto(); } @Override public Map<String, Object> execStreamTaskInstance(User loginUser, long projectCode, long taskDefinitionCode, int taskDefinitionVersion, int warningGroupId, String workerGroup, Long environmentCode, Map<String, String> startParams, int dryRun) { Project project = projectMapper.queryByCode(projectCode); Map<String, Object> result = projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_START); if (result.get(Constants.STATUS) != Status.SUCCESS) { return result;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java
} if (!checkMasterExists(result)) { return result; } // t List<Server> masterServerList = monitorService.getServerListFromRegistry(true); Host host = new Host(masterServerList.get(0).getHost(), masterServerList.get(0).getPort()); TaskExecuteStartCommand taskExecuteStartCommand = new TaskExecuteStartCommand(); taskExecuteStartCommand.setExecutorId(loginUser.getId()); taskExecuteStartCommand.setExecutorName(loginUser.getUserName()); taskExecuteStartCommand.setProjectCode(projectCode); taskExecuteStartCommand.setTaskDefinitionCode(taskDefinitionCode); taskExecuteStartCommand.setTaskDefinitionVersion(taskDefinitionVersion); taskExecuteStartCommand.setWorkerGroup(workerGroup); taskExecuteStartCommand.setWarningGroupId(warningGroupId); taskExecuteStartCommand.setEnvironmentCode(environmentCode); taskExecuteStartCommand.setStartParams(startParams); taskExecuteStartCommand.setDryRun(dryRun); org.apache.dolphinscheduler.remote.command.Command response = stateEventCallbackService.sendSync(host, taskExecuteStartCommand.convert2Command()); if (response != null) { putMsg(result, Status.SUCCESS); } else { putMsg(result, Status.START_TASK_INSTANCE_ERROR); } return result; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.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 *
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
* http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.RERUN; import static org.apache.dolphinscheduler.api.constants.ApiFuncIdentificationConstant.WORKFLOW_START; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import org.apache.dolphinscheduler.api.enums.ExecuteType; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.impl.BaseServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ExecutorServiceImpl; import org.apache.dolphinscheduler.api.service.impl.ProjectServiceImpl; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.*; import org.apache.dolphinscheduler.common.model.Server; import org.apache.dolphinscheduler.dao.entity.Command; import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; import org.apache.dolphinscheduler.dao.entity.ProcessInstance; import org.apache.dolphinscheduler.dao.entity.Project; import org.apache.dolphinscheduler.dao.entity.Schedule; import org.apache.dolphinscheduler.dao.entity.TaskGroupQueue; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.User;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; import org.apache.dolphinscheduler.dao.mapper.ProcessTaskRelationMapper; import org.apache.dolphinscheduler.dao.mapper.ProjectMapper; import org.apache.dolphinscheduler.dao.mapper.TaskDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.TaskGroupQueueMapper; import org.apache.dolphinscheduler.api.permission.ResourcePermissionCheckService; import org.apache.dolphinscheduler.service.process.ProcessService; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Optional; 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.slf4j.Logger; import org.slf4j.LoggerFactory; /** * executor service 2 test */ @RunWith(MockitoJUnitRunner.Silent.class) public class ExecutorServiceTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
private static final Logger logger = LoggerFactory.getLogger(ExecutorServiceTest.class); private static final Logger baseServiceLogger = LoggerFactory.getLogger(BaseServiceImpl.class); @Mock private ResourcePermissionCheckService resourcePermissionCheckService; @InjectMocks private ExecutorServiceImpl executorService; @Mock private ProcessService processService; @Mock private ProcessDefinitionMapper processDefinitionMapper; @Mock private ProcessTaskRelationMapper processTaskRelationMapper; @Mock private TaskDefinitionMapper taskDefinitionMapper; @Mock private ProjectMapper projectMapper; @Mock private ProjectServiceImpl projectService; @Mock private MonitorService monitorService; @Mock private TaskGroupQueueMapper taskGroupQueueMapper; @Mock private ProcessInstanceMapper processInstanceMapper; private int processDefinitionId = 1; private long processDefinitionCode = 1L; private int processInstanceId = 1; private int tenantId = 1; private int userId = 1; private int taskQueueId = 1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
private ProcessDefinition processDefinition = new ProcessDefinition(); private ProcessInstance processInstance = new ProcessInstance(); private TaskGroupQueue taskGroupQueue = new TaskGroupQueue(); private User loginUser = new User(); private long projectCode = 1L; private String projectName = "projectName"; private Project project = new Project(); private String cronTime; @Before public void init() { loginUser.setId(userId); processDefinition.setId(processDefinitionId); processDefinition.setReleaseState(ReleaseState.ONLINE); processDefinition.setTenantId(tenantId); processDefinition.setUserId(userId); processDefinition.setVersion(1); processDefinition.setCode(1L); processDefinition.setProjectCode(projectCode); processInstance.setId(processInstanceId); processInstance.setState(WorkflowExecutionStatus.FAILURE); processInstance.setExecutorId(userId); processInstance.setTenantId(tenantId); processInstance.setProcessDefinitionVersion(1); processInstance.setProcessDefinitionCode(1L); project.setCode(projectCode); project.setName(projectName);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
taskGroupQueue.setId(taskQueueId); taskGroupQueue.setStatus(TaskGroupQueueStatus.WAIT_QUEUE); taskGroupQueue.setProcessId(processInstanceId); cronTime = "2020-01-01 00:00:00,2020-01-31 23:00:00"; Mockito.when(projectMapper.queryByCode(projectCode)).thenReturn(project); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, WORKFLOW_START)) .thenReturn(checkProjectAndAuth()); Mockito.when(processDefinitionMapper.queryByCode(processDefinitionCode)).thenReturn(processDefinition); Mockito.when(processService.getTenantForProcess(tenantId, userId)).thenReturn(new Tenant()); Mockito.when(processService.createCommand(any(Command.class))).thenReturn(1); Mockito.when(monitorService.getServerListFromRegistry(true)).thenReturn(getMasterServersList()); Mockito.when(processService.findProcessInstanceDetailById(processInstanceId)).thenReturn(Optional.ofNullable(processInstance)); Mockito.when(processService.findProcessDefinition(1L, 1)).thenReturn(processDefinition); Mockito.when(taskGroupQueueMapper.selectById(1)).thenReturn(taskGroupQueue); Mockito.when(processInstanceMapper.selectById(1)).thenReturn(processInstance); } @Test public void testForceStartTaskInstance() { Map<String, Object> result = executorService.forceStartTaskInstance(loginUser, taskQueueId); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } /** * not complement */ @Test public void testNoComplement() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode))
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
.thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.START_PROCESS, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 10, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(1)).createCommand(any(Command.class)); } /** * not complement */ @Test public void testComplementWithStartNodeList() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode)) .thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.START_PROCESS, null, "n1,n2", null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS));
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
verify(processService, times(1)).createCommand(any(Command.class)); } /** * date error */ @Test public void testDateError() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode)) .thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2022-01-07 12:12:12\",\"complementEndDate\":\"2022-01-06 12:12:12\"}", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.START_PROCESS_INSTANCE_ERROR, result.get(Constants.STATUS)); verify(processService, times(0)).createCommand(any(Command.class)); } /** * serial */ @Test public void testSerial() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode)) .thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode,
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
"{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_SERIAL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(1)).createCommand(any(Command.class)); } /** * without schedule */ @Test public void testParallelWithOutSchedule() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode)) .thenReturn(zeroSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_PARALLEL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(31)).createCommand(any(Command.class)); } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
* with schedule */ @Test public void testParallelWithSchedule() { Mockito.when(processService.queryReleaseSchedulerListByProcessDefinitionCode(processDefinitionCode)) .thenReturn(oneSchedulerList()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_PARALLEL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 15, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); verify(processService, times(15)).createCommand(any(Command.class)); } @Test public void testNoMasterServers() { Mockito.when(monitorService.getServerListFromRegistry(true)).thenReturn(new ArrayList<>()); Map<String, Object> result = executorService.execProcessInstance(loginUser, projectCode, processDefinitionCode, "{\"complementStartDate\":\"2020-01-01 00:00:00\",\"complementEndDate\":\"2020-01-31 23:00:00\"}", CommandType.COMPLEMENT_DATA, null, null, null, null, 0, RunMode.RUN_MODE_PARALLEL, Priority.LOW, Constants.DEFAULT_WORKER_GROUP, 100L, 110, null, 0, Constants.DRY_RUN_FLAG_NO, ComplementDependentMode.OFF_MODE);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
Assert.assertEquals(result.get(Constants.STATUS), Status.MASTER_NOT_EXISTS); } @Test public void testExecuteRepeatRunning() { Mockito.when(processService.verifyIsNeedCreateCommand(any(Command.class))).thenReturn(true); Mockito.when(projectService.checkProjectAndAuth(loginUser, project, projectCode, RERUN)) .thenReturn(checkProjectAndAuth()); Map<String, Object> result = executorService.execute(loginUser, projectCode, processInstanceId, ExecuteType.REPEAT_RUNNING); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } @Test public void testStartCheckByProcessDefinedCode() { List<Long> ids = new ArrayList<>(); ids.add(1L); Mockito.doNothing().when(processService).recurseFindSubProcess(1, ids); List<ProcessDefinition> processDefinitionList = new ArrayList<>(); ProcessDefinition processDefinition = new ProcessDefinition(); processDefinition.setId(1); processDefinition.setReleaseState(ReleaseState.ONLINE); processDefinitionList.add(processDefinition); Mockito.when(processDefinitionMapper.queryDefinitionListByIdList(new Integer[ids.size()])) .thenReturn(processDefinitionList); Map<String, Object> result = executorService.startCheckByProcessDefinedCode(1L); Assert.assertEquals(Status.SUCCESS, result.get(Constants.STATUS)); } private List<Server> getMasterServersList() { List<Server> masterServerList = new ArrayList<>(); Server masterServer1 = new Server(); masterServer1.setId(1);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
masterServer1.setHost("192.168.220.188"); masterServer1.setPort(1121); masterServerList.add(masterServer1); Server masterServer2 = new Server(); masterServer2.setId(2); masterServer2.setHost("192.168.220.189"); masterServer2.setPort(1122); masterServerList.add(masterServer2); return masterServerList; } private List zeroSchedulerList() { return Collections.EMPTY_LIST; } private List<Schedule> oneSchedulerList() { List<Schedule> schedulerList = new LinkedList<>(); Schedule schedule = new Schedule(); schedule.setCrontab("0 0 0 1/2 * ?"); schedulerList.add(schedule); return schedulerList; } private Map<String, Object> checkProjectAndAuth() { Map<String, Object> result = new HashMap<>(); result.put(Constants.STATUS, Status.SUCCESS); return result; } @Test public void testCreateComplementToParallel() { List<String> result = new ArrayList<>(); int expectedParallelismNumber = 3; LinkedList<Integer> listDate = new LinkedList<>();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,928
[Bug] [Dependent] Start process instance error when enable dependent 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 Start process instance error when enable dependent mode, I find in `dependentCommand = (Command) BeanUtils.cloneBean(command)` the command id not modified due to Duplicate entry 'xxx' for key 't_ds_command.PRIMARY', I suspect it relation https://github.com/apache/dolphinscheduler/pull/11765 ### What you expected to happen Start process success. ### How to reproduce Use dev code, create two process, one parent, one child dependent parent and start parent process use dependent mode. ### 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/11928
https://github.com/apache/dolphinscheduler/pull/11929
e938fdbe968ac88f184175f3ef4d0b2a7836c3ea
bd0fa79e377853eb3d5e92af87dabd70130ec6a5
2022-09-14T08:23:40Z
java
2022-09-15T02:00:38Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ExecutorServiceTest.java
listDate.add(0); listDate.add(1); listDate.add(2); listDate.add(3); listDate.add(4); int listDateSize = listDate.size(); int createCount = Math.min(listDate.size(), expectedParallelismNumber); logger.info("In parallel mode, current expectedParallelismNumber:{}", createCount); int itemsPerCommand = (listDateSize / createCount); int remainingItems = (listDateSize % createCount); int startDateIndex = 0; int endDateIndex = 0; for (int i = 1; i <= createCount; i++) { int extra = (i <= remainingItems) ? 1 : 0; int singleCommandItems = (itemsPerCommand + extra); if (i == 1) { endDateIndex += singleCommandItems - 1; } else { startDateIndex = endDateIndex + 1; endDateIndex += singleCommandItems; } logger.info("startDate:{}, endDate:{}", listDate.get(startDateIndex), listDate.get(endDateIndex)); result.add(listDate.get(startDateIndex) + "," + listDate.get(endDateIndex)); } Assert.assertEquals("0,1", result.get(0)); Assert.assertEquals("2,3", result.get(1)); Assert.assertEquals("4,4", result.get(2)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,938
[Question] [3.0.0-beta-2] /tmp/dolphinscheduler/exec/process.command: /bin/spark-submit: not found
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I hava deployed ds by docker-compose and mount the spark-client on localhost,when I submit a spark-task(the example task of sparkPi), the error below happends: [INFO] 2022-07-13 08:30:49.424 +0000 [taskAppId=TASK-20220713-6178360895936_1-48-48] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.spark.SparkTask:[63] - -> /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 4: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: source: not found /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 5: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: /bin/spark-submit: not found ### What you expected to happen the task can run successfully ### How to reproduce 1、deployed dolphinscheduler by docker-compose 2、mount the directory /opt/soft on localhost ### Anything else _No response_ ### Version 3.0.0-beta-2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10938
https://github.com/apache/dolphinscheduler/pull/11625
9813ded98144d37afbe0a8648c29df234685c106
511149f644224d34ef899321efc114104ef61763
2022-07-13T09:16:24Z
java
2022-09-15T07:05:09Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.api; import org.apache.commons.io.FileUtils; import org.apache.commons.lang3.SystemUtils; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,938
[Question] [3.0.0-beta-2] /tmp/dolphinscheduler/exec/process.command: /bin/spark-submit: not found
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I hava deployed ds by docker-compose and mount the spark-client on localhost,when I submit a spark-task(the example task of sparkPi), the error below happends: [INFO] 2022-07-13 08:30:49.424 +0000 [taskAppId=TASK-20220713-6178360895936_1-48-48] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.spark.SparkTask:[63] - -> /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 4: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: source: not found /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 5: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: /bin/spark-submit: not found ### What you expected to happen the task can run successfully ### How to reproduce 1、deployed dolphinscheduler by docker-compose 2、mount the directory /opt/soft on localhost ### Anything else _No response_ ### Version 3.0.0-beta-2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10938
https://github.com/apache/dolphinscheduler/pull/11625
9813ded98144d37afbe0a8648c29df234685c106
511149f644224d34ef899321efc114104ef61763
2022-07-13T09:16:24Z
java
2022-09-15T07:05:09Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java
import java.nio.file.Files; import java.nio.file.Paths; import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; import org.slf4j.Logger; import com.google.common.base.Strings; /** * shell command executor */ public class ShellCommandExecutor extends AbstractCommandExecutor { /** * For Unix-like, using sh */ private static final String SH = "sh"; /** * For Windows, using cmd.exe */ private static final String CMD = "cmd.exe"; /** * constructor * * @param logHandler logHandler * @param taskRequest taskRequest * @param logger logger */ public ShellCommandExecutor(Consumer<LinkedBlockingQueue<String>> logHandler, TaskExecutionContext taskRequest, Logger logger) { super(logHandler, taskRequest, logger); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,938
[Question] [3.0.0-beta-2] /tmp/dolphinscheduler/exec/process.command: /bin/spark-submit: not found
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I hava deployed ds by docker-compose and mount the spark-client on localhost,when I submit a spark-task(the example task of sparkPi), the error below happends: [INFO] 2022-07-13 08:30:49.424 +0000 [taskAppId=TASK-20220713-6178360895936_1-48-48] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.spark.SparkTask:[63] - -> /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 4: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: source: not found /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 5: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: /bin/spark-submit: not found ### What you expected to happen the task can run successfully ### How to reproduce 1、deployed dolphinscheduler by docker-compose 2、mount the directory /opt/soft on localhost ### Anything else _No response_ ### Version 3.0.0-beta-2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10938
https://github.com/apache/dolphinscheduler/pull/11625
9813ded98144d37afbe0a8648c29df234685c106
511149f644224d34ef899321efc114104ef61763
2022-07-13T09:16:24Z
java
2022-09-15T07:05:09Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java
public ShellCommandExecutor(LinkedBlockingQueue<String> logBuffer) { super(logBuffer); } @Override protected String buildCommandFilePath() { return String.format("%s/%s.%s" , taskRequest.getExecutePath() , taskRequest.getTaskAppId() , SystemUtils.IS_OS_WINDOWS ? "bat" : "command"); } /** * create command file if not exists * * @param execCommand exec command * @param commandFile command file * @throws IOException io exception */ @Override protected void createCommandFileIfNotExists(String execCommand, String commandFile) throws IOException { logger.info("tenantCode user:{}, task dir:{}", taskRequest.getTenantCode(), taskRequest.getTaskAppId()); if (!Files.exists(Paths.get(commandFile))) { logger.info("create command file:{}", commandFile); StringBuilder sb = new StringBuilder(); if (SystemUtils.IS_OS_WINDOWS) { sb.append("@echo off\n"); sb.append("cd /d %~dp0\n"); if (!Strings.isNullOrEmpty(taskRequest.getEnvironmentConfig())) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,938
[Question] [3.0.0-beta-2] /tmp/dolphinscheduler/exec/process.command: /bin/spark-submit: not found
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened I hava deployed ds by docker-compose and mount the spark-client on localhost,when I submit a spark-task(the example task of sparkPi), the error below happends: [INFO] 2022-07-13 08:30:49.424 +0000 [taskAppId=TASK-20220713-6178360895936_1-48-48] TaskLogLogger-class org.apache.dolphinscheduler.plugin.task.spark.SparkTask:[63] - -> /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 4: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: source: not found /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: 5: /tmp/dolphinscheduler/exec/process/6169061703072/6178360895936_1/48/48/48_48.command: /bin/spark-submit: not found ### What you expected to happen the task can run successfully ### How to reproduce 1、deployed dolphinscheduler by docker-compose 2、mount the directory /opt/soft on localhost ### Anything else _No response_ ### Version 3.0.0-beta-2 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/10938
https://github.com/apache/dolphinscheduler/pull/11625
9813ded98144d37afbe0a8648c29df234685c106
511149f644224d34ef899321efc114104ef61763
2022-07-13T09:16:24Z
java
2022-09-15T07:05:09Z
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/ShellCommandExecutor.java
sb.append(taskRequest.getEnvironmentConfig()).append("\n"); } else { if (taskRequest.getEnvFile() != null) { sb.append("call ").append(taskRequest.getEnvFile()).append("\n"); } } } else { sb.append("#!/bin/sh\n"); sb.append("BASEDIR=$(cd `dirname $0`; pwd)\n"); sb.append("cd $BASEDIR\n"); if (!Strings.isNullOrEmpty(taskRequest.getEnvironmentConfig())) { sb.append(taskRequest.getEnvironmentConfig()).append("\n"); } else { if (taskRequest.getEnvFile() != null) { sb.append("source ").append(taskRequest.getEnvFile()).append("\n"); } } } sb.append(execCommand); logger.info("command : {}", sb); FileUtils.writeStringToFile(new File(commandFile), sb.toString(), StandardCharsets.UTF_8); } } @Override protected String commandInterpreter() { return SystemUtils.IS_OS_WINDOWS ? CMD : SH; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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.dolphinscheduler.common.enums.WorkflowExecutionStatus; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.SystemUtils; import java.time.Duration; import java.util.regex.Pattern; public final class Constants {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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"; 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";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
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"; /** * hdfs defaultFS property name. Should be consistent with the property name in hdfs-site.xml */ public static final String HDFS_DEFAULT_FS = "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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
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"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* ENDED */ public static final String ENDED = "ENDED"; /** * NEW */ public static final String NEW = "NEW"; /** * NEW_SAVING */ public static final String NEW_SAVING = "NEW_SAVING"; /** * SUBMITTED */ public static final String SUBMITTED = "SUBMITTED"; /** * FAILED */ public static final String FAILED = "FAILED"; /** * KILLED */ public static final String KILLED = "KILLED"; /** * RUNNING */ public static final String RUNNING = "RUNNING"; /** * underline "_" */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String UNDERLINE = "_"; /** * application regex */ public static final String APPLICATION_REGEX = "application_\\d+_\\d+"; public static final String PID = SystemUtils.IS_OS_WINDOWS ? "handle" : "pid"; /** * month_begin */ public static final String MONTH_BEGIN = "month_begin"; /** * add_months */ public static final String ADD_MONTHS = "add_months"; /** * month_end */ public static final String MONTH_END = "month_end"; /** * week_begin */ public static final String WEEK_BEGIN = "week_begin"; /** * week_end */ public static final String WEEK_END = "week_end"; /** * timestamp */ public static final String TIMESTAMP = "timestamp";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final char SUBTRACT_CHAR = '-'; public static final char ADD_CHAR = '+'; public static final char MULTIPLY_CHAR = '*'; public static final char DIVISION_CHAR = '/'; public static final char LEFT_BRACE_CHAR = '('; public static final char RIGHT_BRACE_CHAR = ')'; public static final String ADD_STRING = "+"; public static final String STAR = "*"; public static final String DIVISION_STRING = "/"; public static final String LEFT_BRACE_STRING = "("; public static final char P = 'P'; public static final char N = 'N'; public static final String SUBTRACT_STRING = "-"; public static final String GLOBAL_PARAMS = "globalParams"; public static final String LOCAL_PARAMS = "localParams"; public static final String SUBPROCESS_INSTANCE_ID = "subProcessInstanceId"; public static final String PROCESS_INSTANCE_STATE = "processInstanceState"; public static final String PARENT_WORKFLOW_INSTANCE = "parentWorkflowInstance"; public static final String CONDITION_RESULT = "conditionResult"; public static final String SWITCH_RESULT = "switchResult"; public static final String WAIT_START_TIMEOUT = "waitStartTimeout"; public static final String DEPENDENCE = "dependence"; public static final String TASK_LIST = "taskList"; public static final String QUEUE = "queue"; public static final String QUEUE_NAME = "queueName"; public static final int LOG_QUERY_SKIP_LINE_NUMBER = 0; public static final int LOG_QUERY_LIMIT = 4096; public static final String BLOCKING_CONDITION = "blockingCondition"; public static final String ALERT_WHEN_BLOCKING = "alertWhenBlocking"; /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
* master/worker server use for zk */ public static final String MASTER_TYPE = "master"; public static final String WORKER_TYPE = "worker"; public static final String DELETE_OP = "delete"; public static final String ADD_OP = "add"; public static final String ALIAS = "alias"; public static final String CONTENT = "content"; public static final String DEPENDENT_SPLIT = ":||"; public static final long DEPENDENT_ALL_TASK_CODE = 0; /** * preview schedule execute count */ public static final int PREVIEW_SCHEDULE_EXECUTE_COUNT = 5; /** * kerberos */ public static final String KERBEROS = "kerberos"; /** * kerberos expire time */ public static final String KERBEROS_EXPIRE_TIME = "kerberos.expire.time"; /** * java.security.krb5.conf */ public static final String JAVA_SECURITY_KRB5_CONF = "java.security.krb5.conf"; /** * java.security.krb5.conf.path */ public static final String JAVA_SECURITY_KRB5_CONF_PATH = "java.security.krb5.conf.path";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
/** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION = "hadoop.security.authentication"; /** * hadoop.security.authentication */ public static final String HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE = "hadoop.security.authentication.startup.state"; /** * com.amazonaws.services.s3.enableV4 */ public static final String AWS_S3_V4 = "com.amazonaws.services.s3.enableV4"; /** * loginUserFromKeytab user */ public static final String LOGIN_USER_KEY_TAB_USERNAME = "login.user.keytab.username"; /** * loginUserFromKeytab path */ public static final String LOGIN_USER_KEY_TAB_PATH = "login.user.keytab.path"; public static final String WORKFLOW_INSTANCE_ID_MDC_KEY = "workflowInstanceId"; public static final String TASK_INSTANCE_ID_MDC_KEY = "taskInstanceId"; /** * task log info format */ public static final String TASK_LOG_INFO_FORMAT = "TaskLogInfo-%s"; public static final int[] NOT_TERMINATED_STATES = new int[]{ WorkflowExecutionStatus.SUBMITTED_SUCCESS.getCode(), TaskExecutionStatus.DISPATCH.getCode(),
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
WorkflowExecutionStatus.RUNNING_EXECUTION.getCode(), WorkflowExecutionStatus.DELAY_EXECUTION.getCode(), WorkflowExecutionStatus.READY_PAUSE.getCode(), WorkflowExecutionStatus.READY_STOP.getCode(), TaskExecutionStatus.NEED_FAULT_TOLERANCE.getCode(), }; public static final int[] RUNNING_PROCESS_STATE = new int[]{ TaskExecutionStatus.RUNNING_EXECUTION.getCode(), TaskExecutionStatus.SUBMITTED_SUCCESS.getCode(), TaskExecutionStatus.DISPATCH.getCode(), WorkflowExecutionStatus.SERIAL_WAIT.getCode() }; /** * status */ public static final String STATUS = "status"; /** * message */ public static final String MSG = "msg"; /** * data total */ public static final String COUNT = "count"; /** * page size */ public static final String PAGE_SIZE = "pageSize"; /** * current page no
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String PAGE_NUMBER = "pageNo"; /** * */ public static final String DATA_LIST = "data"; public static final String TOTAL_LIST = "totalList"; public static final String CURRENT_PAGE = "currentPage"; public static final String TOTAL_PAGE = "totalPage"; public static final String TOTAL = "total"; /** * workflow */ public static final String WORKFLOW_LIST = "workFlowList"; public static final String WORKFLOW_RELATION_LIST = "workFlowRelationList"; /** * session user */ public static final String SESSION_USER = "session.user"; public static final String SESSION_ID = "sessionId"; /** * locale */ public static final String LOCALE_LANGUAGE = "language"; /** * database type */ public static final String MYSQL = "MYSQL"; public static final String HIVE = "HIVE"; public static final String ADDRESS = "address";
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final String DATABASE = "database"; public static final String OTHER = "other"; public static final String USER = "user"; public static final String JDBC_URL = "jdbcUrl"; /** * session timeout */ public static final int SESSION_TIME_OUT = 7200; public static final int MAX_FILE_SIZE = 1024 * 1024 * 1024; public static final String UDF = "UDF"; public static final String CLASS = "class"; /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; /** * default worker group */ public static final String DEFAULT_WORKER_GROUP = "default"; /** * authorize writable perm */ public static final int AUTHORIZE_WRITABLE_PERM = 7; /** * authorize readable perm */ public static final int AUTHORIZE_READABLE_PERM = 4; public static final int NORMAL_NODE_STATUS = 0; public static final int ABNORMAL_NODE_STATUS = 1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int BUSY_NODE_STATUE = 2; public static final String START_TIME = "start time"; public static final String END_TIME = "end time"; public static final String START_END_DATE = "startDate,endDate"; /** * system line separator */ public static final String SYSTEM_LINE_SEPARATOR = System.getProperty("line.separator"); /** * datasource encryption salt */ public static final String DATASOURCE_ENCRYPTION_SALT_DEFAULT = "!@#$%^&*"; public static final String DATASOURCE_ENCRYPTION_ENABLE = "datasource.encryption.enable"; public static final String DATASOURCE_ENCRYPTION_SALT = "datasource.encryption.salt"; /** * network interface preferred */ public static final String DOLPHIN_SCHEDULER_NETWORK_INTERFACE_PREFERRED = "dolphin.scheduler.network.interface.preferred"; /** * network IP gets priority, default inner outer */ public static final String DOLPHIN_SCHEDULER_NETWORK_PRIORITY_STRATEGY = "dolphin.scheduler.network.priority.strategy"; /** * exec shell scripts */ public static final String SH = "sh"; /** * pstree, get pud and sub pid
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
*/ public static final String PSTREE = "pstree"; public static final boolean KUBERNETES_MODE = !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_HOST")) && !StringUtils.isEmpty(System.getenv("KUBERNETES_SERVICE_PORT")); /** * dry run flag */ public static final int DRY_RUN_FLAG_NO = 0; public static final int DRY_RUN_FLAG_YES = 1; /** * data.quality.error.output.path */ public static final String DATA_QUALITY_ERROR_OUTPUT_PATH = "data-quality.error.output.path"; public static final String CACHE_KEY_VALUE_ALL = "'all'"; /** * use for k8s */ public static final String NAMESPACE = "namespace"; public static final String CLUSTER = "cluster"; public static final String LIMITS_CPU = "limitsCpu"; public static final String LIMITS_MEMORY = "limitsMemory"; public static final Long K8S_LOCAL_TEST_CLUSTER_CODE = 0L; /** * schedule timezone */ public static final String SCHEDULE_TIMEZONE = "schedule_timezone"; public static final int RESOURCE_FULL_NAME_MAX_LENGTH = 128; /** * tenant */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/Constants.java
public static final int TENANT_FULL_NAME_MAX_LENGTH = 30; /** * schedule time the amount of date data is too large, affecting the memory, so set 100 */ public static final int SCHEDULE_TIME_MAX_LENGTH = 100; /** * password max and min LENGTH */ public static final int USER_PASSWORD_MAX_LENGTH = 20; public static final int USER_PASSWORD_MIN_LENGTH = 2; public static final String FUNCTION_START_WITH = "$"; public static final Integer DEFAULT_QUEUE_ID = 1; /** * Security authentication types (supported types: PASSWORD,LDAP) */ public static final String SECURITY_CONFIG_TYPE = "securityConfigType"; public static final String SECURITY_CONFIG_TYPE_PASSWORD = "PASSWORD"; public static final String SECURITY_CONFIG_TYPE_LDAP = "LDAP"; /** * Task Types */ public static final String TYPE_UNIVERSAL = "Universal"; public static final String TYPE_DATA_INTEGRATION = "DataIntegration"; public static final String TYPE_CLOUD = "Cloud"; public static final String TYPE_LOGIC = "Logic"; public static final String TYPE_DATA_QUALITY = "DataQuality"; public static final String TYPE_OTHER = "Other"; public static final String TYPE_MACHINE_LEARNING = "MachineLearning"; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.server.log; import static org.apache.dolphinscheduler.server.log.SensitiveDataConverter.passwordHandler; import org.apache.dolphinscheduler.common.Constants; import java.util.regex.Pattern; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SensitiveDataConverterTest { private final Logger logger = LoggerFactory.getLogger(SensitiveDataConverterTest.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,452
[Bug] [Logger Server] Incorrect password regular expression
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened SensitiveDataConverter passwordHandler /** * dataSource sensitive param */ public static final String DATASOURCE_PASSWORD_REGEX = "(?<=((?i)password((\\\\\":\\\\\")|(=')))).*?(?=((\\\\\")|(')))"; The log password printed at runtime is not replaced with * sign ### What you expected to happen "password":"view1" can replace to "password":"****" ### How to reproduce the old pattern is ok. DATASOURCE_PASSWORD_REGEX = "(?<=(\"password\":\")).*?(?=(\"))" ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11452
https://github.com/apache/dolphinscheduler/pull/11459
5811b84fcc7cc0ff354cf8e871f36aa3ae61aa2a
71b4087421f8677318eca56cf197d2095247a19e
2022-08-12T08:03:21Z
java
2022-09-16T05:34:22Z
dolphinscheduler-log-server/src/test/java/org/apache/dolphinscheduler/server/log/SensitiveDataConverterTest.java
/** * password pattern */ private final Pattern pwdPattern = Pattern.compile(Constants.DATASOURCE_PASSWORD_REGEX); private final String logMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," + "\"database\":\"carbond\"," + "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," + "\"user\":\"view\"," + "\"password\":\"view1\"}"; private final String maskLogMsg = "{\"address\":\"jdbc:mysql://192.168.xx.xx:3306\"," + "\"database\":\"carbond\"," + "\"jdbcUrl\":\"jdbc:mysql://192.168.xx.xx:3306/ods\"," + "\"user\":\"view\"," + "\"password\":\"******\"}"; @Test public void convert() { Assert.assertNotEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); } /** * mask sensitive logMsg - sql task datasource password */ @Test public void testPwdLogMsgConverter() { logger.info("parameter : {}", logMsg); logger.info("parameter : {}", passwordHandler(pwdPattern, logMsg)); Assert.assertEquals(logMsg, passwordHandler(pwdPattern, logMsg)); Assert.assertNotEquals(maskLogMsg, passwordHandler(pwdPattern, logMsg)); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.sql; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.collections4.CollectionUtils; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.task.api.*; import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskAlertInfo; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.UdfFuncParameters; 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; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.slf4j.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; public class SqlTask extends AbstractTask {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * sql parameters */ private SqlParameters sqlParameters;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/** * base datasource */ private BaseConnectionParam baseConnectionParam; /** * create function format * include replace here which can be compatible with more cases, for example a long-running Spark session in Kyuubi will keep its own temp functions instead of destroying them right away */ private static final String CREATE_OR_REPLACE_FUNCTION_FORMAT = "create or replace temporary function {0} as ''{1}''"; /** * default query sql limit */ private static final int QUERY_LIMIT = 10000; private SQLTaskExecutionContext sqlTaskExecutionContext; public static final int TEST_FLAG_YES = 1; /** * Abstract Yarn Task * * @param taskRequest taskRequest */ public SqlTask(TaskExecutionContext taskRequest) { super(taskRequest); this.taskExecutionContext = taskRequest; this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class); assert sqlParameters != null; if (taskExecutionContext.getTestFlag() == TEST_FLAG_YES && this.sqlParameters.getDatasource() == 0) { throw new RuntimeException("unbound test data source"); } if (!sqlParameters.checkParameters()) { throw new RuntimeException("sql task params is not valid");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} sqlTaskExecutionContext = sqlParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper()); } @Override public AbstractParameters getParameters() { return sqlParameters; } @Override public void handle(TaskCallBack taskCallBack) throws TaskException { logger.info("Full sql parameters: {}", sqlParameters); logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {},varPool : {} ,query max result limit {}", sqlParameters.getType(), sqlParameters.getDatasource(), sqlParameters.getSql(), sqlParameters.getLocalParams(), sqlParameters.getUdfs(), sqlParameters.getShowType(), sqlParameters.getConnParams(), sqlParameters.getVarPool(), sqlParameters.getLimit()); try { baseConnectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( DbType.valueOf(sqlParameters.getType()), sqlTaskExecutionContext.getConnectionParams()); List<SqlBinds> mainStatementSqlBinds = SqlSplitter.split(sqlParameters.getSql(), sqlParameters.getSegmentSeparator()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<String> createFuncs = createFuncs(sqlTaskExecutionContext.getUdfFuncParametersList(), logger); executeFuncAndSql(mainStatementSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs); setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS); } catch (Exception e) { setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); logger.error("sql task error", e); throw new TaskException("Execute sql task failed", e); } } @Override public void cancel() throws TaskException { } /** * execute function and sql * * @param mainStatementsBinds main statements binds * @param preStatementsBinds pre statements binds * @param postStatementsBinds post statements binds * @param createFuncs create functions
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
*/ public void executeFuncAndSql(List<SqlBinds> mainStatementsBinds, List<SqlBinds> preStatementsBinds, List<SqlBinds> postStatementsBinds, List<String> createFuncs) throws Exception { Connection connection = null; try { connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam); if (CollectionUtils.isNotEmpty(createFuncs)) { createTempFunction(connection, createFuncs); } executeUpdate(connection, preStatementsBinds, "pre"); String result = null; if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) { result = executeQuery(connection, mainStatementsBinds.get(0), "main"); } else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) { String updateResult = executeUpdate(connection, mainStatementsBinds, "main"); result = setNonQuerySqlReturn(updateResult, sqlParameters.getLocalParams()); } sqlParameters.dealOutParam(result); executeUpdate(connection, postStatementsBinds, "post");
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} catch (Exception e) { logger.error("execute sql error: {}", e.getMessage()); throw e; } finally { close(connection); } } private String setNonQuerySqlReturn(String updateResult, List<Property> properties) { String result = null; for (Property info : properties) { if (Direct.OUT == info.getDirect()) { List<Map<String, String>> updateRL = new ArrayList<>(); Map<String, String> updateRM = new HashMap<>(); updateRM.put(info.getProp(), updateResult); updateRL.add(updateRM); result = JSONUtils.toJsonString(updateRL); break; } } return result; } /** * result process * * @param resultSet resultSet * @throws Exception Exception */ private String resultProcess(ResultSet resultSet) throws Exception { ArrayNode resultJSONArray = JSONUtils.createArrayNode(); if (resultSet != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
ResultSetMetaData md = resultSet.getMetaData(); int num = md.getColumnCount(); int rowCount = 0; int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit(); while (resultSet.next()) { if (rowCount == limit) { logger.info("sql result limit : {} exceeding results are filtered", limit); break; } ObjectNode mapOfColValues = JSONUtils.createObjectNode(); for (int i = 1; i <= num; i++) { mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i))); } resultJSONArray.add(mapOfColValues); rowCount++; } int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS; displayRows = Math.min(displayRows, rowCount); logger.info("display sql result {} rows as follows:", displayRows); for (int i = 0; i < displayRows; i++) { String row = JSONUtils.toJsonString(resultJSONArray.get(i)); logger.info("row {} : {}", i + 1, row); } } String result = JSONUtils.toJsonString(resultJSONArray); if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) { sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result sets", result); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
logger.debug("execute sql result : {}", result); return result; } /** * send alert as an attachment * * @param title title * @param content content */ private void sendAttachment(int groupId, String title, String content) { setNeedAlert(Boolean.TRUE); TaskAlertInfo taskAlertInfo = new TaskAlertInfo(); taskAlertInfo.setAlertGroupId(groupId); taskAlertInfo.setContent(content); taskAlertInfo.setTitle(title); setTaskAlertInfo(taskAlertInfo); } private String executeQuery(Connection connection, SqlBinds sqlBinds, String handlerType) throws Exception { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBinds)) { logger.info("{} statement execute query, for sql: {}", handlerType, sqlBinds.getSql()); ResultSet resultSet = statement.executeQuery(); return resultProcess(resultSet); } } private String executeUpdate(Connection connection, List<SqlBinds> statementsBinds, String handlerType) throws Exception { int result = 0; for (SqlBinds sqlBind : statementsBinds) { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind)) { result = statement.executeUpdate(); logger.info("{} statement execute update result: {}, for sql: {}", handlerType, result, sqlBind.getSql());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} } return String.valueOf(result); } /** * create temp function * * @param connection connection * @param createFuncs createFuncs */ private void createTempFunction(Connection connection, List<String> createFuncs) throws Exception { try (Statement funcStmt = connection.createStatement()) { for (String createFunc : createFuncs) { logger.info("hive create function sql: {}", createFunc); funcStmt.execute(createFunc); } } } /** * close jdbc resource * * @param connection connection */ private void close(Connection connection) { if (connection != null) { try { connection.close(); } catch (SQLException e) { logger.error("close connection error : {}", e.getMessage(), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} } } /** * preparedStatement bind * * @param connection connection * @param sqlBinds sqlBinds * @return PreparedStatement * @throws Exception Exception */ private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) { boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED || taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; try { PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql()); if (timeoutFlag) { stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); } Map<Integer, Property> params = sqlBinds.getParamsMap(); if (params != null) { for (Map.Entry<Integer, Property> entry : params.entrySet()) { Property prop = entry.getValue(); ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue()); } } logger.info("prepare statement replace sql : {} ", stmt); return stmt; } catch (Exception exception) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
throw new TaskException("SQL task prepareStatementAndBind error", exception); } } /** * p * * @param content content * @param formatSql format sql * @param rgex rgex * @param sqlParamsMap sql params map */ private void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) { logger.info("after replace sql , preparing : {}", formatSql); StringBuilder logPrint = new StringBuilder("replaced sql , parameters:"); if (sqlParamsMap == null) { logger.info("printReplacedSql: sqlParamsMap is null."); } else { for (int i = 1; i <= sqlParamsMap.size(); i++) { logPrint.append(sqlParamsMap.get(i).getValue()).append("(").append(sqlParamsMap.get(i).getType()).append(")"); } } logger.info("Sql Params are {}", logPrint); } /** * ready to execute SQL and parameter entity Map * * @return SqlBinds */ private SqlBinds getSqlAndSqlParamsMap(String sql) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
Map<Integer, Property> sqlParamsMap = new HashMap<>(); StringBuilder sqlBuilder = new StringBuilder(); Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap(); if (paramsMap == null) { sqlBuilder.append(sql); return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } if (StringUtils.isNotEmpty(sqlParameters.getTitle())) { String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(), ParamUtils.convert(paramsMap)); logger.info("SQL title : {}", title); sqlParameters.setTitle(title); } sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime()); setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap,taskExecutionContext.getTaskInstanceId()); String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*"; sql = replaceOriginalValue(sql, rgexo, paramsMap); // r String formatSql = sql.replaceAll(rgex, "?"); // C formatSql = ParameterUtils.expandListParameter(sqlParamsMap, formatSql); sqlBuilder.append(formatSql); // p printReplacedSql(sql, formatSql, rgex, sqlParamsMap);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } private String replaceOriginalValue(String content, String rgex, Map<String, Property> sqlParamsMap) { Pattern pattern = Pattern.compile(rgex); while (true) { Matcher m = pattern.matcher(content); if (!m.find()) { break; } String paramName = m.group(1); String paramValue = sqlParamsMap.get(paramName).getValue(); content = m.replaceFirst(paramValue); } return content; } /** * create function list * * @param udfFuncParameters udfFuncParameters * @param logger logger * @return */ private List<String> createFuncs(List<UdfFuncParameters> udfFuncParameters, Logger logger) { if (CollectionUtils.isEmpty(udfFuncParameters)) { logger.info("can't find udf function resource"); return null; } // b List<String> funcList = buildJarSql(udfFuncParameters); // b
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
11,291
[Improvement][sql] Improvement the log output while executing multiple sql statements
### 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 Currently, the log does not output the currently executing sql statement while executing multiple sql statements. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/11291
https://github.com/apache/dolphinscheduler/pull/11292
8cddb10773fe8f7b58533b8e089cabc87622a039
b3bbf69b2ecd44962b612e4456fe2d7d2c3530f1
2022-08-04T06:07:19Z
java
2022-09-20T01:30:27Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
List<String> tempFuncList = buildTempFuncSql(udfFuncParameters); funcList.addAll(tempFuncList); return funcList; } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildTempFuncSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> MessageFormat .format(CREATE_OR_REPLACE_FUNCTION_FORMAT, value.getFuncName(), value.getClassName())).collect(Collectors.toList()); } /** * b * @param udfFuncParameters udfFuncParameters * @return */ private List<String> buildJarSql(List<UdfFuncParameters> udfFuncParameters) { return udfFuncParameters.stream().map(value -> { String defaultFS = value.getDefaultFS(); String prefixPath = defaultFS.startsWith("file://") ? "file://" : defaultFS; String uploadPath = CommonUtils.getHdfsUdfDir(value.getTenantCode()); String resourceFullName = value.getResourceName(); resourceFullName = resourceFullName.startsWith("/") ? resourceFullName : String.format("/%s", resourceFullName); return String.format("add jar %s%s%s", prefixPath, uploadPath, resourceFullName); }).collect(Collectors.toList()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.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
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
* limitations under the License. */ package org.apache.dolphinscheduler.api.controller; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.utils.JSONUtils; import java.util.HashMap; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; /** * data source controller test */ public class DataSourceControllerTest extends AbstractControllerTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
private static final Logger logger = LoggerFactory.getLogger(DataSourceControllerTest.class); @BeforeEach public void initSetUp() { setUp(); } @AfterEach public void afterEach() throws Exception { after(); } @Ignore("unknown yourself connection information") @Test public void testCreateDataSource() throws Exception { HashMap<String, Object> paramsMap = new HashMap<>(); paramsMap.put("name","mysql"); paramsMap.put("node","mysql data source test"); paramsMap.put("type","mysql"); paramsMap.put("host","127.0.0.1"); paramsMap.put("port",3306); paramsMap.put("database","mysql"); paramsMap.put("userName","root"); paramsMap.put("password","123456"); paramsMap.put("other",new HashMap<>()); MvcResult mvcResult = mockMvc.perform(post("/datasources") .header("sessionId", sessionId) .contentType(MediaType.APPLICATION_JSON) .content(JSONUtils.toJsonString(paramsMap))) .andExpect(status().isCreated())
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
.andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Ignore("unknown yourself connection information") @Test public void testUpdateDataSource() throws Exception { HashMap<String, Object> paramsMap = new HashMap<>(); paramsMap.put("id",2); paramsMap.put("name","mysql"); paramsMap.put("node","mysql data source test"); paramsMap.put("type","mysql"); paramsMap.put("host","192.168.xxxx.xx"); paramsMap.put("port",3306); paramsMap.put("principal",""); paramsMap.put("database","dolphinscheduler"); paramsMap.put("userName","root"); paramsMap.put("password","root@123"); paramsMap.put("other",new HashMap<>()); MvcResult mvcResult = mockMvc.perform(put("/datasources/2") .header("sessionId", sessionId) .content(JSONUtils.toJsonString(paramsMap))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
} @Ignore("unknown you datasources id") @Test public void testQueryDataSource() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/datasources/2") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @ParameterizedTest @CsvSource({ "type, MYSQL" }) public void testQueryDataSourceList(String key, String dbType) throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add(key,dbType); MvcResult mvcResult = mockMvc.perform(get("/datasources/list") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
@Test public void testQueryDataSourceListPaging() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("searchVal","mysql"); paramsMap.add("pageNo","1"); paramsMap.add("pageSize","1"); MvcResult mvcResult = mockMvc.perform(get("/datasources") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Ignore("unknown yourself connection information") @Test public void testConnectDataSource() throws Exception { HashMap<String, Object> paramsMap = new HashMap<>(); paramsMap.put("name","mysql data source"); paramsMap.put("type","mysql"); paramsMap.put("host","127.0.0.1"); paramsMap.put("port",3306); paramsMap.put("database","mysql"); paramsMap.put("userName","root"); paramsMap.put("password","123456"); paramsMap.put("other",null); MvcResult mvcResult = mockMvc.perform(post("/datasources/connect") .header("sessionId", sessionId)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
.content(JSONUtils.toJsonString(paramsMap))) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Ignore("unknown your datasource id") @Test public void testConnectionTest() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/datasources/2/connect-test") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @ParameterizedTest @CsvSource({ "name, sourceName" }) public void testVerifyDataSourceName(String key, String dbType) throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add(key,dbType); MvcResult mvcResult = mockMvc.perform(get("/datasources/verify-name") .header("sessionId", sessionId) .params(paramsMap))
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
.andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testAuthedDatasource() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId","2"); MvcResult mvcResult = mockMvc.perform(get("/datasources/authed-datasource") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testUnauthDatasource() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("userId","2"); MvcResult mvcResult = mockMvc.perform(get("/datasources/unauth-datasource") .header("sessionId", sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON))
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,061
[Improvement][UT] Improvement Query dataSource UT
### 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 After pulling the latest code, ut failed to query the data source. ### Are you willing to submit a PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12061
https://github.com/apache/dolphinscheduler/pull/12062
649015bfff69e3922fb9b1059784b3ea2e70eb69
955e8ebe0f2389d6bc44dcbc12e02c1b307690c4
2022-09-20T06:01:01Z
java
2022-09-20T07:46:29Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/DataSourceControllerTest.java
.andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Test public void testGetKerberosStartupState() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/datasources/kerberos-startup-state") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } @Ignore("unknown your datasource id") @Test public void testDelete() throws Exception { MvcResult mvcResult = mockMvc.perform(delete("/datasources/2") .header("sessionId", sessionId)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(),result.getCode().intValue()); logger.info(mvcResult.getResponse().getContentAsString()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.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
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java
* (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.alert; import junit.framework.TestCase; import org.apache.dolphinscheduler.dao.AlertDao; import org.apache.dolphinscheduler.dao.PluginDao; import org.apache.dolphinscheduler.dao.entity.Alert; import org.apache.dolphinscheduler.remote.NettyRemotingServer; import org.apache.dolphinscheduler.remote.config.NettyServerConfig; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.mockito.junit.MockitoJUnitRunner; import org.powermock.reflect.Whitebox; import java.util.ArrayList; import java.util.List; @RunWith(MockitoJUnitRunner.class)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-alert/dolphinscheduler-alert-server/src/test/java/org/apache/dolphinscheduler/alert/AlertServerTest.java
public class AlertServerTest extends TestCase { @InjectMocks private AlertServer alertServer; @Mock private PluginDao pluginDao; @Mock private AlertConfig alertConfig; @Mock private AlertSenderService alertSenderService; @Test public void testStart() { Mockito.when(pluginDao.checkPluginDefineTableExist()).thenReturn(true); Mockito.when(alertConfig.getPort()).thenReturn(50052); Mockito.doNothing().when(alertSenderService).start(); alertServer.run(null); NettyRemotingServer nettyRemotingServer = Whitebox.getInternalState(alertServer, "nettyRemotingServer"); NettyServerConfig nettyServerConfig = Whitebox.getInternalState(nettyRemotingServer, "serverConfig"); Assert.assertEquals(50052, nettyServerConfig.getListenPort()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TaskInstanceControllerTest.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 static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyInt; import static org.mockito.ArgumentMatchers.anyLong; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.service.TaskInstanceService;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TaskInstanceControllerTest.java
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.TaskExecuteType; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.dao.entity.TaskInstance; import org.apache.dolphinscheduler.dao.entity.User; import java.util.HashMap; import java.util.Map; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskExecutionStatus; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; public class TaskInstanceControllerTest extends AbstractControllerTest { @InjectMocks private TaskInstanceController taskInstanceController; @Mock private TaskInstanceService taskInstanceService; @Test public void testQueryTaskListPaging() { Result result = new Result(); Integer pageNo = 1; Integer pageSize = 20;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
10,976
[Improvement][UT] Upgrade junit to 5.+
### 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 Right now, we still use junit 4.+ in our repo, I hope we can upgrade to [Junit 5.+](https://junit.org/junit5/docs/current/user-guide/#writing-tests), then we can easy to write the UT, JUnit 5 provide some useful feature, e.g. `assertThrow`, `assertTimeout `... ### 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/10976
https://github.com/apache/dolphinscheduler/pull/11332
7d80ea34ac0dd60dcae3e7f37c7ce659b56cdce9
b52da64001da3a4458510228d267e6c4abd84252
2022-07-14T10:29:29Z
java
2022-09-21T02:15:21Z
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/controller/TaskInstanceControllerTest.java
PageInfo pageInfo = new PageInfo<TaskInstance>(pageNo, pageSize); result.setData(pageInfo); result.setCode(Status.SUCCESS.getCode()); result.setMsg(Status.SUCCESS.getMsg()); when(taskInstanceService.queryTaskListPaging(any(), eq(1L), eq(1), eq(""), eq(""), eq(""), eq(""), any(), any(), eq(""), Mockito.any(), eq("192.168.xx.xx"), eq(TaskExecuteType.BATCH), any(), any())).thenReturn(result); Result taskResult = taskInstanceController.queryTaskListPaging(null, 1L, 1, "", "", "", "", "", TaskExecutionStatus.SUCCESS, "192.168.xx.xx", "2020-01-01 00:00:00", "2020-01-02 00:00:00", TaskExecuteType.BATCH, pageNo, pageSize); Assert.assertEquals(Integer.valueOf(Status.SUCCESS.getCode()), taskResult.getCode()); } @Ignore @Test public void testForceTaskSuccess() throws Exception { MultiValueMap<String, String> paramsMap = new LinkedMultiValueMap<>(); paramsMap.add("taskInstanceId", "104"); Map<String, Object> mockResult = new HashMap<>(5); mockResult.put(Constants.STATUS, Status.SUCCESS); mockResult.put(Constants.MSG, Status.SUCCESS.getMsg()); when(taskInstanceService.forceTaskSuccess(any(User.class), anyLong(), anyInt())).thenReturn(mockResult); MvcResult mvcResult = mockMvc.perform(post("/projects/{projectName}/task-instance/force-success", "cxc_1113") .header(SESSION_ID, sessionId) .params(paramsMap)) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andReturn(); Result result = JSONUtils.parseObject(mvcResult.getResponse().getContentAsString(), Result.class); Assert.assertEquals(Status.SUCCESS.getCode(), result.getCode().intValue()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.plugin.task.sql; import com.fasterxml.jackson.databind.node.ArrayNode; import com.fasterxml.jackson.databind.node.ObjectNode; import org.apache.commons.collections4.CollectionUtils; import org.apache.dolphinscheduler.plugin.datasource.api.plugin.DataSourceClientProvider; import org.apache.dolphinscheduler.plugin.datasource.api.utils.CommonUtils; import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils; import org.apache.dolphinscheduler.plugin.task.api.*; import org.apache.dolphinscheduler.plugin.task.api.enums.Direct;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
import org.apache.dolphinscheduler.plugin.task.api.enums.SqlType; import org.apache.dolphinscheduler.plugin.task.api.enums.TaskTimeoutStrategy; import org.apache.dolphinscheduler.plugin.task.api.model.Property; import org.apache.dolphinscheduler.plugin.task.api.model.TaskAlertInfo; import org.apache.dolphinscheduler.plugin.task.api.parameters.AbstractParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.SqlParameters; import org.apache.dolphinscheduler.plugin.task.api.parameters.resource.UdfFuncParameters; 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; import org.apache.dolphinscheduler.spi.enums.DbType; import org.apache.dolphinscheduler.spi.utils.JSONUtils; import org.apache.dolphinscheduler.spi.utils.StringUtils; import org.slf4j.Logger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.sql.Statement; import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Optional; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; public class SqlTask extends AbstractTask {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
/** * taskExecutionContext */ private TaskExecutionContext taskExecutionContext; /** * sql parameters */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
private SqlParameters sqlParameters; /** * base datasource */ private BaseConnectionParam baseConnectionParam; /** * create function format * include replace here which can be compatible with more cases, for example a long-running Spark session in Kyuubi will keep its own temp functions instead of destroying them right away */ private static final String CREATE_OR_REPLACE_FUNCTION_FORMAT = "create or replace temporary function {0} as ''{1}''"; /** * default query sql limit */ private static final int QUERY_LIMIT = 10000; private SQLTaskExecutionContext sqlTaskExecutionContext; public static final int TEST_FLAG_YES = 1; /** * Abstract Yarn Task * * @param taskRequest taskRequest */ public SqlTask(TaskExecutionContext taskRequest) { super(taskRequest); this.taskExecutionContext = taskRequest; this.sqlParameters = JSONUtils.parseObject(taskExecutionContext.getTaskParams(), SqlParameters.class); assert sqlParameters != null; if (taskExecutionContext.getTestFlag() == TEST_FLAG_YES && this.sqlParameters.getDatasource() == 0) { throw new RuntimeException("unbound test data source"); } if (!sqlParameters.checkParameters()) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
throw new RuntimeException("sql task params is not valid"); } sqlTaskExecutionContext = sqlParameters.generateExtendedContext(taskExecutionContext.getResourceParametersHelper()); } @Override public AbstractParameters getParameters() { return sqlParameters; } @Override public void handle(TaskCallBack taskCallBack) throws TaskException { logger.info("Full sql parameters: {}", sqlParameters); logger.info("sql type : {}, datasource : {}, sql : {} , localParams : {},udfs : {},showType : {},connParams : {},varPool : {} ,query max result limit {}", sqlParameters.getType(), sqlParameters.getDatasource(), sqlParameters.getSql(), sqlParameters.getLocalParams(), sqlParameters.getUdfs(), sqlParameters.getShowType(), sqlParameters.getConnParams(), sqlParameters.getVarPool(), sqlParameters.getLimit()); try { baseConnectionParam = (BaseConnectionParam) DataSourceUtils.buildConnectionParams( DbType.valueOf(sqlParameters.getType()), sqlTaskExecutionContext.getConnectionParams()); List<SqlBinds> mainStatementSqlBinds = SqlSplitter.split(sqlParameters.getSql(), sqlParameters.getSegmentSeparator()) .stream() .map(this::getSqlAndSqlParamsMap)
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
.collect(Collectors.toList()); List<SqlBinds> preStatementSqlBinds = Optional.ofNullable(sqlParameters.getPreStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<SqlBinds> postStatementSqlBinds = Optional.ofNullable(sqlParameters.getPostStatements()) .orElse(new ArrayList<>()) .stream() .map(this::getSqlAndSqlParamsMap) .collect(Collectors.toList()); List<String> createFuncs = createFuncs(sqlTaskExecutionContext.getUdfFuncParametersList(), logger); executeFuncAndSql(mainStatementSqlBinds, preStatementSqlBinds, postStatementSqlBinds, createFuncs); setExitStatusCode(TaskConstants.EXIT_CODE_SUCCESS); } catch (Exception e) { setExitStatusCode(TaskConstants.EXIT_CODE_FAILURE); logger.error("sql task error", e); throw new TaskException("Execute sql task failed", e); } } @Override public void cancel() throws TaskException { } /** * execute function and sql * * @param mainStatementsBinds main statements binds * @param preStatementsBinds pre statements binds * @param postStatementsBinds post statements binds
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
* @param createFuncs create functions */ public void executeFuncAndSql(List<SqlBinds> mainStatementsBinds, List<SqlBinds> preStatementsBinds, List<SqlBinds> postStatementsBinds, List<String> createFuncs) throws Exception { Connection connection = null; try { connection = DataSourceClientProvider.getInstance().getConnection(DbType.valueOf(sqlParameters.getType()), baseConnectionParam); if (CollectionUtils.isNotEmpty(createFuncs)) { createTempFunction(connection, createFuncs); } executeUpdate(connection, preStatementsBinds, "pre"); String result = null; if (sqlParameters.getSqlType() == SqlType.QUERY.ordinal()) { result = executeQuery(connection, mainStatementsBinds.get(0), "main"); } else if (sqlParameters.getSqlType() == SqlType.NON_QUERY.ordinal()) { String updateResult = executeUpdate(connection, mainStatementsBinds, "main"); result = setNonQuerySqlReturn(updateResult, sqlParameters.getLocalParams()); } sqlParameters.dealOutParam(result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
executeUpdate(connection, postStatementsBinds, "post"); } catch (Exception e) { logger.error("execute sql error: {}", e.getMessage()); throw e; } finally { close(connection); } } private String setNonQuerySqlReturn(String updateResult, List<Property> properties) { String result = null; for (Property info : properties) { if (Direct.OUT == info.getDirect()) { List<Map<String, String>> updateRL = new ArrayList<>(); Map<String, String> updateRM = new HashMap<>(); updateRM.put(info.getProp(), updateResult); updateRL.add(updateRM); result = JSONUtils.toJsonString(updateRL); break; } } return result; } /** * result process * * @param resultSet resultSet * @throws Exception Exception */ private String resultProcess(ResultSet resultSet) throws Exception { ArrayNode resultJSONArray = JSONUtils.createArrayNode();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
if (resultSet != null) { ResultSetMetaData md = resultSet.getMetaData(); int num = md.getColumnCount(); int rowCount = 0; int limit = sqlParameters.getLimit() == 0 ? QUERY_LIMIT : sqlParameters.getLimit(); while (resultSet.next()) { if (rowCount == limit) { logger.info("sql result limit : {} exceeding results are filtered", limit); break; } ObjectNode mapOfColValues = JSONUtils.createObjectNode(); for (int i = 1; i <= num; i++) { mapOfColValues.set(md.getColumnLabel(i), JSONUtils.toJsonNode(resultSet.getObject(i))); } resultJSONArray.add(mapOfColValues); rowCount++; } int displayRows = sqlParameters.getDisplayRows() > 0 ? sqlParameters.getDisplayRows() : TaskConstants.DEFAULT_DISPLAY_ROWS; displayRows = Math.min(displayRows, rowCount); logger.info("display sql result {} rows as follows:", displayRows); for (int i = 0; i < displayRows; i++) { String row = JSONUtils.toJsonString(resultJSONArray.get(i)); logger.info("row {} : {}", i + 1, row); } } String result = JSONUtils.toJsonString(resultJSONArray); if (sqlParameters.getSendEmail() == null || sqlParameters.getSendEmail()) { sendAttachment(sqlParameters.getGroupId(), StringUtils.isNotEmpty(sqlParameters.getTitle()) ? sqlParameters.getTitle() : taskExecutionContext.getTaskName() + " query result sets", result);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} logger.debug("execute sql result : {}", result); return result; } /** * send alert as an attachment * * @param title title * @param content content */ private void sendAttachment(int groupId, String title, String content) { setNeedAlert(Boolean.TRUE); TaskAlertInfo taskAlertInfo = new TaskAlertInfo(); taskAlertInfo.setAlertGroupId(groupId); taskAlertInfo.setContent(content); taskAlertInfo.setTitle(title); setTaskAlertInfo(taskAlertInfo); } private String executeQuery(Connection connection, SqlBinds sqlBinds, String handlerType) throws Exception { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBinds)) { ResultSet resultSet = statement.executeQuery(); return resultProcess(resultSet); } } private String executeUpdate(Connection connection, List<SqlBinds> statementsBinds, String handlerType) throws Exception { int result = 0; for (SqlBinds sqlBind : statementsBinds) { try (PreparedStatement statement = prepareStatementAndBind(connection, sqlBind)) { result = statement.executeUpdate(); logger.info("{} statement execute update result: {}, for sql: {}", handlerType, result, sqlBind.getSql());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} } return String.valueOf(result); } /** * create temp function * * @param connection connection * @param createFuncs createFuncs */ private void createTempFunction(Connection connection, List<String> createFuncs) throws Exception { try (Statement funcStmt = connection.createStatement()) { for (String createFunc : createFuncs) { logger.info("hive create function sql: {}", createFunc); funcStmt.execute(createFunc); } } } /** * close jdbc resource * * @param connection connection */ private void close(Connection connection) { if (connection != null) { try { connection.close(); } catch (SQLException e) { logger.error("close connection error : {}", e.getMessage(), e);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
} } } /** * preparedStatement bind * * @param connection connection * @param sqlBinds sqlBinds * @return PreparedStatement * @throws Exception Exception */ private PreparedStatement prepareStatementAndBind(Connection connection, SqlBinds sqlBinds) { boolean timeoutFlag = taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.FAILED || taskExecutionContext.getTaskTimeoutStrategy() == TaskTimeoutStrategy.WARNFAILED; try { PreparedStatement stmt = connection.prepareStatement(sqlBinds.getSql()); if (timeoutFlag) { stmt.setQueryTimeout(taskExecutionContext.getTaskTimeout()); } Map<Integer, Property> params = sqlBinds.getParamsMap(); if (params != null) { for (Map.Entry<Integer, Property> entry : params.entrySet()) { Property prop = entry.getValue(); ParameterUtils.setInParameter(entry.getKey(), stmt, prop.getType(), prop.getValue()); } } logger.info("prepare statement replace sql : {}, sql parameters : {}", sqlBinds.getSql(), sqlBinds.getParamsMap()); return stmt; } catch (Exception exception) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
throw new TaskException("SQL task prepareStatementAndBind error", exception); } } /** * p * * @param content content * @param formatSql format sql * @param rgex rgex * @param sqlParamsMap sql params map */ private void printReplacedSql(String content, String formatSql, String rgex, Map<Integer, Property> sqlParamsMap) { logger.info("after replace sql , preparing : {}", formatSql); StringBuilder logPrint = new StringBuilder("replaced sql , parameters:"); if (sqlParamsMap == null) { logger.info("printReplacedSql: sqlParamsMap is null."); } else { for (int i = 1; i <= sqlParamsMap.size(); i++) { logPrint.append(sqlParamsMap.get(i).getValue()).append("(").append(sqlParamsMap.get(i).getType()).append(")"); } } logger.info("Sql Params are {}", logPrint); } /** * ready to execute SQL and parameter entity Map * * @return SqlBinds */ private SqlBinds getSqlAndSqlParamsMap(String sql) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
12,057
[Bug] [task-plugin] When the sql query result is empty, the email fails to send the attachment, and an exception will be reported
### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dolphinscheduler/issues?q=is%3Aissue) and found no similar issues. ### What happened when the sql query result is empty, dolphinscheduler-alert.log screenshot is as follows: <img width="1365" alt="image" src="https://user-images.githubusercontent.com/35831367/191156893-f3d9e8c0-317b-4152-93a0-dcef8618dfeb.png"> Email can't be sent <img width="1362" alt="image" src="https://user-images.githubusercontent.com/35831367/191157074-be76e4ea-091b-4cb1-a2f0-2233b386f028.png"> ### What you expected to happen I think we should send an empty attachment and write the table structure and empty results of the query to the attachment such as <img width="424" alt="image" src="https://user-images.githubusercontent.com/35831367/191159120-ddcbc239-7a41-4a95-b8aa-f9dc26a1b6d6.png"> ### How to reproduce .. ### Anything else _No response_ ### Version 3.0.0 ### Are you willing to submit PR? - [X] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
https://github.com/apache/dolphinscheduler/issues/12057
https://github.com/apache/dolphinscheduler/pull/12059
08a4c7981fcfdbdf2f363bc0b790d92077c94441
9b3b4e22b42eb976a997f36310a26629142a5315
2022-09-20T03:12:23Z
java
2022-09-22T01:39:02Z
dolphinscheduler-task-plugin/dolphinscheduler-task-sql/src/main/java/org/apache/dolphinscheduler/plugin/task/sql/SqlTask.java
Map<Integer, Property> sqlParamsMap = new HashMap<>(); StringBuilder sqlBuilder = new StringBuilder(); Map<String, Property> paramsMap = taskExecutionContext.getPrepareParamsMap(); if (paramsMap == null) { sqlBuilder.append(sql); return new SqlBinds(sqlBuilder.toString(), sqlParamsMap); } if (StringUtils.isNotEmpty(sqlParameters.getTitle())) { String title = ParameterUtils.convertParameterPlaceholders(sqlParameters.getTitle(), ParamUtils.convert(paramsMap)); logger.info("SQL title : {}", title); sqlParameters.setTitle(title); } sql = ParameterUtils.replaceScheduleTime(sql, taskExecutionContext.getScheduleTime()); setSqlParamsMap(sql, rgex, sqlParamsMap, paramsMap,taskExecutionContext.getTaskInstanceId()); String rgexo = "['\"]*\\!\\{(.*?)\\}['\"]*"; sql = replaceOriginalValue(sql, rgexo, paramsMap); // r String formatSql = sql.replaceAll(rgex, "?"); // C formatSql = ParameterUtils.expandListParameter(sqlParamsMap, formatSql); sqlBuilder.append(formatSql); // p printReplacedSql(sql, formatSql, rgex, sqlParamsMap);