status
stringclasses
1 value
repo_name
stringclasses
31 values
repo_url
stringclasses
31 values
issue_id
int64
1
104k
title
stringlengths
4
233
body
stringlengths
0
186k
issue_url
stringlengths
38
56
pull_url
stringlengths
37
54
before_fix_sha
stringlengths
40
40
after_fix_sha
stringlengths
40
40
report_datetime
unknown
language
stringclasses
5 values
commit_datetime
unknown
updated_file
stringlengths
7
188
chunk_content
stringlengths
1
1.03M
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
logger.error("sub process command params error, cannot find parent instance: {} ", cmdParam); } } ProcessInstanceMap processInstanceMap = JSONUtils.parseObject(cmdParam, ProcessInstanceMap.class); if (processInstanceMap == null || processInstanceMap.getParentProcessInstanceId() == 0) { return subProcessInstance; } processInstanceMap.setProcessInstanceId(subProcessInstance.getId()); this.updateWorkProcessInstanceMap(processInstanceMap); return subProcessInstance; } /** * join parent global params into sub process. * only the keys doesn't in sub process global would be joined. * * @param parentGlobalParams parentGlobalParams * @param subGlobalParams subGlobalParams * @return global params join */ private String joinGlobalParams(String parentGlobalParams, String subGlobalParams) { List<Property> parentPropertyList = JSONUtils.toList(parentGlobalParams, Property.class); List<Property> subPropertyList = JSONUtils.toList(subGlobalParams, Property.class); Map<String, String> subMap = subPropertyList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); for (Property parent : parentPropertyList) { if (!subMap.containsKey(parent.getProp())) { subPropertyList.add(parent); } } return JSONUtils.toJsonString(subPropertyList);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} /** * initialize task instance * * @param taskInstance taskInstance */ private void initTaskInstance(TaskInstance taskInstance) { if (!taskInstance.isSubProcess() && (taskInstance.getState().typeIsCancel() || taskInstance.getState().typeIsFailure())) { taskInstance.setFlag(Flag.NO); updateTaskInstance(taskInstance); return; } taskInstance.setState(ExecutionStatus.SUBMITTED_SUCCESS); updateTaskInstance(taskInstance); } /** * submit task to db * submit sub process to command * * @param taskInstance taskInstance * @return task instance */ @Transactional(rollbackFor = Exception.class) public TaskInstance submitTask(TaskInstance taskInstance) { ProcessInstance processInstance = this.findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); logger.info("start submit task : {}, instance id:{}, state: {}", taskInstance.getName(), taskInstance.getProcessInstanceId(), processInstance.getState()); TaskInstance task = submitTaskInstanceToDB(taskInstance, processInstance);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
if (task == null) { logger.error("end submit task to db error, task name:{}, process id:{} state: {} ", taskInstance.getName(), taskInstance.getProcessInstance(), processInstance.getState()); return task; } if (!task.getState().typeIsFinished()) { createSubWorkProcess(processInstance, task); } logger.info("end submit task to db successfully:{} state:{} complete, instance id:{} state: {} ", taskInstance.getName(), task.getState(), processInstance.getId(), processInstance.getState()); return task; } /** * set work process instance map * consider o * repeat running does not generate new sub process instance * set map {parent instance id, task instance id, 0(child instance id)} * * @param parentInstance parentInstance * @param parentTask parentTask * @return process instance map */ private ProcessInstanceMap setProcessInstanceMap(ProcessInstance parentInstance, TaskInstance parentTask) { ProcessInstanceMap processMap = findWorkProcessMapByParent(parentInstance.getId(), parentTask.getId()); if (processMap != null) { return processMap; } if (parentInstance.getCommandType() == CommandType.REPEAT_RUNNING) { processMap = findPreviousTaskProcessMap(parentInstance, parentTask);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
if (processMap != null) { processMap.setParentTaskInstanceId(parentTask.getId()); updateWorkProcessInstanceMap(processMap); return processMap; } } processMap = new ProcessInstanceMap(); processMap.setParentProcessInstanceId(parentInstance.getId()); processMap.setParentTaskInstanceId(parentTask.getId()); createWorkProcessInstanceMap(processMap); return processMap; } /** * find previous task work process map. * * @param parentProcessInstance parentProcessInstance * @param parentTask parentTask * @return process instance map */ private ProcessInstanceMap findPreviousTaskProcessMap(ProcessInstance parentProcessInstance, TaskInstance parentTask) { Integer preTaskId = 0; List<TaskInstance> preTaskList = this.findPreviousTaskListByWorkProcessId(parentProcessInstance.getId()); for (TaskInstance task : preTaskList) { if (task.getName().equals(parentTask.getName())) { preTaskId = task.getId(); ProcessInstanceMap map = findWorkProcessMapByParent(parentProcessInstance.getId(), preTaskId); if (map != null) { return map;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} } } logger.info("sub process instance is not found,parent task:{},parent instance:{}", parentTask.getId(), parentProcessInstance.getId()); return null; } /** * create sub work process command * * @param parentProcessInstance parentProcessInstance * @param task task */ public void createSubWorkProcess(ProcessInstance parentProcessInstance, TaskInstance task) { if (!task.isSubProcess()) { return; } ProcessInstanceMap instanceMap = findWorkProcessMapByParent(parentProcessInstance.getId(), task.getId()); if (null != instanceMap && CommandType.RECOVER_TOLERANCE_FAULT_PROCESS == parentProcessInstance.getCommandType()) { return; } instanceMap = setProcessInstanceMap(parentProcessInstance, task); ProcessInstance childInstance = null; if (instanceMap.getProcessInstanceId() != 0) { childInstance = findProcessInstanceById(instanceMap.getProcessInstanceId()); } Command subProcessCommand = createSubProcessCommand(parentProcessInstance, childInstance, instanceMap, task); updateSubProcessDefinitionByParent(parentProcessInstance, subProcessCommand.getProcessDefinitionId());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
initSubInstanceState(childInstance); createCommand(subProcessCommand); logger.info("sub process command created: {} ", subProcessCommand); } /** * complement data needs transform parent parameter to child. */ private String getSubWorkFlowParam(ProcessInstanceMap instanceMap, ProcessInstance parentProcessInstance) { String processMapStr = JSONUtils.toJsonString(instanceMap); Map<String, String> cmdParam = JSONUtils.toMap(processMapStr); if (parentProcessInstance.isComplementData()) { Map<String, String> parentParam = JSONUtils.toMap(parentProcessInstance.getCommandParam()); String endTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE); String startTime = parentParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_END_DATE, endTime); cmdParam.put(CMDPARAM_COMPLEMENT_DATA_START_DATE, startTime); processMapStr = JSONUtils.toJsonString(cmdParam); } return processMapStr; } /** * create sub work process command */ public Command createSubProcessCommand(ProcessInstance parentProcessInstance, ProcessInstance childInstance, ProcessInstanceMap instanceMap, TaskInstance task) { CommandType commandType = getSubCommandType(parentProcessInstance, childInstance); TaskNode taskNode = JSONUtils.parseObject(task.getTaskJson(), TaskNode.class);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
Map<String, String> subProcessParam = JSONUtils.toMap(taskNode.getParams()); Integer childDefineId = Integer.parseInt(subProcessParam.get(Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID)); String processParam = getSubWorkFlowParam(instanceMap, parentProcessInstance); return new Command( commandType, TaskDependType.TASK_POST, parentProcessInstance.getFailureStrategy(), parentProcessInstance.getExecutorId(), childDefineId, processParam, parentProcessInstance.getWarningType(), parentProcessInstance.getWarningGroupId(), parentProcessInstance.getScheduleTime(), task.getWorkerGroup(), parentProcessInstance.getProcessInstancePriority() ); } /** * initialize sub work flow state * child instance state would be initialized when 'recovery from pause/stop/failure' */ private void initSubInstanceState(ProcessInstance childInstance) { if (childInstance != null) { childInstance.setState(ExecutionStatus.RUNNING_EXECUTION); updateProcessInstance(childInstance); } } /** * get sub work flow command type * child instance exist: child command = fatherCommand
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* child instance not exists: child command = fatherCommand[0] */ private CommandType getSubCommandType(ProcessInstance parentProcessInstance, ProcessInstance childInstance) { CommandType commandType = parentProcessInstance.getCommandType(); if (childInstance == null) { String fatherHistoryCommand = parentProcessInstance.getHistoryCmd(); commandType = CommandType.valueOf(fatherHistoryCommand.split(Constants.COMMA)[0]); } return commandType; } /** * update sub process definition * * @param parentProcessInstance parentProcessInstance * @param childDefinitionId childDefinitionId */ private void updateSubProcessDefinitionByParent(ProcessInstance parentProcessInstance, int childDefinitionId) { ProcessDefinition fatherDefinition = this.findProcessDefineById(parentProcessInstance.getProcessDefinitionId()); ProcessDefinition childDefinition = this.findProcessDefineById(childDefinitionId); if (childDefinition != null && fatherDefinition != null) { childDefinition.setWarningGroupId(fatherDefinition.getWarningGroupId()); processDefineMapper.updateById(childDefinition); } } /** * submit task to mysql * * @param taskInstance taskInstance * @param processInstance processInstance * @return task instance
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
*/ public TaskInstance submitTaskInstanceToDB(TaskInstance taskInstance, ProcessInstance processInstance) { ExecutionStatus processInstanceState = processInstance.getState(); if (taskInstance.getState().typeIsFailure()) { if (taskInstance.isSubProcess()) { taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1); } else { if (processInstanceState != ExecutionStatus.READY_STOP && processInstanceState != ExecutionStatus.READY_PAUSE) { taskInstance.setFlag(Flag.NO); updateTaskInstance(taskInstance); if (taskInstance.getState() != ExecutionStatus.NEED_FAULT_TOLERANCE) { taskInstance.setRetryTimes(taskInstance.getRetryTimes() + 1); } taskInstance.setSubmitTime(null); taskInstance.setStartTime(null); taskInstance.setEndTime(null); taskInstance.setFlag(Flag.YES); taskInstance.setHost(null); taskInstance.setId(0); } } } taskInstance.setExecutorId(processInstance.getExecutorId()); taskInstance.setProcessInstancePriority(processInstance.getProcessInstancePriority()); taskInstance.setState(getSubmitTaskState(taskInstance, processInstanceState)); if (taskInstance.getSubmitTime() == null) { taskInstance.setSubmitTime(new Date());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} if (taskInstance.getFirstSubmitTime() == null) { taskInstance.setFirstSubmitTime(taskInstance.getSubmitTime()); } boolean saveResult = saveTaskInstance(taskInstance); if (!saveResult) { return null; } return taskInstance; } /** * get submit task instance state by the work process state * cannot modify the task state when running/kill/submit success, or this * task instance is already exists in task queue . * return pause if work process state is ready pause * return stop if work process state is ready stop * if all of above are not satisfied, return submit success * * @param taskInstance taskInstance * @param processInstanceState processInstanceState * @return process instance state */ public ExecutionStatus getSubmitTaskState(TaskInstance taskInstance, ExecutionStatus processInstanceState) { ExecutionStatus state = taskInstance.getState(); if ( state == ExecutionStatus.RUNNING_EXECUTION || state == ExecutionStatus.DELAY_EXECUTION
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
|| state == ExecutionStatus.KILL ) { return state; } if (processInstanceState == ExecutionStatus.READY_PAUSE) { state = ExecutionStatus.PAUSE; } else if (processInstanceState == ExecutionStatus.READY_STOP || !checkProcessStrategy(taskInstance)) { state = ExecutionStatus.KILL; } else { state = ExecutionStatus.SUBMITTED_SUCCESS; } return state; } /** * check process instance strategy * * @param taskInstance taskInstance * @return check strategy result */ private boolean checkProcessStrategy(TaskInstance taskInstance) { ProcessInstance processInstance = this.findProcessInstanceById(taskInstance.getProcessInstanceId()); FailureStrategy failureStrategy = processInstance.getFailureStrategy(); if (failureStrategy == FailureStrategy.CONTINUE) { return true; } List<TaskInstance> taskInstances = this.findValidTaskListByProcessId(taskInstance.getProcessInstanceId()); for (TaskInstance task : taskInstances) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
if (task.getState() == ExecutionStatus.FAILURE) { return false; } } return true; } /** * create a new process instance * * @param processInstance processInstance */ public void createProcessInstance(ProcessInstance processInstance) { if (processInstance != null) { processInstanceMapper.insert(processInstance); } } /** * insert or update work process instance to data base * * @param processInstance processInstance */ public void saveProcessInstance(ProcessInstance processInstance) { if (processInstance == null) { logger.error("save error, process instance is null!"); return; } if (processInstance.getId() != 0) { processInstanceMapper.updateById(processInstance); } else { createProcessInstance(processInstance);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} } /** * insert or update command * * @param command command * @return save command result */ public int saveCommand(Command command) { if (command.getId() != 0) { return commandMapper.updateById(command); } else { return commandMapper.insert(command); } } /** * insert or update task instance * * @param taskInstance taskInstance * @return save task instance result */ public boolean saveTaskInstance(TaskInstance taskInstance) { if (taskInstance.getId() != 0) { return updateTaskInstance(taskInstance); } else { return createTaskInstance(taskInstance); } } /** * insert task instance
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* * @param taskInstance taskInstance * @return create task instance result */ public boolean createTaskInstance(TaskInstance taskInstance) { int count = taskInstanceMapper.insert(taskInstance); return count > 0; } /** * update task instance * * @param taskInstance taskInstance * @return update task instance result */ public boolean updateTaskInstance(TaskInstance taskInstance) { int count = taskInstanceMapper.updateById(taskInstance); return count > 0; } /** * delete a command by id * * @param id id */ public void delCommandById(int id) { commandMapper.deleteById(id); } /** * find task instance by id * * @param taskId task id
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* @return task intance */ public TaskInstance findTaskInstanceById(Integer taskId) { return taskInstanceMapper.selectById(taskId); } /** * package task instance,associate processInstance and processDefine * * @param taskInstId taskInstId * @return task instance */ public TaskInstance getTaskInstanceDetailByTaskId(int taskInstId) { // TaskInstance taskInstance = findTaskInstanceById(taskInstId); if (taskInstance == null) { return taskInstance; } // ProcessInstance processInstance = findProcessInstanceDetailById(taskInstance.getProcessInstanceId()); // ProcessDefinition processDefine = findProcessDefineById(taskInstance.getProcessDefinitionId()); taskInstance.setProcessInstance(processInstance); taskInstance.setProcessDefine(processDefine); return taskInstance; } /** * get id list by task state * * @param instanceId instanceId * @param state state
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* @return task instance states */ public List<Integer> findTaskIdByInstanceState(int instanceId, ExecutionStatus state) { return taskInstanceMapper.queryTaskByProcessIdAndState(instanceId, state.ordinal()); } /** * find valid task list by process definition id * * @param processInstanceId processInstanceId * @return task instance list */ public List<TaskInstance> findValidTaskListByProcessId(Integer processInstanceId) { return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.YES); } /** * find previous task list by work process id * * @param processInstanceId processInstanceId * @return task instance list */ public List<TaskInstance> findPreviousTaskListByWorkProcessId(Integer processInstanceId) { return taskInstanceMapper.findValidTaskListByProcessId(processInstanceId, Flag.NO); } /** * update work process instance map * * @param processInstanceMap processInstanceMap * @return update process instance result */ public int updateWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return processInstanceMapMapper.updateById(processInstanceMap); } /** * create work process instance map * * @param processInstanceMap processInstanceMap * @return create process instance result */ public int createWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap) { int count = 0; if (processInstanceMap != null) { return processInstanceMapMapper.insert(processInstanceMap); } return count; } /** * find work process map by parent process id and parent task id. * * @param parentWorkProcessId parentWorkProcessId * @param parentTaskId parentTaskId * @return process instance map */ public ProcessInstanceMap findWorkProcessMapByParent(Integer parentWorkProcessId, Integer parentTaskId) { return processInstanceMapMapper.queryByParentId(parentWorkProcessId, parentTaskId); } /** * delete work process map by parent process id * * @param parentWorkProcessId parentWorkProcessId * @return delete process map result
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
*/ public int deleteWorkProcessMapByParentId(int parentWorkProcessId) { return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId); } /** * find sub process instance * * @param parentProcessId parentProcessId * @param parentTaskId parentTaskId * @return process instance */ public ProcessInstance findSubProcessInstance(Integer parentProcessId, Integer parentTaskId) { ProcessInstance processInstance = null; ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryByParentId(parentProcessId, parentTaskId); if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) { return processInstance; } processInstance = findProcessInstanceById(processInstanceMap.getProcessInstanceId()); return processInstance; } /** * find parent process instance * * @param subProcessId subProcessId * @return process instance */ public ProcessInstance findParentProcessInstance(Integer subProcessId) { ProcessInstance processInstance = null; ProcessInstanceMap processInstanceMap = processInstanceMapMapper.queryBySubProcessId(subProcessId); if (processInstanceMap == null || processInstanceMap.getProcessInstanceId() == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return processInstance; } processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId()); return processInstance; } /** * change task state * * @param state state * @param startTime startTime * @param host host * @param executePath executePath * @param logPath logPath * @param taskInstId taskInstId */ public void changeTaskState(TaskInstance taskInstance, ExecutionStatus state, Date startTime, String host, String executePath, String logPath, int taskInstId) { taskInstance.setState(state); taskInstance.setStartTime(startTime); taskInstance.setHost(host); taskInstance.setExecutePath(executePath); taskInstance.setLogPath(logPath); saveTaskInstance(taskInstance); } /** * update process instance * * @param processInstance processInstance
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* @return update process instance result */ public int updateProcessInstance(ProcessInstance processInstance) { return processInstanceMapper.updateById(processInstance); } /** * update the process instance * * @param processInstanceId processInstanceId * @param processJson processJson * @param globalParams globalParams * @param scheduleTime scheduleTime * @param flag flag * @param locations locations * @param connects connects * @return update process instance result */ public int updateProcessInstance(Integer processInstanceId, String processJson, String globalParams, Date scheduleTime, Flag flag, String locations, String connects) { ProcessInstance processInstance = processInstanceMapper.queryDetailById(processInstanceId); if (processInstance != null) { processInstance.setProcessInstanceJson(processJson); processInstance.setGlobalParams(globalParams); processInstance.setScheduleTime(scheduleTime); processInstance.setLocations(locations); processInstance.setConnects(connects); return processInstanceMapper.updateById(processInstance); } return 0;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} /** * change task state * * @param state state * @param endTime endTime * @param taskInstId taskInstId * @param varPool varPool */ public void changeTaskState(TaskInstance taskInstance, ExecutionStatus state, Date endTime, int processId, String appIds, int taskInstId, String varPool, String result) { taskInstance.setPid(processId); taskInstance.setAppLink(appIds); taskInstance.setState(state); taskInstance.setEndTime(endTime); taskInstance.setVarPool(varPool); changeOutParam(result, taskInstance); saveTaskInstance(taskInstance); } public void changeOutParam(String result, TaskInstance taskInstance) { if (StringUtils.isEmpty(result)) { return; } List<Map<String, String>> workerResultParam = getListMapByString(result); if (CollectionUtils.isEmpty(workerResultParam)) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return; } // Map<String, String> row = workerResultParam.get(0); if (row == null || row.size() == 0) { return; } TaskNode taskNode = JSONUtils.parseObject(taskInstance.getTaskJson(), TaskNode.class); Map<String, Object> taskParams = JSONUtils.toMap(taskNode.getParams(), String.class, Object.class); Object localParams = taskParams.get(LOCAL_PARAMS); if (localParams == null) { return; } ProcessInstance processInstance = this.processInstanceMapper.queryDetailById(taskInstance.getProcessInstanceId()); List<Property> params4Property = JSONUtils.toList(processInstance.getGlobalParams(), Property.class); Map<String, Property> allParamMap = params4Property.stream().collect(Collectors.toMap(Property::getProp, Property -> Property)); List<Property> allParam = JSONUtils.toList(JSONUtils.toJsonString(localParams), Property.class); for (Property info : allParam) { if (info.getDirect() == Direct.OUT) { String paramName = info.getProp(); Property property = allParamMap.get(paramName); if (property == null) { continue; } String value = row.get(paramName); if (StringUtils.isNotEmpty(value)) { property.setValue(value); info.setValue(value); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} taskParams.put(LOCAL_PARAMS, allParam); taskNode.setParams(JSONUtils.toJsonString(taskParams)); // taskInstance.setTaskJson(JSONUtils.toJsonString(taskNode)); String params4ProcessString = JSONUtils.toJsonString(params4Property); int updateCount = this.processInstanceMapper.updateGlobalParamsById(params4ProcessString, processInstance.getId()); logger.info("updateCount:{}, params4Process:{}, processInstanceId:{}", updateCount, params4ProcessString, processInstance.getId()); } public List<Map<String, String>> getListMapByString(String json) { List<Map<String, String>> allParams = new ArrayList<>(); ArrayNode paramsByJson = JSONUtils.parseArray(json); Iterator<JsonNode> listIterator = paramsByJson.iterator(); while (listIterator.hasNext()) { Map<String, String> param = JSONUtils.toMap(listIterator.next().toString(), String.class, String.class); allParams.add(param); } return allParams; } /** * convert integer list to string list * * @param intList intList * @return string list */ public List<String> convertIntListToString(List<Integer> intList) { if (intList == null) { return new ArrayList<>(); } List<String> result = new ArrayList<>(intList.size());
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
for (Integer intVar : intList) { result.add(String.valueOf(intVar)); } return result; } /** * query schedule by id * * @param id id * @return schedule */ public Schedule querySchedule(int id) { return scheduleMapper.selectById(id); } /** * query Schedule by processDefinitionId * * @param processDefinitionId processDefinitionId * @see Schedule */ public List<Schedule> queryReleaseSchedulerListByProcessDefinitionId(int processDefinitionId) { return scheduleMapper.queryReleaseSchedulerListByProcessDefinitionId(processDefinitionId); } /** * query need failover process instance * * @param host host * @return process instance list */ public List<ProcessInstance> queryNeedFailoverProcessInstances(String host) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return processInstanceMapper.queryByHostAndStatus(host, stateArray); } /** * process need failover process instance * * @param processInstance processInstance */ @Transactional(rollbackFor = RuntimeException.class) public void processNeedFailoverProcessInstances(ProcessInstance processInstance) { // processInstance.setHost(Constants.NULL); processInstanceMapper.updateById(processInstance); // Command cmd = new Command(); cmd.setProcessDefinitionId(processInstance.getProcessDefinitionId()); cmd.setCommandParam(String.format("{\"%s\":%d}", Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING, processInstance.getId())); cmd.setExecutorId(processInstance.getExecutorId()); cmd.setCommandType(CommandType.RECOVER_TOLERANCE_FAULT_PROCESS); createCommand(cmd); } /** * query all need failover task instances by host * * @param host host * @return task instance list */ public List<TaskInstance> queryNeedFailoverTaskInstances(String host) { return taskInstanceMapper.queryByHostAndStatus(host, stateArray); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
/** * find data source by id * * @param id id * @return datasource */ public DataSource findDataSourceById(int id) { return dataSourceMapper.selectById(id); } /** * update process instance state by id * * @param processInstanceId processInstanceId * @param executionStatus executionStatus * @return update process result */ public int updateProcessInstanceState(Integer processInstanceId, ExecutionStatus executionStatus) { ProcessInstance instance = processInstanceMapper.selectById(processInstanceId); instance.setState(executionStatus); return processInstanceMapper.updateById(instance); } /** * find process instance by the task id * * @param taskId taskId * @return process instance */ public ProcessInstance findProcessInstanceByTaskId(int taskId) { TaskInstance taskInstance = taskInstanceMapper.selectById(taskId); if (taskInstance != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId()); } return null; } /** * find udf function list by id list string * * @param ids ids * @return udf function list */ public List<UdfFunc> queryUdfFunListByIds(int[] ids) { return udfFuncMapper.queryUdfByIdStr(ids, null); } /** * find tenant code by resource name * * @param resName resource name * @param resourceType resource type * @return tenant code */ public String queryTenantCodeByResName(String resName, ResourceType resourceType) { // String fullName = resName.startsWith("/") ? resName : String.format("/%s", resName); return resourceMapper.queryTenantCodeByResourceName(fullName, resourceType.ordinal()); } /** * find schedule list by process define id. * * @param ids ids * @return schedule list
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
*/ public List<Schedule> selectAllByProcessDefineId(int[] ids) { return scheduleMapper.selectAllByProcessDefineArray( ids); } /** * get dependency cycle by work process define id and scheduler fire time * * @param masterId masterId * @param processDefinitionId processDefinitionId * @param scheduledFireTime the time the task schedule is expected to trigger * @return CycleDependency * @throws Exception if error throws Exception */ public CycleDependency getCycleDependency(int masterId, int processDefinitionId, Date scheduledFireTime) throws Exception { List<CycleDependency> list = getCycleDependencies(masterId, new int[]{processDefinitionId}, scheduledFireTime); return !list.isEmpty() ? list.get(0) : null; } /** * get dependency cycle list by work process define id list and scheduler fire time * * @param masterId masterId * @param ids ids * @param scheduledFireTime the time the task schedule is expected to trigger * @return CycleDependency list * @throws Exception if error throws Exception */ public List<CycleDependency> getCycleDependencies(int masterId, int[] ids, Date scheduledFireTime) throws Exception { List<CycleDependency> cycleDependencyList = new ArrayList<>(); if (null == ids || ids.length == 0) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
logger.warn("ids[] is empty!is invalid!"); return cycleDependencyList; } if (scheduledFireTime == null) { logger.warn("scheduledFireTime is null!is invalid!"); return cycleDependencyList; } String strCrontab = ""; CronExpression depCronExpression; Cron depCron; List<Date> list; List<Schedule> schedules = this.selectAllByProcessDefineId(ids); // for (Schedule depSchedule : schedules) { strCrontab = depSchedule.getCrontab(); depCronExpression = CronUtils.parse2CronExpression(strCrontab); depCron = CronUtils.parse2Cron(strCrontab); CycleEnum cycleEnum = CronUtils.getMiniCycle(depCron); if (cycleEnum == null) { logger.error("{} is not valid", strCrontab); continue; } Calendar calendar = Calendar.getInstance(); switch (cycleEnum) { case HOUR: calendar.add(Calendar.HOUR, -25); break; case DAY: case WEEK: calendar.add(Calendar.DATE, -32);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
break; case MONTH: calendar.add(Calendar.MONTH, -13); break; default: String cycleName = cycleEnum.name(); logger.warn("Dependent process definition's cycleEnum is {},not support!!", cycleName); continue; } Date start = calendar.getTime(); if (depSchedule.getProcessDefinitionId() == masterId) { list = CronUtils.getSelfFireDateList(start, scheduledFireTime, depCronExpression); } else { list = CronUtils.getFireDateList(start, scheduledFireTime, depCronExpression); } if (!list.isEmpty()) { start = list.get(list.size() - 1); CycleDependency dependency = new CycleDependency(depSchedule.getProcessDefinitionId(), start, CronUtils.getExpirationTime(start, cycleEnum), cycleEnum); cycleDependencyList.add(dependency); } } return cycleDependencyList; } /** * find last scheduler process instance in the date interval * * @param definitionId definitionId * @param dateInterval dateInterval * @return process instance */
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
public ProcessInstance findLastSchedulerProcessInterval(int definitionId, DateInterval dateInterval) { return processInstanceMapper.queryLastSchedulerProcess(definitionId, dateInterval.getStartTime(), dateInterval.getEndTime()); } /** * find last manual process instance interval * * @param definitionId process definition id * @param dateInterval dateInterval * @return process instance */ public ProcessInstance findLastManualProcessInterval(int definitionId, DateInterval dateInterval) { return processInstanceMapper.queryLastManualProcess(definitionId, dateInterval.getStartTime(), dateInterval.getEndTime()); } /** * find last running process instance * * @param definitionId process definition id * @param startTime start time * @param endTime end time * @return process instance */ public ProcessInstance findLastRunningProcess(int definitionId, Date startTime, Date endTime) { return processInstanceMapper.queryLastRunningProcess(definitionId, startTime, endTime, stateArray);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
} /** * query user queue by process instance id * * @param processInstanceId processInstanceId * @return queue */ public String queryUserQueueByProcessInstanceId(int processInstanceId) { String queue = ""; ProcessInstance processInstance = processInstanceMapper.selectById(processInstanceId); if (processInstance == null) { return queue; } User executor = userMapper.selectById(processInstance.getExecutorId()); if (executor != null) { queue = executor.getQueue(); } return queue; } /** * query project name and user name by processInstanceId. * * @param processInstanceId processInstanceId * @return projectName and userName */ public ProjectUser queryProjectWithUserByProcessInstanceId(int processInstanceId) { return projectMapper.queryProjectWithUserByProcessInstanceId(processInstanceId); } /** * get task worker group
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
* * @param taskInstance taskInstance * @return workerGroupId */ public String getTaskWorkerGroup(TaskInstance taskInstance) { String workerGroup = taskInstance.getWorkerGroup(); if (StringUtils.isNotBlank(workerGroup)) { return workerGroup; } int processInstanceId = taskInstance.getProcessInstanceId(); ProcessInstance processInstance = findProcessInstanceById(processInstanceId); if (processInstance != null) { return processInstance.getWorkerGroup(); } logger.info("task : {} will use default worker group", taskInstance.getId()); return Constants.DEFAULT_WORKER_GROUP; } /** * get have perm project list * * @param userId userId * @return project list */ public List<Project> getProjectListHavePerm(int userId) { List<Project> createProjects = projectMapper.queryProjectCreatedByUser(userId); List<Project> authedProjects = projectMapper.queryAuthedProjectListByUserId(userId); if (createProjects == null) { createProjects = new ArrayList<>(); } if (authedProjects != null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
createProjects.addAll(authedProjects); } return createProjects; } /** * get have perm project ids * * @param userId userId * @return project ids */ public List<Integer> getProjectIdListHavePerm(int userId) { List<Integer> projectIdList = new ArrayList<>(); for (Project project : getProjectListHavePerm(userId)) { projectIdList.add(project.getId()); } return projectIdList; } /** * list unauthorized udf function * * @param userId user id * @param needChecks data source id array * @return unauthorized udf function list */ public <T> List<T> listUnauthorized(int userId, T[] needChecks, AuthorizationType authorizationType) { List<T> resultList = new ArrayList<>(); if (Objects.nonNull(needChecks) && needChecks.length > 0) { Set<T> originResSet = new HashSet<>(Arrays.asList(needChecks)); switch (authorizationType) { case RESOURCE_FILE_ID:
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
case UDF_FILE: Set<Integer> authorizedResourceFiles = resourceMapper.listAuthorizedResourceById(userId, needChecks).stream().map(Resource::getId).collect(toSet()); originResSet.removeAll(authorizedResourceFiles); break; case RESOURCE_FILE_NAME: Set<String> authorizedResources = resourceMapper.listAuthorizedResource(userId, needChecks).stream().map(Resource::getFullName).collect(toSet()); originResSet.removeAll(authorizedResources); break; case DATASOURCE: Set<Integer> authorizedDatasources = dataSourceMapper.listAuthorizedDataSource(userId, needChecks).stream().map(DataSource::getId).collect(toSet()); originResSet.removeAll(authorizedDatasources); break; case UDF: Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(UdfFunc::getId).collect(toSet()); originResSet.removeAll(authorizedUdfs); break; default: break; } resultList.addAll(originResSet); } return resultList; } /** * get user by user id * * @param userId user id * @return User */ public User getUserById(int userId) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
return userMapper.selectById(userId); } /** * get resource by resoruce id * * @param resoruceId resource id * @return Resource */ public Resource getResourceById(int resoruceId) { return resourceMapper.selectById(resoruceId); } /** * list resources by ids * * @param resIds resIds * @return resource list */ public List<Resource> listResourceByIds(Integer[] resIds) { return resourceMapper.listResourceByIds(resIds); } /** * format task app id in task instance */ public String formatTaskAppId(TaskInstance taskInstance) { ProcessDefinition definition = this.findProcessDefineById(taskInstance.getProcessDefinitionId()); ProcessInstance processInstanceById = this.findProcessInstanceById(taskInstance.getProcessInstanceId()); if (definition == null || processInstanceById == null) { return ""; } return String.format("%s_%s_%s",
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
definition.getId(), processInstanceById.getId(), taskInstance.getId()); } /** * solve the branch rename bug * * @param processData * @param oldJson * @return String */ public String changeJson(ProcessData processData, String oldJson) { ProcessData oldProcessData = JSONUtils.parseObject(oldJson, ProcessData.class); HashMap<String, String> oldNameTaskId = new HashMap<>(); List<TaskNode> oldTasks = oldProcessData.getTasks(); for (int i = 0; i < oldTasks.size(); i++) { TaskNode taskNode = oldTasks.get(i); String oldName = taskNode.getName(); String oldId = taskNode.getId(); oldNameTaskId.put(oldName, oldId); } // HashMap<String, String> newNameTaskId = new HashMap<>(); List<TaskNode> newTasks = processData.getTasks(); for (int i = 0; i < newTasks.size(); i++) { TaskNode taskNode = newTasks.get(i); String newId = taskNode.getId(); String newName = taskNode.getName(); newNameTaskId.put(newId, newName); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,085
[Bug][server-master]if global Param of out is a number, throw format exception
sql or shell task node has out param,if the format of param is number,throw format exception.
https://github.com/apache/dolphinscheduler/issues/5085
https://github.com/apache/dolphinscheduler/pull/5077
5856a12855328e67aeb6a2005f86b3c1081750a1
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
"2021-03-18T02:56:45Z"
java
"2021-03-18T03:50:10Z"
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java
// List<TaskNode> tasks = processData.getTasks(); for (int i = 0; i < tasks.size(); i++) { TaskNode taskNode = newTasks.get(i); String type = taskNode.getType(); if (TaskType.CONDITIONS.getDescp().equalsIgnoreCase(type)) { ConditionsParameters conditionsParameters = JSONUtils.parseObject(taskNode.getConditionResult(), ConditionsParameters.class); String oldSuccessNodeName = conditionsParameters.getSuccessNode().get(0); String oldFailedNodeName = conditionsParameters.getFailedNode().get(0); String newSuccessNodeName = newNameTaskId.get(oldNameTaskId.get(oldSuccessNodeName)); String newFailedNodeName = newNameTaskId.get(oldNameTaskId.get(oldFailedNodeName)); if (newSuccessNodeName != null) { ArrayList<String> successNode = new ArrayList<>(); successNode.add(newSuccessNodeName); conditionsParameters.setSuccessNode(successNode); } if (newFailedNodeName != null) { ArrayList<String> failedNode = new ArrayList<>(); failedNode.add(newFailedNodeName); conditionsParameters.setFailedNode(failedNode); } String conditionResultStr = conditionsParameters.getConditionResult(); taskNode.setConditionResult(conditionResultStr); tasks.set(i, taskNode); } } return JSONUtils.toJsonString(processData); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.shell.ShellExecutor; import org.apache.commons.configuration.Configuration; import java.lang.management.OperatingSystemMXBean; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.StringTokenizer; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.GlobalMemory; import oshi.hardware.HardwareAbstractionLayer; /** * os utils */ public class OSUtils { private static final Logger logger = LoggerFactory.getLogger(OSUtils.class); public static final ThreadLocal<Logger> taskLoggerThreadLocal = new ThreadLocal<>(); private static final SystemInfo SI = new SystemInfo(); public static final String TWO_DECIMAL = "0.00"; /** * return -1 when the function can not get hardware env info * e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()} */ public static final double NEGATIVE_ONE = -1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static HardwareAbstractionLayer hal = SI.getHardware(); private OSUtils() { throw new UnsupportedOperationException("Construct OSUtils"); } /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern PATTERN = Pattern.compile("\\s+"); /** * get memory usage * Keep 2 decimal * * @return percent % */ public static double memoryUsage() { GlobalMemory memory = hal.getMemory(); double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getSwapUsed()) * 0.1 / memory.getTotal() * 10; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(memoryUsage)); } /** * get available physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double availablePhysicalMemorySize() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = (memory.getAvailable() + memory.getSwapUsed()) / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * get total physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double totalMemorySize() { GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * load average * * @return load average */ public static double loadAverage() { double loadAverage; try { OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class); loadAverage = osBean.getSystemLoadAverage();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} catch (Exception e) { logger.error("get operation system load average exception, try another method ", e); loadAverage = hal.getProcessor().getSystemLoadAverage(); if (Double.isNaN(loadAverage)) { return NEGATIVE_ONE; } } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(loadAverage)); } /** * get cpu usage * * @return cpu usage */ public static double cpuUsage() { CentralProcessor processor = hal.getProcessor(); double cpuUsage = processor.getSystemCpuLoad(); if (Double.isNaN(cpuUsage)) { return NEGATIVE_ONE; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(cpuUsage)); } public static List<String> getUserList() { try { if (isMacOS()) { return getUserListFromMac();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} else if (isWindows()) { return getUserListFromWindows(); } else { return getUserListFromLinux(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return Collections.emptyList(); } /** * get user list from linux * * @return user list */ private static List<String> getUserListFromLinux() throws IOException { List<String> userList = new ArrayList<>(); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream("/etc/passwd")))) { String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(":")) { String[] userInfo = line.split(":"); userList.add(userInfo[0]); } } } return userList; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* get user list from mac * * @return user list */ private static List<String> getUserListFromMac() throws IOException { String result = exeCmd("dscl . list /users"); if (StringUtils.isNotEmpty(result)) { return Arrays.asList(result.split("\n")); } return Collections.emptyList(); } /** * get user list from windows * * @return user list */ private static List<String> getUserListFromWindows() throws IOException { String result = exeCmd("net user"); String[] lines = result.split("\n"); int startPos = 0; int endPos = lines.length - 2; for (int i = 0; i < lines.length; i++) { if (lines[i].isEmpty()) { continue; } int count = 0; if (lines[i].charAt(0) == '-') { for (int j = 0; j < lines[i].length(); j++) { if (lines[i].charAt(i) == '-') { count++;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} } } if (count == lines[i].length()) { startPos = i + 1; break; } } List<String> users = new ArrayList<>(); while (startPos <= endPos) { users.addAll(Arrays.asList(PATTERN.split(lines[startPos]))); startPos++; } return users; } /** * create user * * @param userName user name * @return true if creation was successful, otherwise false */ public static boolean createUser(String userName) { try { String userGroup = OSUtils.getGroup(); if (StringUtils.isEmpty(userGroup)) { String errorLog = String.format("%s group does not exist for this operating system.", userGroup); LoggerUtils.logError(Optional.ofNullable(logger), errorLog); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), errorLog); return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
if (isMacOS()) { createMacUser(userName, userGroup); } else if (isWindows()) { createWindowsUser(userName, userGroup); } else { createLinuxUser(userName, userGroup); } return true; } catch (Exception e) { LoggerUtils.logError(Optional.ofNullable(logger), e); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), e); } return false; } /** * create linux user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createLinuxUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create linux os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String cmd = String.format("sudo useradd -g %s %s", userGroup, userName); String infoLog2 = String.format("execute cmd : %s", cmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(cmd);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} /** * create mac user (Supports Mac OSX 10.10+) * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createMacUser(String userName, String userGroup) throws IOException { Optional<Logger> optionalLogger = Optional.ofNullable(logger); Optional<Logger> optionalTaskLogger = Optional.ofNullable(taskLoggerThreadLocal.get()); String infoLog1 = String.format("create mac os user : %s", userName); LoggerUtils.logInfo(optionalLogger, infoLog1); LoggerUtils.logInfo(optionalTaskLogger, infoLog1); String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName); String infoLog2 = String.format("create user command : %s", createUserCmd); LoggerUtils.logInfo(optionalLogger, infoLog2); LoggerUtils.logInfo(optionalTaskLogger, infoLog2); OSUtils.exeCmd(createUserCmd); String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup); String infoLog3 = String.format("append user to group : %s", appendGroupCmd); LoggerUtils.logInfo(optionalLogger, infoLog3); LoggerUtils.logInfo(optionalTaskLogger, infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * create windows user * * @param userName user name * @param userGroup user group
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* @throws IOException in case of an I/O error */ private static void createWindowsUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create windows os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String userCreateCmd = String.format("net user \"%s\" /add", userName); String infoLog2 = String.format("execute create user command : %s", userCreateCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(userCreateCmd); String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName); String infoLog3 = String.format("execute append user to group : %s", appendGroupCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog3); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * get system group information * * @return system group info * @throws IOException errors */ public static String getGroup() throws IOException { if (isWindows()) { String currentProcUserName = System.getProperty("user.name"); String result = exeCmd(String.format("net user \"%s\"", currentProcUserName)); String line = result.split("\n")[22]; String group = PATTERN.split(line)[1]; if (group.charAt(0) == '*') {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
return group.substring(1); } else { return group; } } else { String result = exeCmd("groups"); if (StringUtils.isNotEmpty(result)) { String[] groupInfo = result.split(" "); return groupInfo[0]; } } return null; } /** * get sudo command * @param tenantCode tenantCode * @param command command * @return result of sudo execute command */ public static String getSudoCmd(String tenantCode, String command) { return StringUtils.isEmpty(tenantCode) ? command : "sudo -u " + tenantCode + " " + command; } /** * Execute the corresponding command of Linux or Windows * * @param command command * @return result of execute command * @throws IOException errors */ public static String exeCmd(String command) throws IOException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
StringTokenizer st = new StringTokenizer(command); String[] cmdArray = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { cmdArray[i] = st.nextToken(); } return exeShell(cmdArray); } /** * Execute the shell * * @param command command * @return result of execute the shell * @throws IOException errors */ public static String exeShell(String[] command) throws IOException { return ShellExecutor.execCommand(command); } /** * get process id * * @return process id */ public static int getProcessID() { RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); return Integer.parseInt(runtimeMXBean.getName().split("@")[0]); } /** * whether is macOS * * @return true if mac
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ public static boolean isMacOS() { return getOSName().startsWith("Mac"); } /** * whether is windows * * @return true if windows */ public static boolean isWindows() { return getOSName().startsWith("Windows"); } /** * get current OS name * * @return current OS name */ public static String getOSName() { return System.getProperty("os.name"); } /** * check memory and cpu usage * * @param systemCpuLoad systemCpuLoad * @param systemReservedMemory systemReservedMemory * @return check memory and cpu usage */ public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) { double loadAverage = OSUtils.loadAverage();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) { logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage); return false; } else { return true; } } /** * check memory and cpu usage * * @param conf conf * @param isMaster is master * @return check memory and cpu usage */ public static Boolean checkResource(Configuration conf, Boolean isMaster) { double systemCpuLoad; double systemReservedMemory; if (Boolean.TRUE.equals(isMaster)) { systemCpuLoad = conf.getDouble(Constants.MASTER_MAX_CPULOAD_AVG, Constants.DEFAULT_MASTER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.MASTER_RESERVED_MEMORY, Constants.DEFAULT_MASTER_RESERVED_MEMORY); } else { systemCpuLoad = conf.getDouble(Constants.WORKER_MAX_CPULOAD_AVG, Constants.DEFAULT_WORKER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.WORKER_RESERVED_MEMORY, Constants.DEFAULT_WORKER_RESERVED_MEMORY); } return checkResource(systemCpuLoad, systemReservedMemory); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.dolphinscheduler.common.Constants; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; public class OSUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
private static final Logger logger = LoggerFactory.getLogger(OSUtilsTest.class); @Test public void getUserList() { List<String> userList = OSUtils.getUserList(); Assert.assertNotEquals("System user list should not be empty", userList.size(), 0); logger.info("OS user list : {}", userList.toString()); } @Test public void testOSMetric(){ if (!OSUtils.isWindows()) { double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); Assert.assertTrue(availablePhysicalMemorySize >= 0.0d); double totalMemorySize = OSUtils.totalMemorySize(); Assert.assertTrue(totalMemorySize >= 0.0d); double loadAverage = OSUtils.loadAverage(); logger.info("loadAverage {}", loadAverage); double memoryUsage = OSUtils.memoryUsage(); Assert.assertTrue(memoryUsage >= 0.0d); double cpuUsage = OSUtils.cpuUsage(); Assert.assertTrue(cpuUsage >= 0.0d || cpuUsage == -1.0d); } else { } } @Test public void getGroup() { try { String group = OSUtils.getGroup(); Assert.assertNotNull(group); } catch (IOException e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
Assert.fail("get group failed " + e.getMessage()); } } @Test public void createUser() { boolean result = OSUtils.createUser("test123"); if (result) { Assert.assertTrue("create user test123 success", true); } else { Assert.assertTrue("create user test123 fail", true); } } @Test public void testGetSudoCmd() { String cmd = "kill -9 1234"; String sudoCmd = OSUtils.getSudoCmd("test123", cmd); Assert.assertEquals("sudo -u test123 " + cmd, sudoCmd); } @Test public void exeCmd() { if(OSUtils.isMacOS() || !OSUtils.isWindows()){ try { String result = OSUtils.exeCmd("echo helloWorld"); Assert.assertEquals("helloWorld\n",result); } catch (IOException e) { Assert.fail("exeCmd " + e.getMessage()); } } } @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
public void getProcessID(){ int processId = OSUtils.getProcessID(); Assert.assertNotEquals(0, processId); } @Test public void checkResource(){ boolean resource = OSUtils.checkResource(100,0); Assert.assertTrue(resource); resource = OSUtils.checkResource(0,Double.MAX_VALUE); Assert.assertFalse(resource); Configuration configuration = new PropertiesConfiguration(); configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,100); configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,0); resource = OSUtils.checkResource(configuration,true); Assert.assertTrue(resource); configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,0); configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,Double.MAX_VALUE); resource = OSUtils.checkResource(configuration,true); Assert.assertFalse(resource); configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,100); configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,0); resource = OSUtils.checkResource(configuration,false); Assert.assertTrue(resource); configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,0); configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,Double.MAX_VALUE); resource = OSUtils.checkResource(configuration,false); Assert.assertFalse(resource); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.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.worker.config; import org.apache.dolphinscheduler.common.Constants; import java.util.Set; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
@PropertySource(value = "worker.properties") public class WorkerConfig { @Value("${worker.exec.threads:100}") private int workerExecThreads; @Value("${worker.heartbeat.interval:10}") private int workerHeartbeatInterval; @Value("${worker.fetch.task.num:3}") private int workerFetchTaskNum; @Value("${worker.max.cpuload.avg:-1}") private int workerMaxCpuloadAvg; @Value("${worker.reserved.memory:0.3}") private double workerReservedMemory; @Value("#{'${worker.groups:default}'.split(',')}") private Set<String> workerGroups; @Value("${worker.listen.port:1234}") private int listenPort; @Value("${worker.host.weight:100}") private int hostWeight;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
@Value("${alert.listen.host:localhost}") private String alertListenHost; public int getListenPort() { return listenPort; } public void setListenPort(int listenPort) { this.listenPort = listenPort; } public Set<String> getWorkerGroups() { return workerGroups; } public void setWorkerGroups(Set<String> workerGroups) { this.workerGroups = workerGroups; } public int getWorkerExecThreads() { return workerExecThreads; } public void setWorkerExecThreads(int workerExecThreads) { this.workerExecThreads = workerExecThreads; } public int getWorkerHeartbeatInterval() { return workerHeartbeatInterval; } public void setWorkerHeartbeatInterval(int workerHeartbeatInterval) { this.workerHeartbeatInterval = workerHeartbeatInterval; } public int getWorkerFetchTaskNum() { return workerFetchTaskNum; } public void setWorkerFetchTaskNum(int workerFetchTaskNum) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
this.workerFetchTaskNum = workerFetchTaskNum; } public double getWorkerReservedMemory() { return workerReservedMemory; } public void setWorkerReservedMemory(double workerReservedMemory) { this.workerReservedMemory = workerReservedMemory; } public int getWorkerMaxCpuloadAvg() { if (workerMaxCpuloadAvg == -1) { return Constants.DEFAULT_WORKER_CPU_LOAD; } return workerMaxCpuloadAvg; } public void setWorkerMaxCpuloadAvg(int workerMaxCpuloadAvg) { this.workerMaxCpuloadAvg = workerMaxCpuloadAvg; } public int getHostWeight() { return hostWeight; } public void setHostWeight(int hostWeight) { this.hostWeight = hostWeight; } public String getAlertListenHost() { return alertListenHost; } public void setAlertListenHost(String alertListenHost) { this.alertListenHost = alertListenHost; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.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.worker.processor; import org.apache.dolphinscheduler.common.enums.Event; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.TaskType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.Preconditions; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.TaskExecuteAckCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteRequestCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.LogUtils; import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.util.Date; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.netty.channel.Channel; /** * worker request processor */ public class TaskExecuteProcessor implements NettyRequestProcessor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
private static final Logger logger = LoggerFactory.getLogger(TaskExecuteProcessor.class); /** * worker config */ private final WorkerConfig workerConfig; /** * task callback service */ private final TaskCallbackService taskCallbackService; /** * alert client service */ private AlertClientService alertClientService; /** * taskExecutionContextCacheManager */ private final TaskExecutionContextCacheManager taskExecutionContextCacheManager; /* * task execute manager
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
*/ private final WorkerManagerThread workerManager; public TaskExecuteProcessor() { this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class); this.workerConfig = SpringApplicationContext.getBean(WorkerConfig.class); this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); this.workerManager = SpringApplicationContext.getBean(WorkerManagerThread.class); } /** * Pre-cache task to avoid extreme situations when kill task. There is no such task in the cache * * @param taskExecutionContext task */ private void setTaskCache(TaskExecutionContext taskExecutionContext) { TaskExecutionContext preTaskCache = new TaskExecutionContext(); preTaskCache.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskExecutionContextCacheManager.cacheTaskExecutionContext(preTaskCache); } public TaskExecuteProcessor(AlertClientService alertClientService) { this(); this.alertClientService = alertClientService; } @Override public void process(Channel channel, Command command) { Preconditions.checkArgument(CommandType.TASK_EXECUTE_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType())); TaskExecuteRequestCommand taskRequestCommand = JSONUtils.parseObject( command.getBody(), TaskExecuteRequestCommand.class); logger.info("received command : {}", taskRequestCommand); if (taskRequestCommand == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
logger.error("task execute request command is null"); return; } String contextJson = taskRequestCommand.getTaskExecutionContext(); TaskExecutionContext taskExecutionContext = JSONUtils.parseObject(contextJson, TaskExecutionContext.class); if (taskExecutionContext == null) { logger.error("task execution context is null"); return; } setTaskCache(taskExecutionContext); Logger taskLogger = LoggerFactory.getLogger(LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, taskExecutionContext.getProcessDefineId(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId())); taskExecutionContext.setHost(NetUtils.getAddr(workerConfig.getListenPort())); taskExecutionContext.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext)); String execLocalPath = getExecLocalPath(taskExecutionContext); logger.info("task instance local execute path : {} ", execLocalPath); taskExecutionContext.setExecutePath(execLocalPath); FileUtils.taskLoggerThreadLocal.set(taskLogger); try { FileUtils.createWorkDirIfAbsent(execLocalPath); } catch (Throwable ex) { String errorLog = String.format("create execLocalPath : %s", execLocalPath); LoggerUtils.logError(Optional.of(logger), errorLog, ex); LoggerUtils.logError(Optional.ofNullable(taskLogger), errorLog, ex); taskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
FileUtils.taskLoggerThreadLocal.remove(); taskCallbackService.addRemoteChannel(taskExecutionContext.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque())); long remainTime = DateUtils.getRemainTime(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getDelayTime() * 60L); if (remainTime > 0) { logger.info("delay the execution of task instance {}, delay time: {} s", taskExecutionContext.getTaskInstanceId(), remainTime); taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.DELAY_EXECUTION); taskExecutionContext.setStartTime(null); } else { taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); taskExecutionContext.setStartTime(new Date()); } this.doAck(taskExecutionContext); if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService))) { logger.info("submit task to manager error, queue is full, queue size is {}", workerManager.getQueueSize()); } } private void doAck(TaskExecutionContext taskExecutionContext) { TaskExecuteAckCommand ackCommand = buildAckCommand(taskExecutionContext); ResponceCache.get().cache(taskExecutionContext.getTaskInstanceId(), ackCommand.convert2Command(), Event.ACK); taskCallbackService.sendAck(taskExecutionContext.getTaskInstanceId(), ackCommand.convert2Command()); } /** * build ack command * * @param taskExecutionContext taskExecutionContext * @return TaskExecuteAckCommand
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,006
[Feature][Worker] Add a configuration item to set whether the tenant is automatically created on Worker
**Describe the feature** In the dev branch, the tenant executing a task will not be automatically created in worker. This will cause issue [#4995](https://github.com/apache/incubator-dolphinscheduler/issues/4995) In the following two scenarios, it will cause inconvenience to users - Product or operation people want to automatically create users instead of manually creating tenants - In the docker container environment, the tenants cannot be created in advance. Once the container is pulled up again, all tenants will disappear **Which version of Dolphin Scheduler:** - [dev] **Is your feature request related to a problem? Please describe.** In the docker container environment, it's a very painful thing to create new tenants on every worker every time. **Describe the solution you'd like** Add a configuration item to set whether the tenant is automatically created on Worker The default value of this configuration item is `false`, but it needs to be set to `true` in the container The name of this configuration item is `worker.tenant.auto.create` **Additional context** Previous dev email discussion: https://lists.apache.org/thread.html/ra44b2e69759fcc980e4ed04c1811037bf0e743e47827fc2dcd1049d6%40%3Cdev.dolphinscheduler.apache.org%3E
https://github.com/apache/dolphinscheduler/issues/5006
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-08T15:28:05Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
*/ private TaskExecuteAckCommand buildAckCommand(TaskExecutionContext taskExecutionContext) { TaskExecuteAckCommand ackCommand = new TaskExecuteAckCommand(); ackCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); ackCommand.setStatus(taskExecutionContext.getCurrentExecutionStatus().getCode()); ackCommand.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext)); ackCommand.setHost(taskExecutionContext.getHost()); ackCommand.setStartTime(taskExecutionContext.getStartTime()); if (taskExecutionContext.getTaskType().equals(TaskType.SQL.name()) || taskExecutionContext.getTaskType().equals(TaskType.PROCEDURE.name())) { ackCommand.setExecutePath(null); } else { ackCommand.setExecutePath(taskExecutionContext.getExecutePath()); } taskExecutionContext.setLogPath(ackCommand.getLogPath()); return ackCommand; } /** * get execute local path * * @param taskExecutionContext taskExecutionContext * @return execute local path */ private String getExecLocalPath(TaskExecutionContext taskExecutionContext) { return FileUtils.getProcessExecDir(taskExecutionContext.getProjectId(), taskExecutionContext.getProcessDefineId(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.shell.ShellExecutor; import org.apache.commons.configuration.Configuration; import java.lang.management.OperatingSystemMXBean; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
import java.lang.management.ManagementFactory; import java.lang.management.RuntimeMXBean; import java.math.RoundingMode; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.StringTokenizer; import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import oshi.SystemInfo; import oshi.hardware.CentralProcessor; import oshi.hardware.GlobalMemory; import oshi.hardware.HardwareAbstractionLayer; /** * os utils */ public class OSUtils { private static final Logger logger = LoggerFactory.getLogger(OSUtils.class); public static final ThreadLocal<Logger> taskLoggerThreadLocal = new ThreadLocal<>(); private static final SystemInfo SI = new SystemInfo(); public static final String TWO_DECIMAL = "0.00"; /** * return -1 when the function can not get hardware env info * e.g {@link OSUtils#loadAverage()} {@link OSUtils#cpuUsage()} */ public static final double NEGATIVE_ONE = -1;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
private static HardwareAbstractionLayer hal = SI.getHardware(); private OSUtils() { throw new UnsupportedOperationException("Construct OSUtils"); } /** * Initialization regularization, solve the problem of pre-compilation performance, * avoid the thread safety problem of multi-thread operation */ private static final Pattern PATTERN = Pattern.compile("\\s+"); /** * get memory usage * Keep 2 decimal * * @return percent % */ public static double memoryUsage() { GlobalMemory memory = hal.getMemory(); double memoryUsage = (memory.getTotal() - memory.getAvailable() - memory.getSwapUsed()) * 0.1 / memory.getTotal() * 10; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(memoryUsage)); } /** * get available physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double availablePhysicalMemorySize() {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = (memory.getAvailable() + memory.getSwapUsed()) / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * get total physical memory size * <p> * Keep 2 decimal * * @return available Physical Memory Size, unit: G */ public static double totalMemorySize() { GlobalMemory memory = hal.getMemory(); double availablePhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024; DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(availablePhysicalMemorySize)); } /** * load average * * @return load average */ public static double loadAverage() { double loadAverage; try { OperatingSystemMXBean osBean = ManagementFactory.getPlatformMXBean(OperatingSystemMXBean.class); loadAverage = osBean.getSystemLoadAverage();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} catch (Exception e) { logger.error("get operation system load average exception, try another method ", e); loadAverage = hal.getProcessor().getSystemLoadAverage(); if (Double.isNaN(loadAverage)) { return NEGATIVE_ONE; } } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(loadAverage)); } /** * get cpu usage * * @return cpu usage */ public static double cpuUsage() { CentralProcessor processor = hal.getProcessor(); double cpuUsage = processor.getSystemCpuLoad(); if (Double.isNaN(cpuUsage)) { return NEGATIVE_ONE; } DecimalFormat df = new DecimalFormat(TWO_DECIMAL); df.setRoundingMode(RoundingMode.HALF_UP); return Double.parseDouble(df.format(cpuUsage)); } public static List<String> getUserList() { try { if (isMacOS()) { return getUserListFromMac();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} else if (isWindows()) { return getUserListFromWindows(); } else { return getUserListFromLinux(); } } catch (Exception e) { logger.error(e.getMessage(), e); } return Collections.emptyList(); } /** * get user list from linux * * @return user list */ private static List<String> getUserListFromLinux() throws IOException { List<String> userList = new ArrayList<>(); try (BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(new FileInputStream("/etc/passwd")))) { String line; while ((line = bufferedReader.readLine()) != null) { if (line.contains(":")) { String[] userInfo = line.split(":"); userList.add(userInfo[0]); } } } return userList; } /**
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* get user list from mac * * @return user list */ private static List<String> getUserListFromMac() throws IOException { String result = exeCmd("dscl . list /users"); if (StringUtils.isNotEmpty(result)) { return Arrays.asList(result.split("\n")); } return Collections.emptyList(); } /** * get user list from windows * * @return user list */ private static List<String> getUserListFromWindows() throws IOException { String result = exeCmd("net user"); String[] lines = result.split("\n"); int startPos = 0; int endPos = lines.length - 2; for (int i = 0; i < lines.length; i++) { if (lines[i].isEmpty()) { continue; } int count = 0; if (lines[i].charAt(0) == '-') { for (int j = 0; j < lines[i].length(); j++) { if (lines[i].charAt(i) == '-') { count++;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} } } if (count == lines[i].length()) { startPos = i + 1; break; } } List<String> users = new ArrayList<>(); while (startPos <= endPos) { users.addAll(Arrays.asList(PATTERN.split(lines[startPos]))); startPos++; } return users; } /** * create user * * @param userName user name * @return true if creation was successful, otherwise false */ public static boolean createUser(String userName) { try { String userGroup = OSUtils.getGroup(); if (StringUtils.isEmpty(userGroup)) { String errorLog = String.format("%s group does not exist for this operating system.", userGroup); LoggerUtils.logError(Optional.ofNullable(logger), errorLog); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), errorLog); return false; }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
if (isMacOS()) { createMacUser(userName, userGroup); } else if (isWindows()) { createWindowsUser(userName, userGroup); } else { createLinuxUser(userName, userGroup); } return true; } catch (Exception e) { LoggerUtils.logError(Optional.ofNullable(logger), e); LoggerUtils.logError(Optional.ofNullable(taskLoggerThreadLocal.get()), e); } return false; } /** * create linux user * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createLinuxUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create linux os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String cmd = String.format("sudo useradd -g %s %s", userGroup, userName); String infoLog2 = String.format("execute cmd : %s", cmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(cmd);
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
} /** * create mac user (Supports Mac OSX 10.10+) * * @param userName user name * @param userGroup user group * @throws IOException in case of an I/O error */ private static void createMacUser(String userName, String userGroup) throws IOException { Optional<Logger> optionalLogger = Optional.ofNullable(logger); Optional<Logger> optionalTaskLogger = Optional.ofNullable(taskLoggerThreadLocal.get()); String infoLog1 = String.format("create mac os user : %s", userName); LoggerUtils.logInfo(optionalLogger, infoLog1); LoggerUtils.logInfo(optionalTaskLogger, infoLog1); String createUserCmd = String.format("sudo sysadminctl -addUser %s -password %s", userName, userName); String infoLog2 = String.format("create user command : %s", createUserCmd); LoggerUtils.logInfo(optionalLogger, infoLog2); LoggerUtils.logInfo(optionalTaskLogger, infoLog2); OSUtils.exeCmd(createUserCmd); String appendGroupCmd = String.format("sudo dseditgroup -o edit -a %s -t user %s", userName, userGroup); String infoLog3 = String.format("append user to group : %s", appendGroupCmd); LoggerUtils.logInfo(optionalLogger, infoLog3); LoggerUtils.logInfo(optionalTaskLogger, infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * create windows user * * @param userName user name * @param userGroup user group
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
* @throws IOException in case of an I/O error */ private static void createWindowsUser(String userName, String userGroup) throws IOException { String infoLog1 = String.format("create windows os user : %s", userName); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog1); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog1); String userCreateCmd = String.format("net user \"%s\" /add", userName); String infoLog2 = String.format("execute create user command : %s", userCreateCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog2); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog2); OSUtils.exeCmd(userCreateCmd); String appendGroupCmd = String.format("net localgroup \"%s\" \"%s\" /add", userGroup, userName); String infoLog3 = String.format("execute append user to group : %s", appendGroupCmd); LoggerUtils.logInfo(Optional.ofNullable(logger), infoLog3); LoggerUtils.logInfo(Optional.ofNullable(taskLoggerThreadLocal.get()), infoLog3); OSUtils.exeCmd(appendGroupCmd); } /** * get system group information * * @return system group info * @throws IOException errors */ public static String getGroup() throws IOException { if (isWindows()) { String currentProcUserName = System.getProperty("user.name"); String result = exeCmd(String.format("net user \"%s\"", currentProcUserName)); String line = result.split("\n")[22]; String group = PATTERN.split(line)[1]; if (group.charAt(0) == '*') {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
return group.substring(1); } else { return group; } } else { String result = exeCmd("groups"); if (StringUtils.isNotEmpty(result)) { String[] groupInfo = result.split(" "); return groupInfo[0]; } } return null; } /** * get sudo command * @param tenantCode tenantCode * @param command command * @return result of sudo execute command */ public static String getSudoCmd(String tenantCode, String command) { return StringUtils.isEmpty(tenantCode) ? command : "sudo -u " + tenantCode + " " + command; } /** * Execute the corresponding command of Linux or Windows * * @param command command * @return result of execute command * @throws IOException errors */ public static String exeCmd(String command) throws IOException {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
StringTokenizer st = new StringTokenizer(command); String[] cmdArray = new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++) { cmdArray[i] = st.nextToken(); } return exeShell(cmdArray); } /** * Execute the shell * * @param command command * @return result of execute the shell * @throws IOException errors */ public static String exeShell(String[] command) throws IOException { return ShellExecutor.execCommand(command); } /** * get process id * * @return process id */ public static int getProcessID() { RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); return Integer.parseInt(runtimeMXBean.getName().split("@")[0]); } /** * whether is macOS * * @return true if mac
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
*/ public static boolean isMacOS() { return getOSName().startsWith("Mac"); } /** * whether is windows * * @return true if windows */ public static boolean isWindows() { return getOSName().startsWith("Windows"); } /** * get current OS name * * @return current OS name */ public static String getOSName() { return System.getProperty("os.name"); } /** * check memory and cpu usage * * @param systemCpuLoad systemCpuLoad * @param systemReservedMemory systemReservedMemory * @return check memory and cpu usage */ public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) { double loadAverage = OSUtils.loadAverage();
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) { logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage); return false; } else { return true; } } /** * check memory and cpu usage * * @param conf conf * @param isMaster is master * @return check memory and cpu usage */ public static Boolean checkResource(Configuration conf, Boolean isMaster) { double systemCpuLoad; double systemReservedMemory; if (Boolean.TRUE.equals(isMaster)) { systemCpuLoad = conf.getDouble(Constants.MASTER_MAX_CPULOAD_AVG, Constants.DEFAULT_MASTER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.MASTER_RESERVED_MEMORY, Constants.DEFAULT_MASTER_RESERVED_MEMORY); } else { systemCpuLoad = conf.getDouble(Constants.WORKER_MAX_CPULOAD_AVG, Constants.DEFAULT_WORKER_CPU_LOAD); systemReservedMemory = conf.getDouble(Constants.WORKER_RESERVED_MEMORY, Constants.DEFAULT_WORKER_RESERVED_MEMORY); } return checkResource(systemCpuLoad, systemReservedMemory); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.common.utils; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; import org.apache.dolphinscheduler.common.Constants; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; public class OSUtilsTest {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
private static final Logger logger = LoggerFactory.getLogger(OSUtilsTest.class); @Test public void getUserList() { List<String> userList = OSUtils.getUserList(); Assert.assertNotEquals("System user list should not be empty", userList.size(), 0); logger.info("OS user list : {}", userList.toString()); } @Test public void testOSMetric(){ if (!OSUtils.isWindows()) { double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); Assert.assertTrue(availablePhysicalMemorySize >= 0.0d); double totalMemorySize = OSUtils.totalMemorySize(); Assert.assertTrue(totalMemorySize >= 0.0d); double loadAverage = OSUtils.loadAverage(); logger.info("loadAverage {}", loadAverage); double memoryUsage = OSUtils.memoryUsage(); Assert.assertTrue(memoryUsage >= 0.0d); double cpuUsage = OSUtils.cpuUsage(); Assert.assertTrue(cpuUsage >= 0.0d || cpuUsage == -1.0d); } else { } } @Test public void getGroup() { try { String group = OSUtils.getGroup(); Assert.assertNotNull(group); } catch (IOException e) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
Assert.fail("get group failed " + e.getMessage()); } } @Test public void createUser() { boolean result = OSUtils.createUser("test123"); if (result) { Assert.assertTrue("create user test123 success", true); } else { Assert.assertTrue("create user test123 fail", true); } } @Test public void testGetSudoCmd() { String cmd = "kill -9 1234"; String sudoCmd = OSUtils.getSudoCmd("test123", cmd); Assert.assertEquals("sudo -u test123 " + cmd, sudoCmd); } @Test public void exeCmd() { if(OSUtils.isMacOS() || !OSUtils.isWindows()){ try { String result = OSUtils.exeCmd("echo helloWorld"); Assert.assertEquals("helloWorld\n",result); } catch (IOException e) { Assert.fail("exeCmd " + e.getMessage()); } } } @Test
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/OSUtilsTest.java
public void getProcessID(){ int processId = OSUtils.getProcessID(); Assert.assertNotEquals(0, processId); } @Test public void checkResource(){ boolean resource = OSUtils.checkResource(100,0); Assert.assertTrue(resource); resource = OSUtils.checkResource(0,Double.MAX_VALUE); Assert.assertFalse(resource); Configuration configuration = new PropertiesConfiguration(); configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,100); configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,0); resource = OSUtils.checkResource(configuration,true); Assert.assertTrue(resource); configuration.setProperty(Constants.MASTER_MAX_CPULOAD_AVG,0); configuration.setProperty(Constants.MASTER_RESERVED_MEMORY,Double.MAX_VALUE); resource = OSUtils.checkResource(configuration,true); Assert.assertFalse(resource); configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,100); configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,0); resource = OSUtils.checkResource(configuration,false); Assert.assertTrue(resource); configuration.setProperty(Constants.WORKER_MAX_CPULOAD_AVG,0); configuration.setProperty(Constants.WORKER_RESERVED_MEMORY,Double.MAX_VALUE); resource = OSUtils.checkResource(configuration,false); Assert.assertFalse(resource); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.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.worker.config; import org.apache.dolphinscheduler.common.Constants; import java.util.Set; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; @Component
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
@PropertySource(value = "worker.properties") public class WorkerConfig { @Value("${worker.exec.threads:100}") private int workerExecThreads; @Value("${worker.heartbeat.interval:10}") private int workerHeartbeatInterval; @Value("${worker.fetch.task.num:3}") private int workerFetchTaskNum; @Value("${worker.max.cpuload.avg:-1}") private int workerMaxCpuloadAvg; @Value("${worker.reserved.memory:0.3}") private double workerReservedMemory; @Value("#{'${worker.groups:default}'.split(',')}") private Set<String> workerGroups; @Value("${worker.listen.port:1234}") private int listenPort; @Value("${worker.host.weight:100}") private int hostWeight;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
@Value("${alert.listen.host:localhost}") private String alertListenHost; public int getListenPort() { return listenPort; } public void setListenPort(int listenPort) { this.listenPort = listenPort; } public Set<String> getWorkerGroups() { return workerGroups; } public void setWorkerGroups(Set<String> workerGroups) { this.workerGroups = workerGroups; } public int getWorkerExecThreads() { return workerExecThreads; } public void setWorkerExecThreads(int workerExecThreads) { this.workerExecThreads = workerExecThreads; } public int getWorkerHeartbeatInterval() { return workerHeartbeatInterval; } public void setWorkerHeartbeatInterval(int workerHeartbeatInterval) { this.workerHeartbeatInterval = workerHeartbeatInterval; } public int getWorkerFetchTaskNum() { return workerFetchTaskNum; } public void setWorkerFetchTaskNum(int workerFetchTaskNum) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/config/WorkerConfig.java
this.workerFetchTaskNum = workerFetchTaskNum; } public double getWorkerReservedMemory() { return workerReservedMemory; } public void setWorkerReservedMemory(double workerReservedMemory) { this.workerReservedMemory = workerReservedMemory; } public int getWorkerMaxCpuloadAvg() { if (workerMaxCpuloadAvg == -1) { return Constants.DEFAULT_WORKER_CPU_LOAD; } return workerMaxCpuloadAvg; } public void setWorkerMaxCpuloadAvg(int workerMaxCpuloadAvg) { this.workerMaxCpuloadAvg = workerMaxCpuloadAvg; } public int getHostWeight() { return hostWeight; } public void setHostWeight(int hostWeight) { this.hostWeight = hostWeight; } public String getAlertListenHost() { return alertListenHost; } public void setAlertListenHost(String alertListenHost) { this.alertListenHost = alertListenHost; } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.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.worker.processor; import org.apache.dolphinscheduler.common.enums.Event; import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.enums.TaskType;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
import org.apache.dolphinscheduler.common.utils.DateUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.NetUtils; import org.apache.dolphinscheduler.common.utils.Preconditions; import org.apache.dolphinscheduler.remote.command.Command; import org.apache.dolphinscheduler.remote.command.CommandType; import org.apache.dolphinscheduler.remote.command.TaskExecuteAckCommand; import org.apache.dolphinscheduler.remote.command.TaskExecuteRequestCommand; import org.apache.dolphinscheduler.remote.processor.NettyRequestProcessor; import org.apache.dolphinscheduler.server.entity.TaskExecutionContext; import org.apache.dolphinscheduler.server.utils.LogUtils; import org.apache.dolphinscheduler.server.worker.cache.ResponceCache; import org.apache.dolphinscheduler.server.worker.cache.TaskExecutionContextCacheManager; import org.apache.dolphinscheduler.server.worker.cache.impl.TaskExecutionContextCacheManagerImpl; import org.apache.dolphinscheduler.server.worker.config.WorkerConfig; import org.apache.dolphinscheduler.server.worker.runner.TaskExecuteThread; import org.apache.dolphinscheduler.server.worker.runner.WorkerManagerThread; import org.apache.dolphinscheduler.service.alert.AlertClientService; import org.apache.dolphinscheduler.service.bean.SpringApplicationContext; import java.util.Date; import java.util.Optional; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import io.netty.channel.Channel; /** * worker request processor */ public class TaskExecuteProcessor implements NettyRequestProcessor {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
private static final Logger logger = LoggerFactory.getLogger(TaskExecuteProcessor.class); /** * worker config */ private final WorkerConfig workerConfig; /** * task callback service */ private final TaskCallbackService taskCallbackService; /** * alert client service */ private AlertClientService alertClientService; /** * taskExecutionContextCacheManager */ private final TaskExecutionContextCacheManager taskExecutionContextCacheManager; /* * task execute manager
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
*/ private final WorkerManagerThread workerManager; public TaskExecuteProcessor() { this.taskCallbackService = SpringApplicationContext.getBean(TaskCallbackService.class); this.workerConfig = SpringApplicationContext.getBean(WorkerConfig.class); this.taskExecutionContextCacheManager = SpringApplicationContext.getBean(TaskExecutionContextCacheManagerImpl.class); this.workerManager = SpringApplicationContext.getBean(WorkerManagerThread.class); } /** * Pre-cache task to avoid extreme situations when kill task. There is no such task in the cache * * @param taskExecutionContext task */ private void setTaskCache(TaskExecutionContext taskExecutionContext) { TaskExecutionContext preTaskCache = new TaskExecutionContext(); preTaskCache.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); taskExecutionContextCacheManager.cacheTaskExecutionContext(preTaskCache); } public TaskExecuteProcessor(AlertClientService alertClientService) { this(); this.alertClientService = alertClientService; } @Override public void process(Channel channel, Command command) { Preconditions.checkArgument(CommandType.TASK_EXECUTE_REQUEST == command.getType(), String.format("invalid command type : %s", command.getType())); TaskExecuteRequestCommand taskRequestCommand = JSONUtils.parseObject( command.getBody(), TaskExecuteRequestCommand.class); logger.info("received command : {}", taskRequestCommand); if (taskRequestCommand == null) {
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
logger.error("task execute request command is null"); return; } String contextJson = taskRequestCommand.getTaskExecutionContext(); TaskExecutionContext taskExecutionContext = JSONUtils.parseObject(contextJson, TaskExecutionContext.class); if (taskExecutionContext == null) { logger.error("task execution context is null"); return; } setTaskCache(taskExecutionContext); Logger taskLogger = LoggerFactory.getLogger(LoggerUtils.buildTaskId(LoggerUtils.TASK_LOGGER_INFO_PREFIX, taskExecutionContext.getProcessDefineId(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId())); taskExecutionContext.setHost(NetUtils.getAddr(workerConfig.getListenPort())); taskExecutionContext.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext)); String execLocalPath = getExecLocalPath(taskExecutionContext); logger.info("task instance local execute path : {} ", execLocalPath); taskExecutionContext.setExecutePath(execLocalPath); FileUtils.taskLoggerThreadLocal.set(taskLogger); try { FileUtils.createWorkDirIfAbsent(execLocalPath); } catch (Throwable ex) { String errorLog = String.format("create execLocalPath : %s", execLocalPath); LoggerUtils.logError(Optional.of(logger), errorLog, ex); LoggerUtils.logError(Optional.ofNullable(taskLogger), errorLog, ex); taskExecutionContextCacheManager.removeByTaskInstanceId(taskExecutionContext.getTaskInstanceId()); }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
FileUtils.taskLoggerThreadLocal.remove(); taskCallbackService.addRemoteChannel(taskExecutionContext.getTaskInstanceId(), new NettyRemoteChannel(channel, command.getOpaque())); long remainTime = DateUtils.getRemainTime(taskExecutionContext.getFirstSubmitTime(), taskExecutionContext.getDelayTime() * 60L); if (remainTime > 0) { logger.info("delay the execution of task instance {}, delay time: {} s", taskExecutionContext.getTaskInstanceId(), remainTime); taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.DELAY_EXECUTION); taskExecutionContext.setStartTime(null); } else { taskExecutionContext.setCurrentExecutionStatus(ExecutionStatus.RUNNING_EXECUTION); taskExecutionContext.setStartTime(new Date()); } this.doAck(taskExecutionContext); if (!workerManager.offer(new TaskExecuteThread(taskExecutionContext, taskCallbackService, taskLogger, alertClientService))) { logger.info("submit task to manager error, queue is full, queue size is {}", workerManager.getQueueSize()); } } private void doAck(TaskExecutionContext taskExecutionContext) { TaskExecuteAckCommand ackCommand = buildAckCommand(taskExecutionContext); ResponceCache.get().cache(taskExecutionContext.getTaskInstanceId(), ackCommand.convert2Command(), Event.ACK); taskCallbackService.sendAck(taskExecutionContext.getTaskInstanceId(), ackCommand.convert2Command()); } /** * build ack command * * @param taskExecutionContext taskExecutionContext * @return TaskExecuteAckCommand
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
4,995
[Bug][api] select an existing tenant, the workflow fails to run, indicating that the tenant does not exist
![image](https://user-images.githubusercontent.com/55787491/110239702-40d3d580-7f83-11eb-8cb9-14f0110ac478.png) ![image](https://user-images.githubusercontent.com/55787491/110239708-47fae380-7f83-11eb-8c43-5435143e5c7b.png) **Which version of Dolphin Scheduler:** -[dev]
https://github.com/apache/dolphinscheduler/issues/4995
https://github.com/apache/dolphinscheduler/pull/5007
29d42fd92d6720a8a0641e37923c6e6f38a5ae85
f94cfc620dfd0c51010a49134a073e3848c0bd7e
"2021-03-07T12:25:55Z"
java
"2021-03-18T10:34:42Z"
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/processor/TaskExecuteProcessor.java
*/ private TaskExecuteAckCommand buildAckCommand(TaskExecutionContext taskExecutionContext) { TaskExecuteAckCommand ackCommand = new TaskExecuteAckCommand(); ackCommand.setTaskInstanceId(taskExecutionContext.getTaskInstanceId()); ackCommand.setStatus(taskExecutionContext.getCurrentExecutionStatus().getCode()); ackCommand.setLogPath(LogUtils.getTaskLogPath(taskExecutionContext)); ackCommand.setHost(taskExecutionContext.getHost()); ackCommand.setStartTime(taskExecutionContext.getStartTime()); if (taskExecutionContext.getTaskType().equals(TaskType.SQL.name()) || taskExecutionContext.getTaskType().equals(TaskType.PROCEDURE.name())) { ackCommand.setExecutePath(null); } else { ackCommand.setExecutePath(taskExecutionContext.getExecutePath()); } taskExecutionContext.setLogPath(ackCommand.getLogPath()); return ackCommand; } /** * get execute local path * * @param taskExecutionContext taskExecutionContext * @return execute local path */ private String getExecLocalPath(TaskExecutionContext taskExecutionContext) { return FileUtils.getProcessExecDir(taskExecutionContext.getProjectId(), taskExecutionContext.getProcessDefineId(), taskExecutionContext.getProcessInstanceId(), taskExecutionContext.getTaskInstanceId()); } }
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.dolphinscheduler.api.service.impl; import static org.apache.dolphinscheduler.common.Constants.ALIAS; import static org.apache.dolphinscheduler.common.Constants.CONTENT; import static org.apache.dolphinscheduler.common.Constants.JAR; import org.apache.dolphinscheduler.api.dto.resources.ResourceComponent; import org.apache.dolphinscheduler.api.dto.resources.filter.ResourceFilter; import org.apache.dolphinscheduler.api.dto.resources.visitor.ResourceTreeVisitor; import org.apache.dolphinscheduler.api.dto.resources.visitor.Visitor; import org.apache.dolphinscheduler.api.enums.Status; import org.apache.dolphinscheduler.api.exceptions.ServiceException; import org.apache.dolphinscheduler.api.service.ResourcesService; import org.apache.dolphinscheduler.api.utils.PageInfo;
closed
apache/dolphinscheduler
https://github.com/apache/dolphinscheduler
5,103
[Bug][Resource] The file name of File and UDF resource not changed and cannot re-upload after renaming name
**To Reproduce** Steps to reproduce the behavior, for example: 1. Go to 'File Manage' 2. Upload a file 3. Rename the file 4. See error (picture 1) 5. The same error also occurs in 'UDF Resources' (picture 2) 6. In 1.3.x version, if the renamed file is re-uploaded, 'resource already exists' error occurs (picture 3) **Expected behavior** Bug fixed. **Screenshots** In **File Manage**: (picture 1) ![image](https://user-images.githubusercontent.com/4902714/111659876-85dfed80-8848-11eb-8fa1-83dc95e816c8.png) In *UDF Resources*: (picture 2) ![image](https://user-images.githubusercontent.com/4902714/111659982-9e500800-8848-11eb-8718-3b9fc4b4660d.png) In **File Manage** to **Re-upload**: (picture 3) ![image](https://user-images.githubusercontent.com/4902714/111734181-8f06a400-88b4-11eb-8340-ed4ead79c97c.png) **Which version of Dolphin Scheduler:** -[1.3.x] -[dev]
https://github.com/apache/dolphinscheduler/issues/5103
https://github.com/apache/dolphinscheduler/pull/5107
91c29e6ca35b6ca81172f8b8c4ce3191d094852f
4a6e8b7afac5c56392ca74de008ef5f1319a3be6
"2021-03-18T16:20:49Z"
java
"2021-03-19T06:51:12Z"
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ResourcesServiceImpl.java
import org.apache.dolphinscheduler.api.utils.RegexUtils; import org.apache.dolphinscheduler.api.utils.Result; import org.apache.dolphinscheduler.common.Constants; import org.apache.dolphinscheduler.common.enums.ProgramType; import org.apache.dolphinscheduler.common.enums.ResourceType; import org.apache.dolphinscheduler.common.utils.BooleanUtils; import org.apache.dolphinscheduler.common.utils.CollectionUtils; import org.apache.dolphinscheduler.common.utils.FileUtils; import org.apache.dolphinscheduler.common.utils.HadoopUtils; import org.apache.dolphinscheduler.common.utils.JSONUtils; import org.apache.dolphinscheduler.common.utils.PropertyUtils; import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.Resource; import org.apache.dolphinscheduler.dao.entity.ResourcesUser; import org.apache.dolphinscheduler.dao.entity.Tenant; import org.apache.dolphinscheduler.dao.entity.UdfFunc; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceMapper; import org.apache.dolphinscheduler.dao.mapper.ResourceUserMapper; import org.apache.dolphinscheduler.dao.mapper.TenantMapper; import org.apache.dolphinscheduler.dao.mapper.UdfFuncMapper; import org.apache.dolphinscheduler.dao.mapper.UserMapper; import org.apache.dolphinscheduler.dao.utils.ResourceProcessDefinitionUtils; import org.apache.commons.beanutils.BeanMap; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date;