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 | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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());
}
if (taskInstance.getFirstSubmitTime() == null) {
taskInstance.setFirstSubmitTime(taskInstance.getSubmitTime());
}
boolean saveResult = saveTaskInstance(taskInstance);
if (!saveResult) {
return null;
}
return taskInstance; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
/**
* 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
|| state == ExecutionStatus.KILL
) {
return state;
}
if (processInstanceState == ExecutionStatus.READY_PAUSE) {
state = ExecutionStatus.PAUSE;
} else if (processInstanceState == ExecutionStatus.READY_STOP |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | || !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) {
if (task.getState() == ExecutionStatus.FAILURE) {
return false;
}
}
return true;
}
/**
* create a new process instance
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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);
}
}
/**
* insert or update command
*
* @param command command
* @return save command result
*/
public int saveCommand(Command command) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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
*
* @param taskInstance taskInstance
* @return create task instance result
*/
public boolean createTaskInstance(TaskInstance taskInstance) {
int count = taskInstanceMapper.insert(taskInstance);
return count > 0;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * 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
* @return task intance
*/
public TaskInstance findTaskInstanceById(Integer taskId) {
return taskInstanceMapper.selectById(taskId);
}
/**
* package task instance,associate processInstance and processDefine
*
* @param taskInstId taskInstId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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
* @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 |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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) {
return processInstanceMapMapper.updateById(processInstanceMap);
}
/**
* create work process instance map
*
* @param processInstanceMap processInstanceMap
* @return create process instance result
*/
public int createWorkProcessInstanceMap(ProcessInstanceMap processInstanceMap) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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
*/
public int deleteWorkProcessMapByParentId(int parentWorkProcessId) {
return processInstanceMapMapper.deleteByParentProcessId(parentWorkProcessId);
}
/**
* find sub process instance
*
* @param parentProcessId parentProcessId
* @param parentTaskId parentTaskId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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) {
return processInstance;
}
processInstance = findProcessInstanceById(processInstanceMap.getParentProcessInstanceId());
return processInstance;
}
/**
* change task state
*
* @param state state |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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
* @return update process instance result
*/
public int updateProcessInstance(ProcessInstance processInstance) {
return processInstanceMapper.updateById(processInstance);
}
/**
* update the process instance
*
* @param processInstanceId processInstanceId |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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;
}
/**
* change task state
*
* @param state state
* @param endTime endTime
* @param taskInstId taskInstId
* @param varPool varPool
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | public void changeTaskState(TaskInstance taskInstance, ExecutionStatus state,
Date endTime,
int processId,
String appIds,
int taskInstId,
String varPool) {
taskInstance.setPid(processId);
taskInstance.setAppLink(appIds);
taskInstance.setState(state);
taskInstance.setEndTime(endTime);
taskInstance.setVarPool(varPool);
saveTaskInstance(taskInstance);
}
/**
* 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());
for (Integer intVar : intList) {
result.add(String.valueOf(intVar));
}
return result;
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * 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) {
return processInstanceMapper.queryByHostAndStatus(host, stateArray);
}
/**
* process need failover process instance
*
* @param processInstance processInstance |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
@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);
}
/**
* find data source by id
*
* @param id id
* @return datasource
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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) {
return processInstanceMapper.selectById(taskInstance.getProcessInstanceId());
}
return null;
}
/**
* find udf function list by id list string |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | *
* @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
*/
public List<Schedule> selectAllByProcessDefineId(int[] ids) {
return scheduleMapper.selectAllByProcessDefineArray(
ids);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * 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) {
logger.warn("ids[] is empty!is invalid!");
return cycleDependencyList;
}
if (scheduledFireTime == null) {
logger.warn("scheduledFireTime is null!is invalid!");
return cycleDependencyList; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | }
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);
break;
case MONTH:
calendar.add(Calendar.MONTH, -13);
break;
default:
String cycleName = cycleEnum.name(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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
*/
public ProcessInstance findLastSchedulerProcessInterval(int definitionId, DateInterval dateInterval) {
return processInstanceMapper.queryLastSchedulerProcess(definitionId,
dateInterval.getStartTime(),
dateInterval.getEndTime());
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * 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);
}
/**
* query user queue by process instance id
*
* @param processInstanceId processInstanceId
* @return queue |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | */
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
*
* @param taskInstance taskInstance
* @return workerGroupId
*/
public String getTaskWorkerGroup(TaskInstance taskInstance) {
String workerGroup = taskInstance.getWorkerGroup(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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) {
createProjects.addAll(authedProjects);
}
return createProjects;
}
/**
* get have perm project ids |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | *
* @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:
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()); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | 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) {
return userMapper.selectById(userId);
}
/**
* get resource by resoruce id
*
* @param resoruceId resource id |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java | * @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",
definition.getId(),
processInstanceById.getId(),
taskInstance.getId());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.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.service.process;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_RECOVER_PROCESS_ID_STRING;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_START_PARAMS;
import static org.apache.dolphinscheduler.common.Constants.CMD_PARAM_SUB_PROCESS_DEFINE_ID;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.Command;
import org.apache.dolphinscheduler.dao.entity.ProcessDefinition; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | import org.apache.dolphinscheduler.dao.entity.ProcessInstance;
import org.apache.dolphinscheduler.dao.entity.ProcessInstanceMap;
import org.apache.dolphinscheduler.dao.entity.TaskInstance;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.CommandMapper;
import org.apache.dolphinscheduler.dao.mapper.ErrorCommandMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessDefinitionMapper;
import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.TaskInstanceMapper;
import org.apache.dolphinscheduler.dao.mapper.UserMapper;
import org.apache.dolphinscheduler.service.quartz.cron.CronUtilsTest;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.databind.JsonNode;
/**
* process service test
*/
@RunWith(MockitoJUnitRunner.class) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | public class ProcessServiceTest {
private static final Logger logger = LoggerFactory.getLogger(CronUtilsTest.class);
@InjectMocks
private ProcessService processService;
@Mock
private CommandMapper commandMapper;
@Mock
private ErrorCommandMapper errorCommandMapper;
@Mock
private ProcessDefinitionMapper processDefineMapper;
@Mock
private ProcessInstanceMapper processInstanceMapper;
@Mock
private UserMapper userMapper;
@Mock
TaskInstanceMapper taskInstanceMapper;
@Test
public void testCreateSubCommand() {
ProcessService processService = new ProcessService();
ProcessInstance parentInstance = new ProcessInstance();
parentInstance.setProcessDefinitionId(1); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | parentInstance.setWarningType(WarningType.SUCCESS);
parentInstance.setWarningGroupId(0);
TaskInstance task = new TaskInstance();
task.setTaskJson("{\"params\":{\"processDefinitionId\":100}}");
task.setId(10);
ProcessInstance childInstance = null;
ProcessInstanceMap instanceMap = new ProcessInstanceMap();
instanceMap.setParentProcessInstanceId(1);
instanceMap.setParentTaskInstanceId(10);
Command command = null;
parentInstance.setHistoryCmd("START_PROCESS");
parentInstance.setCommandType(CommandType.START_PROCESS);
command = processService.createSubProcessCommand(
parentInstance, childInstance, instanceMap, task
);
Assert.assertEquals(CommandType.START_PROCESS, command.getCommandType());
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS");
command = processService.createSubProcessCommand(
parentInstance, childInstance, instanceMap, task
);
Assert.assertEquals(CommandType.START_PROCESS, command.getCommandType());
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
parentInstance.setHistoryCmd("SCHEDULER,START_FAILURE_TASK_PROCESS");
command = processService.createSubProcessCommand(
parentInstance, childInstance, instanceMap, task
); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | Assert.assertEquals(CommandType.SCHEDULER, command.getCommandType());
String startString = "2020-01-01 00:00:00";
String endString = "2020-01-10 00:00:00";
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
parentInstance.setHistoryCmd("COMPLEMENT_DATA,START_FAILURE_TASK_PROCESS");
Map<String, String> complementMap = new HashMap<>();
complementMap.put(Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE, startString);
complementMap.put(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE, endString);
parentInstance.setCommandParam(JSONUtils.toJsonString(complementMap));
command = processService.createSubProcessCommand(
parentInstance, childInstance, instanceMap, task
);
Assert.assertEquals(CommandType.COMPLEMENT_DATA, command.getCommandType());
JsonNode complementDate = JSONUtils.parseObject(command.getCommandParam());
Date start = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_START_DATE).asText());
Date end = DateUtils.stringToDate(complementDate.get(Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE).asText());
Assert.assertEquals(startString, DateUtils.dateToString(start));
Assert.assertEquals(endString, DateUtils.dateToString(end));
childInstance = new ProcessInstance();
parentInstance.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
parentInstance.setHistoryCmd("START_PROCESS,START_FAILURE_TASK_PROCESS");
command = processService.createSubProcessCommand(
parentInstance, childInstance, instanceMap, task
);
Assert.assertEquals(CommandType.START_FAILURE_TASK_PROCESS, command.getCommandType());
}
@Test
public void testVerifyIsNeedCreateCommand() { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | List<Command> commands = new ArrayList<>();
Command command = new Command();
command.setCommandType(CommandType.REPEAT_RUNNING);
command.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"111\"}");
commands.add(command);
Mockito.when(commandMapper.selectList(null)).thenReturn(commands);
Assert.assertFalse(processService.verifyIsNeedCreateCommand(command));
Command command1 = new Command();
command1.setCommandType(CommandType.REPEAT_RUNNING);
command1.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"222\"}");
Assert.assertTrue(processService.verifyIsNeedCreateCommand(command1));
Command command2 = new Command();
command2.setCommandType(CommandType.PAUSE);
Assert.assertTrue(processService.verifyIsNeedCreateCommand(command2));
}
@Test
public void testCreateRecoveryWaitingThreadCommand() {
int id = 123;
Mockito.when(commandMapper.deleteById(id)).thenReturn(1);
ProcessInstance subProcessInstance = new ProcessInstance();
subProcessInstance.setIsSubProcess(Flag.YES);
Command originCommand = new Command();
originCommand.setId(id);
processService.createRecoveryWaitingThreadCommand(originCommand, subProcessInstance);
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(111);
processService.createRecoveryWaitingThreadCommand(null, subProcessInstance);
Command recoverCommand = new Command();
recoverCommand.setCommandType(CommandType.RECOVER_WAITTING_THREAD);
processService.createRecoveryWaitingThreadCommand(recoverCommand, subProcessInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | Command repeatRunningCommand = new Command();
recoverCommand.setCommandType(CommandType.REPEAT_RUNNING);
processService.createRecoveryWaitingThreadCommand(repeatRunningCommand, subProcessInstance);
ProcessInstance subProcessInstance2 = new ProcessInstance();
subProcessInstance2.setId(111);
subProcessInstance2.setIsSubProcess(Flag.NO);
processService.createRecoveryWaitingThreadCommand(repeatRunningCommand, subProcessInstance2);
}
@Test
public void testHandleCommand() {
String host = "127.0.0.1";
int validThreadNum = 1;
Command command = new Command();
command.setProcessDefinitionId(222);
command.setCommandType(CommandType.REPEAT_RUNNING);
command.setCommandParam("{\"" + CMD_PARAM_RECOVER_PROCESS_ID_STRING + "\":\"111\",\""
+ CMD_PARAM_SUB_PROCESS_DEFINE_ID + "\":\"222\"}");
Mockito.when(processDefineMapper.selectById(command.getProcessDefinitionId())).thenReturn(null);
Assert.assertNull(processService.handleCommand(logger, host, validThreadNum, command));
Command command1 = new Command();
command1.setProcessDefinitionId(123);
command1.setCommandParam("{\"ProcessInstanceId\":222}");
command1.setCommandType(CommandType.START_PROCESS);
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(123);
processDefinition.setName("test");
processDefinition.setVersion(1);
processDefinition.setProcessDefinitionJson("{\"globalParams\":[{\"prop\":\"startParam1\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"\"}],\"tasks\":[{\"conditionResult\":" |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | + "{\"failedNode\":[\"\"],\"successNode\":[\"\"]},\"delayTime\":\"0\",\"dependence\":{}"
+ ",\"description\":\"\",\"id\":\"tasks-3011\",\"maxRetryTimes\":\"0\",\"name\":\"tsssss\""
+ ",\"params\":{\"localParams\":[],\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[]}"
+ ",\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\",\"taskInstancePriority\":\"MEDIUM\""
+ ",\"timeout\":{\"enable\":false,\"interval\":null,\"strategy\":\"\"},\"type\":\"SHELL\""
+ ",\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],\"tenantId\":4,\"timeout\":0}");
processDefinition.setGlobalParams("[{\"prop\":\"startParam1\",\"direct\":\"IN\",\"type\":\"VARCHAR\",\"value\":\"\"}]");
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(222);
Mockito.when(processDefineMapper.selectById(command1.getProcessDefinitionId())).thenReturn(processDefinition);
Mockito.when(processInstanceMapper.queryDetailById(222)).thenReturn(processInstance);
Assert.assertNotNull(processService.handleCommand(logger, host, validThreadNum, command1));
Command command2 = new Command();
command2.setCommandParam("{\"ProcessInstanceId\":222,\"StartNodeIdList\":\"n1,n2\"}");
command2.setProcessDefinitionId(123);
command2.setCommandType(CommandType.RECOVER_SUSPENDED_PROCESS);
Assert.assertNotNull(processService.handleCommand(logger, host, validThreadNum, command2));
Command command3 = new Command();
command3.setProcessDefinitionId(123);
command3.setCommandParam("{\"WaitingThreadInstanceId\":222}");
command3.setCommandType(CommandType.START_FAILURE_TASK_PROCESS);
Assert.assertNotNull(processService.handleCommand(logger, host, validThreadNum, command3));
Command command4 = new Command();
command4.setProcessDefinitionId(123);
command4.setCommandParam("{\"WaitingThreadInstanceId\":222,\"StartNodeIdList\":\"n1,n2\"}");
command4.setCommandType(CommandType.REPEAT_RUNNING);
Assert.assertNotNull(processService.handleCommand(logger, host, validThreadNum, command4));
Command command5 = new Command();
command5.setProcessDefinitionId(123);
HashMap<String, String> startParams = new HashMap<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | startParams.put("startParam1", "testStartParam1");
HashMap<String, String> commandParams = new HashMap<>();
commandParams.put(CMD_PARAM_START_PARAMS, JSONUtils.toJsonString(startParams));
command5.setCommandParam(JSONUtils.toJsonString(commandParams));
command5.setCommandType(CommandType.START_PROCESS);
ProcessInstance processInstance1 = processService.handleCommand(logger, host, validThreadNum, command5);
Assert.assertTrue(processInstance1.getGlobalParams().contains("\"testStartParam1\""));
}
@Test
public void testGetUserById() {
User user = new User();
user.setId(123);
Mockito.when(userMapper.selectById(123)).thenReturn(user);
Assert.assertEquals(user, processService.getUserById(123));
}
@Test
public void testFormatTaskAppId() {
TaskInstance taskInstance = new TaskInstance();
taskInstance.setId(333);
taskInstance.setProcessDefinitionId(111);
taskInstance.setProcessInstanceId(222);
Mockito.when(processService.findProcessDefineById(taskInstance.getProcessDefinitionId())).thenReturn(null);
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())).thenReturn(null);
Assert.assertEquals("", processService.formatTaskAppId(taskInstance));
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setId(111);
ProcessInstance processInstance = new ProcessInstance();
processInstance.setId(222);
Mockito.when(processService.findProcessDefineById(taskInstance.getProcessDefinitionId())).thenReturn(processDefinition);
Mockito.when(processService.findProcessInstanceById(taskInstance.getProcessInstanceId())).thenReturn(processInstance); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 2,101 | [BUG] After renaming the branch name, the name of Branch Flow does not change | 更改任务名称后,分支流转的名称还是更改前的任务名称

**Which version of Dolphin Scheduler:**
-[1.2.0_release]
| https://github.com/apache/dolphinscheduler/issues/2101 | https://github.com/apache/dolphinscheduler/pull/4555 | cfd9db5555b3d8f9f33f25a9272c8741115a9336 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | "2020-03-06T09:35:19Z" | java | "2021-02-02T08:07:37Z" | dolphinscheduler-service/src/test/java/org/apache/dolphinscheduler/service/process/ProcessServiceTest.java | Assert.assertEquals("111_222_333", processService.formatTaskAppId(taskInstance));
}
@Test
public void testRecurseFindSubProcessId() {
ProcessDefinition processDefinition = new ProcessDefinition();
processDefinition.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"conditionResult\":"
+ "{\"failedNode\":[\"\"],\"successNode\":[\"\"]},\"delayTime\":\"0\""
+ ",\"dependence\":{},\"description\":\"\",\"id\":\"tasks-76544\""
+ ",\"maxRetryTimes\":\"0\",\"name\":\"test\",\"params\":{\"localParams\":[],"
+ "\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[],\"processDefinitionId\""
+ ":\"222\"},\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\","
+ "\"taskInstancePriority\":\"MEDIUM\",\"timeout\":{\"enable\":false,\"interval\":"
+ "null,\"strategy\":\"\"},\"type\":\"SHELL\",\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],"
+ "\"tenantId\":4,\"timeout\":0}");
int parentId = 111;
List<Integer> ids = new ArrayList<>();
ProcessDefinition processDefinition2 = new ProcessDefinition();
processDefinition2.setProcessDefinitionJson("{\"globalParams\":[],\"tasks\":[{\"conditionResult\""
+ ":{\"failedNode\":[\"\"],\"successNode\":[\"\"]},\"delayTime\":\"0\",\"dependence\":{},"
+ "\"description\":\"\",\"id\":\"tasks-76544\",\"maxRetryTimes\":\"0\",\"name\":\"test\","
+ "\"params\":{\"localParams\":[],\"rawScript\":\"echo \\\"123123\\\"\",\"resourceList\":[]},"
+ "\"preTasks\":[],\"retryInterval\":\"1\",\"runFlag\":\"NORMAL\",\"taskInstancePriority\":"
+ "\"MEDIUM\",\"timeout\":{\"enable\":false,\"interval\":null,\"strategy\":\"\"},\"type\":"
+ "\"SHELL\",\"waitStartTimeout\":{},\"workerGroup\":\"default\"}],\"tenantId\":4,\"timeout\":0}");
Mockito.when(processDefineMapper.selectById(parentId)).thenReturn(processDefinition);
Mockito.when(processDefineMapper.selectById(222)).thenReturn(processDefinition2);
processService.recurseFindSubProcessId(parentId, ids);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.email;
/**
* mail plugin params json use
*/
public class MailParamsConstants { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/main/java/org/apache/dolphinscheduler/plugin/alert/email/MailParamsConstants.java | private MailParamsConstants() {
throw new IllegalStateException("Utility class");
}
public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERS = "$t('receivers')";
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS = "receivers";
public static final String PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "$t('receiverCcs')";
public static final String NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS = "receiverCcs";
public static final String MAIL_PROTOCOL = "transport.protocol";
public static final String NAME_MAIL_PROTOCOL = "protocol";
public static final String MAIL_SMTP_HOST = "smtp.host";
public static final String NAME_MAIL_SMTP_HOST = "serverHost";
public static final String MAIL_SMTP_PORT = "smtp.port";
public static final String NAME_MAIL_SMTP_PORT = "serverPort";
public static final String MAIL_SENDER = "sender";
public static final String NAME_MAIL_SENDER = "sender";
public static final String MAIL_SMTP_AUTH = "smtp.auth";
public static final String NAME_MAIL_SMTP_AUTH = "enableSmtpAuth";
public static final String MAIL_USER = "user";
public static final String NAME_MAIL_USER = "user";
public static final String MAIL_PASSWD = "passwd";
public static final String NAME_MAIL_PASSWD = "passwd";
public static final String MAIL_SMTP_STARTTLS_ENABLE = "smtp.starttls.enable";
public static final String NAME_MAIL_SMTP_STARTTLS_ENABLE = "starttlsEnable";
public static final String MAIL_SMTP_SSL_ENABLE = "smtp.ssl.enable";
public static final String NAME_MAIL_SMTP_SSL_ENABLE = "sslEnable";
public static final String MAIL_SMTP_SSL_TRUST = "smtp.ssl.trust";
public static final String NAME_MAIL_SMTP_SSL_TRUST = "smtpSslTrust";
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.plugin.alert.email;
import org.apache.dolphinscheduler.plugin.alert.email.template.AlertTemplate;
import org.apache.dolphinscheduler.plugin.alert.email.template.DefaultHTMLTemplate;
import org.apache.dolphinscheduler.spi.alert.AlertConstants;
import org.apache.dolphinscheduler.spi.alert.ShowType;
import org.apache.dolphinscheduler.spi.utils.JSONUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java | import java.util.List;
import java.util.Map;
import org.junit.BeforeClass;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*/
public class MailUtilsTest {
private static final Logger logger = LoggerFactory.getLogger(MailUtilsTest.class);
private static Map<String, String> emailConfig = new HashMap<>();
private static AlertTemplate alertTemplate;
static MailSender mailSender;
@BeforeClass
public static void initEmailConfig() {
emailConfig.put(MailParamsConstants.NAME_MAIL_PROTOCOL, "smtp");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_HOST, "xxx.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_PORT, "25");
emailConfig.put(MailParamsConstants.NAME_MAIL_SENDER, "xxx1.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_USER, "xxx2.xxx.com");
emailConfig.put(MailParamsConstants.NAME_MAIL_PASSWD, "111111");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_STARTTLS_ENABLE, "true");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_ENABLE, "false");
emailConfig.put(MailParamsConstants.NAME_MAIL_SMTP_SSL_TRUST, "false");
emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERS, "[email protected]");
emailConfig.put(MailParamsConstants.NAME_PLUGIN_DEFAULT_EMAIL_RECEIVERCCS, "[email protected]");
emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TEXT.getDescp());
alertTemplate = new DefaultHTMLTemplate();
mailSender = new MailSender(emailConfig);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java | @Test
public void testSendMails() {
String content = "[\"id:69\","
+ "\"name:UserBehavior-0--1193959466\","
+ "\"Job name: Start workflow\","
+ "\"State: SUCCESS\","
+ "\"Recovery:NO\","
+ "\"Run time: 1\","
+ "\"Start time: 2018-08-06 10:31:34.0\","
+ "\"End time: 2018-08-06 10:31:49.0\","
+ "\"Host: 192.168.xx.xx\","
+ "\"Notify group :4\"]";
mailSender.sendMails(
"Mysql Exception",
content);
}
public String list2String() {
LinkedHashMap<String, Object> map1 = new LinkedHashMap<>();
map1.put("mysql service name", "mysql200");
map1.put("mysql address", "192.168.xx.xx");
map1.put("port", "3306");
map1.put("no index of number", "80");
map1.put("database client connections", "190");
LinkedHashMap<String, Object> map2 = new LinkedHashMap<>();
map2.put("mysql service name", "mysql210");
map2.put("mysql address", "192.168.xx.xx");
map2.put("port", "3306");
map2.put("no index of number", "10");
map2.put("database client connections", "90");
List<LinkedHashMap<String, Object>> maps = new ArrayList<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 4,641 | [Bug][Alert] Sending the email to the following server failed :null:null |
**Describe the bug**
Alert-server email alert error, the message is 'Sending the email to the following server failed :null:null'
**Which version of Dolphin Scheduler:**
-[dev]
| https://github.com/apache/dolphinscheduler/issues/4641 | https://github.com/apache/dolphinscheduler/pull/4642 | 14d49bc584685a33e2952573a0cb6e88377ab9f9 | 6df87b89d7b0ec013c5a2bfdfb92fa3ff1496c40 | "2021-02-01T04:50:30Z" | java | "2021-02-03T06:20:16Z" | dolphinscheduler-alert-plugin/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/MailUtilsTest.java | maps.add(0, map1);
maps.add(1, map2);
String mapjson = JSONUtils.toJsonString(maps);
logger.info(mapjson);
return mapjson;
}
@Test
public void testSendTableMail() {
String title = "Mysql Exception";
String content = list2String();
emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TABLE.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails(title, content);
}
@Test
public void testAttachmentFile() throws Exception {
String content = list2String();
emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.ATTACHMENT.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails("gaojing", content);
}
@Test
public void testTableAttachmentFile() throws Exception {
String content = list2String();
emailConfig.put(AlertConstants.SHOW_TYPE, ShowType.TABLEATTACHMENT.getDescp());
mailSender = new MailSender(emailConfig);
mailSender.sendMails("gaojing", content);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.common.utils;
import static org.apache.dolphinscheduler.common.Constants.DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE;
import static java.util.Collections.emptyList;
import org.apache.dolphinscheduler.common.Constants;
import java.io.IOException;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.regex.Pattern;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* NetUtils
*/
public class NetUtils { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$");
private static final String NETWORK_PRIORITY_DEFAULT = "default";
private static final String NETWORK_PRIORITY_INNER = "inner";
private static final String NETWORK_PRIORITY_OUTER = "outer";
private static final Logger logger = LoggerFactory.getLogger(NetUtils.class);
private static InetAddress LOCAL_ADDRESS = null;
private static volatile String HOST_ADDRESS;
private NetUtils() {
throw new UnsupportedOperationException("Construct NetUtils");
}
/**
* get addr like host:port
* @return addr
*/
public static String getAddr(String host, int port) {
return String.format("%s:%d", host, port);
}
/**
* get addr like host:port
* @return addr
*/
public static String getAddr(int port) {
return getAddr(getHost(), port);
}
public static String getHost() {
if (HOST_ADDRESS != null) {
return HOST_ADDRESS;
}
InetAddress address = getLocalAddress();
if (address != null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | HOST_ADDRESS = Constants.KUBERNETES_MODE ? address.getHostName() : address.getHostAddress();
return HOST_ADDRESS;
}
return Constants.KUBERNETES_MODE ? "localhost" : "127.0.0.1";
}
private static InetAddress getLocalAddress() {
if (null != LOCAL_ADDRESS) {
return LOCAL_ADDRESS;
}
return getLocalAddress0();
}
/**
* Find first valid IP from local network card
*
* @return first valid local IP
*/
private static synchronized InetAddress getLocalAddress0() {
if (null != LOCAL_ADDRESS) {
return LOCAL_ADDRESS;
}
InetAddress localAddress = null;
try {
NetworkInterface networkInterface = findNetworkInterface();
if (networkInterface != null) {
Enumeration<InetAddress> addresses = networkInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
Optional<InetAddress> addressOp = toValidAddress(addresses.nextElement());
if (addressOp.isPresent()) {
try {
if (addressOp.get().isReachable(100)) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | LOCAL_ADDRESS = addressOp.get();
return LOCAL_ADDRESS;
}
} catch (IOException e) {
logger.warn("test address id reachable io exception", e);
}
}
}
}
localAddress = InetAddress.getLocalHost();
} catch (UnknownHostException e) {
logger.warn("InetAddress get LocalHost exception", e);
}
Optional<InetAddress> addressOp = toValidAddress(localAddress);
if (addressOp.isPresent()) {
LOCAL_ADDRESS = addressOp.get();
}
return LOCAL_ADDRESS;
}
private static Optional<InetAddress> toValidAddress(InetAddress address) {
if (address instanceof Inet6Address) {
Inet6Address v6Address = (Inet6Address) address;
if (isPreferIPV6Address()) {
return Optional.ofNullable(normalizeV6Address(v6Address));
}
}
if (isValidV4Address(address)) {
return Optional.of(address);
}
return Optional.empty(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | }
private static InetAddress normalizeV6Address(Inet6Address address) {
String addr = address.getHostAddress();
int i = addr.lastIndexOf('%');
if (i > 0) {
try {
return InetAddress.getByName(addr.substring(0, i) + '%' + address.getScopeId());
} catch (UnknownHostException e) {
logger.debug("Unknown IPV6 address: ", e);
}
}
return address;
}
public static boolean isValidV4Address(InetAddress address) {
if (address == null || address.isLoopbackAddress()) {
return false;
}
String name = address.getHostAddress();
return (name != null
&& IP_PATTERN.matcher(name).matches()
&& !address.isAnyLocalAddress()
&& !address.isLoopbackAddress());
}
/**
* Check if an ipv6 address
*
* @return true if it is reachable
*/
private static boolean isPreferIPV6Address() {
return Boolean.getBoolean("java.net.preferIPv6Addresses"); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | }
/**
* Get the suitable {@link NetworkInterface}
*
* @return If no {@link NetworkInterface} is available , return <code>null</code>
*/
private static NetworkInterface findNetworkInterface() {
List<NetworkInterface> validNetworkInterfaces = emptyList();
try {
validNetworkInterfaces = getValidNetworkInterfaces();
} catch (SocketException e) {
logger.warn("ValidNetworkInterfaces exception", e);
}
NetworkInterface result = null;
for (NetworkInterface networkInterface : validNetworkInterfaces) {
if (isSpecifyNetworkInterface(networkInterface)) {
result = networkInterface;
break;
}
}
if (null != result) {
return result;
}
return findAddress(validNetworkInterfaces);
}
/**
* Get the valid {@link NetworkInterface network interfaces}
*
* @throws SocketException SocketException if an I/O error occurs. |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | */
private static List<NetworkInterface> getValidNetworkInterfaces() throws SocketException {
List<NetworkInterface> validNetworkInterfaces = new LinkedList<>();
Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
NetworkInterface networkInterface = interfaces.nextElement();
if (ignoreNetworkInterface(networkInterface)) {
continue;
}
validNetworkInterfaces.add(networkInterface);
}
return validNetworkInterfaces;
}
/**
* @param networkInterface {@link NetworkInterface}
* @return if the specified {@link NetworkInterface} should be ignored, return <code>true</code>
* @throws SocketException SocketException if an I/O error occurs.
*/
public static boolean ignoreNetworkInterface(NetworkInterface networkInterface) throws SocketException {
return networkInterface == null
|| networkInterface.isLoopback()
|| networkInterface.isVirtual()
|| !networkInterface.isUp();
}
private static boolean isSpecifyNetworkInterface(NetworkInterface networkInterface) {
String preferredNetworkInterface = System.getProperty(DOLPHIN_SCHEDULER_PREFERRED_NETWORK_INTERFACE);
return Objects.equals(networkInterface.getDisplayName(), preferredNetworkInterface);
}
private static NetworkInterface findAddress(List<NetworkInterface> validNetworkInterfaces) {
if (validNetworkInterfaces.isEmpty()) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | return null;
}
String networkPriority = PropertyUtils.getString(Constants.NETWORK_PRIORITY_STRATEGY, NETWORK_PRIORITY_DEFAULT);
if (NETWORK_PRIORITY_DEFAULT.equalsIgnoreCase(networkPriority)) {
return findAddressByDefaultPolicy(validNetworkInterfaces);
} else if (NETWORK_PRIORITY_INNER.equalsIgnoreCase(networkPriority)) {
return findInnerAddress(validNetworkInterfaces);
} else if (NETWORK_PRIORITY_OUTER.equalsIgnoreCase(networkPriority)) {
return findOuterAddress(validNetworkInterfaces);
} else {
logger.error("There is no matching network card acquisition policy!");
return null;
}
}
private static NetworkInterface findAddressByDefaultPolicy(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface;
networkInterface = findInnerAddress(validNetworkInterfaces);
if (networkInterface == null) {
networkInterface = findOuterAddress(validNetworkInterfaces);
if (networkInterface == null) {
networkInterface = validNetworkInterfaces.get(0);
}
}
return networkInterface;
}
/**
* Get the Intranet IP
*
* @return If no {@link NetworkInterface} is available , return <code>null</code>
*/ |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/NetUtils.java | private static NetworkInterface findInnerAddress(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface = null;
for (NetworkInterface ni : validNetworkInterfaces) {
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
InetAddress ip = address.nextElement();
if (ip.isSiteLocalAddress()
&& !ip.isLoopbackAddress()) {
networkInterface = ni;
}
}
}
return networkInterface;
}
private static NetworkInterface findOuterAddress(List<NetworkInterface> validNetworkInterfaces) {
NetworkInterface networkInterface = null;
for (NetworkInterface ni : validNetworkInterfaces) {
Enumeration<InetAddress> address = ni.getInetAddresses();
while (address.hasMoreElements()) {
InetAddress ip = address.nextElement();
if (!ip.isSiteLocalAddress()
&& !ip.isLoopbackAddress()) {
networkInterface = ni;
}
}
}
return networkInterface;
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/ChannelUtils.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.remote.utils;
import java.net.InetSocketAddress;
import io.netty.channel.Channel;
/**
* channel utils
*/
public class ChannelUtils {
private ChannelUtils() {
throw new IllegalStateException(ChannelUtils.class.getName());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/ChannelUtils.java | /**
* get local address
*
* @param channel channel
* @return local address
*/
public static String getLocalAddress(Channel channel) {
return ((InetSocketAddress) channel.localAddress()).getAddress().getHostAddress();
}
/**
* get remote address
*
* @param channel channel
* @return remote address
*/
public static String getRemoteAddress(Channel channel) {
return ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
}
/**
* channel to address
*
* @param channel channel
* @return address
*/
public static Host toAddress(Channel channel) {
InetSocketAddress socketAddress = ((InetSocketAddress) channel.remoteAddress());
return new Host(socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryTest.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryTest.java | * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.server.master.registry;
import static org.apache.dolphinscheduler.common.Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH;
import org.apache.dolphinscheduler.remote.utils.Constants;
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
import org.apache.dolphinscheduler.server.registry.ZookeeperRegistryCenter;
import org.apache.dolphinscheduler.server.zk.SpringZKServer;
import org.apache.dolphinscheduler.service.zk.CuratorZookeeperClient;
import org.apache.dolphinscheduler.service.zk.ZookeeperCachedOperator;
import org.apache.dolphinscheduler.service.zk.ZookeeperConfig;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
/**
* master registry test
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = {SpringZKServer.class, MasterRegistry.class, ZookeeperRegistryCenter.class, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,298 | [Bug][k8s]when recreate or upgrade helm release, the host ip changed | **Describe the bug**
When DS was deployed to k8s by helm, if you upgrade the release or recreate the release, the ip of worker server and other server will be changed, so when you try to query the log of history task, you will get empty log.
**To Reproduce**
Steps to reproduce the behavior, for example:
1. deploy the cluster use helm
2. recreate the deployed release or just upgrade
3. query a task which runned before upgrade/recreate
4. no log will show
**Expected behavior**
log should be show
**Screenshots**

**Which version of Dolphin Scheduler:**
-[1.3.1-release]
**Additional context**
**Requirement or improvement**
| https://github.com/apache/dolphinscheduler/issues/3298 | https://github.com/apache/dolphinscheduler/pull/4786 | 23591b71a2859021e9280899b1f1b6ff3b679fbc | 8ebddc1f5bb484a2d7d8e1353b2a8f51fae78ec0 | "2020-07-24T05:00:07Z" | java | "2021-02-18T03:41:58Z" | dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/master/registry/MasterRegistryTest.java | MasterConfig.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, CuratorZookeeperClient.class})
public class MasterRegistryTest {
@Autowired
private MasterRegistry masterRegistry;
@Autowired
private ZookeeperRegistryCenter zookeeperRegistryCenter;
@Autowired
private MasterConfig masterConfig;
@Test
public void testRegistry() throws InterruptedException {
masterRegistry.registry();
String masterPath = zookeeperRegistryCenter.getMasterPath();
TimeUnit.SECONDS.sleep(masterConfig.getMasterHeartbeatInterval() + 2);
String masterNodePath = masterPath + "/" + (Constants.LOCAL_ADDRESS + ":" + masterConfig.getListenPort());
String heartbeat = zookeeperRegistryCenter.getZookeeperCachedOperator().get(masterNodePath);
Assert.assertEquals(HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH, heartbeat.split(",").length);
masterRegistry.unRegistry();
}
@Test
public void testUnRegistry() throws InterruptedException {
masterRegistry.init();
masterRegistry.registry();
TimeUnit.SECONDS.sleep(masterConfig.getMasterHeartbeatInterval() + 2);
masterRegistry.unRegistry();
String masterPath = zookeeperRegistryCenter.getMasterPath();
List<String> childrenKeys = zookeeperRegistryCenter.getZookeeperCachedOperator().getChildrenKeys(masterPath);
Assert.assertTrue(childrenKeys.isEmpty());
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.CHECK_PROCESS_DEFINITION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.EXECUTE_PROCESS_INSTANCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.START_PROCESS_INSTANCE_ERROR;
import org.apache.dolphinscheduler.api.enums.ExecuteType;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ExecutorService;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | import org.apache.dolphinscheduler.common.enums.FailureStrategy;
import org.apache.dolphinscheduler.common.enums.Priority;
import org.apache.dolphinscheduler.common.enums.RunMode;
import org.apache.dolphinscheduler.common.enums.TaskDependType;
import org.apache.dolphinscheduler.common.enums.WarningType;
import org.apache.dolphinscheduler.common.utils.JSONUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.text.ParseException;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import springfox.documentation.annotations.ApiIgnore;
/**
* execute process controller
*/
@Api(tags = "PROCESS_INSTANCE_EXECUTOR_TAG", position = 1) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | @RestController
@RequestMapping("projects/{projectName}/executors")
public class ExecutorController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ExecutorController.class);
@Autowired |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | private ExecutorService execService;
/**
* execute process instance
*
* @param loginUser login user
* @param projectName project name
* @param processDefinitionId process definition id
* @param scheduleTime schedule time
* @param failureStrategy failure strategy
* @param startNodeList start nodes list
* @param taskDependType task depend type
* @param execType execute type
* @param warningType warning type
* @param warningGroupId warning group id
* @param runMode run mode
* @param processInstancePriority process instance priority
* @param workerGroup worker group
* @param timeout timeout
* @return start process result code
*/
@ApiOperation(value = "startProcessInstance", notes = "RUN_PROCESS_INSTANCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "scheduleTime", value = "SCHEDULE_TIME", required = true, dataType = "String"),
@ApiImplicitParam(name = "failureStrategy", value = "FAILURE_STRATEGY", required = true, dataType = "FailureStrategy"),
@ApiImplicitParam(name = "startNodeList", value = "START_NODE_LIST", dataType = "String"),
@ApiImplicitParam(name = "taskDependType", value = "TASK_DEPEND_TYPE", dataType = "TaskDependType"),
@ApiImplicitParam(name = "execType", value = "COMMAND_TYPE", dataType = "CommandType"),
@ApiImplicitParam(name = "warningType", value = "WARNING_TYPE", required = true, dataType = "WarningType"),
@ApiImplicitParam(name = "warningGroupId", value = "WARNING_GROUP_ID", required = true, dataType = "Int", example = "100"), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | @ApiImplicitParam(name = "runMode", value = "RUN_MODE", dataType = "RunMode"),
@ApiImplicitParam(name = "processInstancePriority", value = "PROCESS_INSTANCE_PRIORITY", required = true, dataType = "Priority"),
@ApiImplicitParam(name = "workerGroup", value = "WORKER_GROUP", dataType = "String", example = "default"),
@ApiImplicitParam(name = "timeout", value = "TIMEOUT", dataType = "Int", example = "100"),
})
@PostMapping(value = "start-process-instance")
@ResponseStatus(HttpStatus.OK)
@ApiException(START_PROCESS_INSTANCE_ERROR)
public Result startProcessInstance(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName,
@RequestParam(value = "processDefinitionId") int processDefinitionId,
@RequestParam(value = "scheduleTime", required = false) String scheduleTime,
@RequestParam(value = "failureStrategy", required = true) FailureStrategy failureStrategy,
@RequestParam(value = "startNodeList", required = false) String startNodeList,
@RequestParam(value = "taskDependType", required = false) TaskDependType taskDependType,
@RequestParam(value = "execType", required = false) CommandType execType,
@RequestParam(value = "warningType", required = true) WarningType warningType,
@RequestParam(value = "warningGroupId", required = false) int warningGroupId,
@RequestParam(value = "runMode", required = false) RunMode runMode,
@RequestParam(value = "processInstancePriority", required = false) Priority processInstancePriority,
@RequestParam(value = "workerGroup", required = false, defaultValue = "default") String workerGroup,
@RequestParam(value = "timeout", required = false) Integer timeout,
@RequestParam(value = "startParams", required = false) String startParams) throws ParseException {
logger.info("login user {}, start process instance, project name: {}, process definition id: {}, schedule time: {}, "
+ "failure policy: {}, node name: {}, node dep: {}, notify type: {}, "
+ "notify group id: {}, run mode: {},process instance priority:{}, workerGroup: {}, timeout: {}, startParams: {} ",
loginUser.getUserName(), projectName, processDefinitionId, scheduleTime,
failureStrategy, startNodeList, taskDependType, warningType, workerGroup, runMode, processInstancePriority,
workerGroup, timeout, startParams);
if (timeout == null) { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | timeout = Constants.MAX_TASK_TIMEOUT;
}
Map<String, String> startParamMap = null;
if (startParams != null) {
startParamMap = JSONUtils.toMap(startParams);
}
Map<String, Object> result = execService.execProcessInstance(loginUser, projectName, processDefinitionId, scheduleTime, execType, failureStrategy,
startNodeList, taskDependType, warningType,
warningGroupId, runMode, processInstancePriority, workerGroup, timeout, startParamMap);
return returnDataList(result);
}
/**
* do action to process instance:pause, stop, repeat, recover from pause, recover from stop
*
* @param loginUser login user
* @param projectName project name
* @param processInstanceId process instance id
* @param executeType execute type
* @return execute result code
*/
@ApiOperation(value = "execute", notes = "EXECUTE_ACTION_TO_PROCESS_INSTANCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processInstanceId", value = "PROCESS_INSTANCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "executeType", value = "EXECUTE_TYPE", required = true, dataType = "ExecuteType")
})
@PostMapping(value = "/execute")
@ResponseStatus(HttpStatus.OK)
@ApiException(EXECUTE_PROCESS_INSTANCE_ERROR)
public Result execute(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@ApiParam(name = "projectName", value = "PROJECT_NAME", required = true) @PathVariable String projectName, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ExecutorController.java | @RequestParam("processInstanceId") Integer processInstanceId,
@RequestParam("executeType") ExecuteType executeType
) {
logger.info("execute command, login user: {}, project:{}, process instance id:{}, execute type:{}",
loginUser.getUserName(), projectName, processInstanceId, executeType);
Map<String, Object> result = execService.execute(loginUser, projectName, processInstanceId, executeType);
return returnDataList(result);
}
/**
* check process definition and all of the son process definitions is on line.
*
* @param loginUser login user
* @param processDefinitionId process definition id
* @return check result code
*/
@ApiOperation(value = "startCheckProcessDefinition", notes = "START_CHECK_PROCESS_DEFINITION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "processDefinitionId", value = "PROCESS_DEFINITION_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping(value = "/start-check")
@ResponseStatus(HttpStatus.OK)
@ApiException(CHECK_PROCESS_DEFINITION_ERROR)
public Result startCheckProcessDefinition(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "processDefinitionId") int processDefinitionId) {
logger.info("login user {}, check process definition {}", loginUser.getUserName(), processDefinitionId);
Map<String, Object> result = execService.startCheckByProcessDefinedId(processDefinitionId);
return returnDataList(result);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.dolphinscheduler.api.controller;
import static org.apache.dolphinscheduler.api.enums.Status.AUTHORIZED_FILE_RESOURCE_ERROR; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | import static org.apache.dolphinscheduler.api.enums.Status.AUTHORIZED_UDF_FUNCTION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.AUTHORIZE_RESOURCE_TREE;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_RESOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_RESOURCE_FILE_ON_LINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.CREATE_UDF_FUNCTION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_RESOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DELETE_UDF_FUNCTION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.DOWNLOAD_RESOURCE_FILE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.EDIT_RESOURCE_FILE_ON_LINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_DATASOURCE_BY_TYPE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_RESOURCES_LIST_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_RESOURCES_LIST_PAGING;
import static org.apache.dolphinscheduler.api.enums.Status.QUERY_UDF_FUNCTION_LIST_PAGING_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.RESOURCE_FILE_IS_EMPTY;
import static org.apache.dolphinscheduler.api.enums.Status.RESOURCE_NOT_EXIST;
import static org.apache.dolphinscheduler.api.enums.Status.UNAUTHORIZED_UDF_FUNCTION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_RESOURCE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.UPDATE_UDF_FUNCTION_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VERIFY_UDF_FUNCTION_NAME_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VIEW_RESOURCE_FILE_ON_LINE_ERROR;
import static org.apache.dolphinscheduler.api.enums.Status.VIEW_UDF_FUNCTION_ERROR;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.exceptions.ApiException;
import org.apache.dolphinscheduler.api.service.ResourcesService;
import org.apache.dolphinscheduler.api.service.UdfFuncService;
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; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | import org.apache.dolphinscheduler.common.enums.UdfType;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.annotations.ApiIgnore;
/**
* resources controller
*/
@Api(tags = "RESOURCES_TAG", position = 1) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @RestController
@RequestMapping("resources")
public class ResourcesController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(ResourcesController.class);
@Autowired
private ResourcesService resourceService;
@Autowired
private UdfFuncService udfFuncService;
/**
*
* @param loginUser login user
* @param type type
* @param alias alias
* @param description description
* @param pid parent id
* @param currentDir current directory
* @return create result code
*/
@ApiOperation(value = "createDirctory", notes = "CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"),
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String") |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | })
@PostMapping(value = "/directory/create")
@ApiException(CREATE_RESOURCE_ERROR)
public Result createDirectory(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value = "name") String alias,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "pid") int pid,
@RequestParam(value = "currentDir") String currentDir) {
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}",
loginUser.getUserName(), type, alias, description, pid, currentDir);
return resourceService.createDirectory(loginUser, alias, description, type, pid, currentDir);
}
/**
* create resource
* @param loginUser
* @param type
* @param alias
* @param description
* @param file
* @param pid
* @param currentDir
* @return create result code
*/
@ApiOperation(value = "createResource", notes = "CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"),
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile"), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String")
})
@PostMapping(value = "/create")
@ApiException(CREATE_RESOURCE_ERROR)
public Result createResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value = "name") String alias,
@RequestParam(value = "description", required = false) String description,
@RequestParam("file") MultipartFile file,
@RequestParam(value = "pid") int pid,
@RequestParam(value = "currentDir") String currentDir) {
logger.info("login user {}, create resource, type: {}, resource alias: {}, desc: {}, file: {},{}",
loginUser.getUserName(), type, alias, description, file.getName(), file.getOriginalFilename());
return resourceService.createResource(loginUser, alias, description, type, file, pid, currentDir);
}
/**
* update resource
*
* @param loginUser login user
* @param alias alias
* @param resourceId resource id
* @param type resource type
* @param description description
* @param file resource file
* @return update result code
*/
@ApiOperation(value = "updateResource", notes = "UPDATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"), |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"),
@ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true, dataType = "MultipartFile")
})
@PostMapping(value = "/update")
@ApiException(UPDATE_RESOURCE_ERROR)
public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value = "name") String alias,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "file" ,required = false) MultipartFile file) {
logger.info("login user {}, update resource, type: {}, resource alias: {}, desc: {}, file: {}",
loginUser.getUserName(), type, alias, description, file);
return resourceService.updateResource(loginUser, resourceId, alias, description, type, file);
}
/**
* query resources list
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@ApiOperation(value = "queryResourceList", notes = "QUERY_RESOURCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType")
})
@GetMapping(value = "/list")
@ResponseStatus(HttpStatus.OK) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @ApiException(QUERY_RESOURCES_LIST_ERROR)
public Result queryResourceList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type
) {
logger.info("query resource list, login user:{}, resource type:{}", loginUser.getUserName(), type);
Map<String, Object> result = resourceService.queryResourceList(loginUser, type);
return returnDataList(result);
}
/**
* query resources list paging
*
* @param loginUser login user
* @param type resource type
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return resource list page
*/
@ApiOperation(value = "queryResourceListPaging", notes = "QUERY_RESOURCE_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "int", example = "10"),
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "20")
})
@GetMapping(value = "/list-paging")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_RESOURCES_LIST_PAGING)
public Result queryResourceListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @RequestParam(value = "type") ResourceType type,
@RequestParam(value = "id") int id,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize
) {
logger.info("query resource list, login user:{}, resource type:{}, search value:{}",
loginUser.getUserName(), type, searchVal);
Map<String, Object> result = checkPageParams(pageNo, pageSize);
if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataListPaging(result);
}
searchVal = ParameterUtils.handleEscapes(searchVal);
result = resourceService.queryResourceListPaging(loginUser, id, type, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}
/**
* delete resource
*
* @param loginUser login user
* @param resourceId resource id
* @return delete result code
*/
@ApiOperation(value = "deleteResource", notes = "DELETE_RESOURCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_RESOURCE_ERROR) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | public Result deleteResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId
) throws Exception {
logger.info("login user {}, delete resource id: {}",
loginUser.getUserName(), resourceId);
return resourceService.delete(loginUser, resourceId);
}
/**
* verify resource by alias and type
*
* @param loginUser login user
* @param fullName resource full name
* @param type resource type
* @return true if the resource name not exists, otherwise return false
*/
@ApiOperation(value = "verifyResourceName", notes = "VERIFY_RESOURCE_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String")
})
@GetMapping(value = "/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_RESOURCE_BY_NAME_AND_TYPE_ERROR)
public Result verifyResourceName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "fullName") String fullName,
@RequestParam(value = "type") ResourceType type
) {
logger.info("login user {}, verfiy resource alias: {},resource type: {}",
loginUser.getUserName(), fullName, type);
return resourceService.verifyResourceName(fullName, type, loginUser); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | }
/**
* query resources jar list
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@ApiOperation(value = "queryResourceByProgramType", notes = "QUERY_RESOURCE_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType")
})
@GetMapping(value = "/list/jar")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_RESOURCES_LIST_ERROR)
public Result queryResourceJarList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value = "programType",required = false) ProgramType programType
) {
String programTypeName = programType == null ? "" : programType.name();
String userName = loginUser.getUserName();
userName = userName.replaceAll("[\n|\r|\t]", "_");
logger.info("query resource list, login user:{}, resource type:{}, program type:{}", userName,programTypeName);
Map<String, Object> result = resourceService.queryResourceByProgramType(loginUser, type,programType);
return returnDataList(result);
}
/**
* query resource by full name and type
*
* @param loginUser login user |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * @param fullName resource full name
* @param type resource type
* @param id resource id
* @return true if the resource name not exists, otherwise return false
*/
@ApiOperation(value = "queryResource", notes = "QUERY_BY_RESOURCE_NAME")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "fullName", value = "RESOURCE_FULL_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = false, dataType = "Int", example = "10")
})
@GetMapping(value = "/queryResource")
@ResponseStatus(HttpStatus.OK)
@ApiException(RESOURCE_NOT_EXIST)
public Result queryResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "fullName", required = false) String fullName,
@RequestParam(value = "id", required = false) Integer id,
@RequestParam(value = "type") ResourceType type
) {
logger.info("login user {}, query resource by full name: {} or id: {},resource type: {}",
loginUser.getUserName(), fullName, id, type);
return resourceService.queryResource(fullName, id, type);
}
/**
* view resource file online
*
* @param loginUser login user
* @param resourceId resource id
* @param skipLineNum skip line number
* @param limit limit |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * @return resource content
*/
@ApiOperation(value = "viewResource", notes = "VIEW_RESOURCE_BY_ID_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "skipLineNum", value = "SKIP_LINE_NUM", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "limit", value = "LIMIT", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/view")
@ApiException(VIEW_RESOURCE_FILE_ON_LINE_ERROR)
public Result viewResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId,
@RequestParam(value = "skipLineNum") int skipLineNum,
@RequestParam(value = "limit") int limit
) {
logger.info("login user {}, view resource : {}, skipLineNum {} , limit {}",
loginUser.getUserName(), resourceId, skipLineNum, limit);
return resourceService.readResource(resourceId, skipLineNum, limit);
}
/**
* create resource file online
* @param loginUser
* @param type
* @param fileName
* @param fileSuffix
* @param description
* @param content
* @param pid
* @param currentDir
* @return create result code |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | */
@ApiOperation(value = "onlineCreateResource", notes = "ONLINE_CREATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType = "ResourceType"),
@ApiImplicitParam(name = "fileName", value = "RESOURCE_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "suffix", value = "SUFFIX", required = true, dataType = "String"),
@ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType = "String"),
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String"),
@ApiImplicitParam(name = "pid", value = "RESOURCE_PID", required = true, dataType = "Int", example = "10"),
@ApiImplicitParam(name = "currentDir", value = "RESOURCE_CURRENTDIR", required = true, dataType = "String")
})
@PostMapping(value = "/online-create")
@ApiException(CREATE_RESOURCE_FILE_ON_LINE_ERROR)
public Result onlineCreateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") ResourceType type,
@RequestParam(value = "fileName") String fileName,
@RequestParam(value = "suffix") String fileSuffix,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "content") String content,
@RequestParam(value = "pid") int pid,
@RequestParam(value = "currentDir") String currentDir
) {
logger.info("login user {}, online create resource! fileName : {}, type : {}, suffix : {},desc : {},content : {}",
loginUser.getUserName(), fileName, type, fileSuffix, description, content, pid, currentDir);
if (StringUtils.isEmpty(content)) {
logger.error("resource file contents are not allowed to be empty");
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg());
}
return resourceService.onlineCreateResource(loginUser, type, fileName, fileSuffix, description, content, pid, currentDir);
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | /**
* edit resource file online
*
* @param loginUser login user
* @param resourceId resource id
* @param content content
* @return update result code
*/
@ApiOperation(value = "updateResourceContent", notes = "UPDATE_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100"),
@ApiImplicitParam(name = "content", value = "CONTENT", required = true, dataType = "String")
})
@PostMapping(value = "/update-content")
@ApiException(EDIT_RESOURCE_FILE_ON_LINE_ERROR)
public Result updateResourceContent(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId,
@RequestParam(value = "content") String content
) {
logger.info("login user {}, updateProcessInstance resource : {}",
loginUser.getUserName(), resourceId);
if (StringUtils.isEmpty(content)) {
logger.error("The resource file contents are not allowed to be empty");
return error(Status.RESOURCE_FILE_IS_EMPTY.getCode(), RESOURCE_FILE_IS_EMPTY.getMsg());
}
return resourceService.updateResourceContent(resourceId, content);
}
/**
* download resource file
* |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * @param loginUser login user
* @param resourceId resource id
* @return resource content
*/
@ApiOperation(value = "downloadResource", notes = "DOWNLOAD_RESOURCE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/download")
@ResponseBody
@ApiException(DOWNLOAD_RESOURCE_FILE_ERROR)
public ResponseEntity downloadResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int resourceId) throws Exception {
logger.info("login user {}, download resource : {}",
loginUser.getUserName(), resourceId);
Resource file = resourceService.downloadResource(resourceId);
if (file == null) {
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(Status.RESOURCE_NOT_EXIST.getMsg());
}
return ResponseEntity
.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + file.getFilename() + "\"")
.body(file);
}
/**
* create udf function
*
* @param loginUser login user
* @param type udf type
* @param funcName function name |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * @param argTypes argument types
* @param database database
* @param description description
* @param className class name
* @param resourceId resource id
* @return create result code
*/
@ApiOperation(value = "createUdfFunc", notes = "CREATE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"),
@ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "suffix", value = "CLASS_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"),
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping(value = "/udf-func/create")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(CREATE_UDF_FUNCTION_ERROR)
public Result createUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "type") UdfType type,
@RequestParam(value = "funcName") String funcName,
@RequestParam(value = "className") String className,
@RequestParam(value = "argTypes", required = false) String argTypes,
@RequestParam(value = "database", required = false) String database,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "resourceId") int resourceId) {
logger.info("login user {}, create udf function, type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}",
loginUser.getUserName(), type, funcName, argTypes, database, description, resourceId); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | return udfFuncService.createUdfFunction(loginUser, funcName, className, argTypes, database, description, type, resourceId);
}
/**
* view udf function
*
* @param loginUser login user
* @param id resource id
* @return udf function detail
*/
@ApiOperation(value = "viewUIUdfFunction", notes = "VIEW_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/udf-func/update-ui")
@ResponseStatus(HttpStatus.OK)
@ApiException(VIEW_UDF_FUNCTION_ERROR)
public Result viewUIUdfFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("id") int id) {
logger.info("login user {}, query udf{}",
loginUser.getUserName(), id);
Map<String, Object> map = udfFuncService.queryUdfFuncDetail(id);
return returnDataList(map);
}
/**
* update udf function
*
* @param loginUser login user
* @param type resource type
* @param funcName function name
* @param argTypes argument types |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * @param database data base
* @param description description
* @param resourceId resource id
* @param className class name
* @param udfFuncId udf function id
* @return update result code
*/
@ApiOperation(value = "updateUdfFunc", notes = "UPDATE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "UDF_ID", required = true, dataType = "Int"),
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType"),
@ApiImplicitParam(name = "funcName", value = "FUNC_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "className", value = "CLASS_NAME", required = true, dataType = "String"),
@ApiImplicitParam(name = "argTypes", value = "ARG_TYPES", dataType = "String"),
@ApiImplicitParam(name = "database", value = "DATABASE_NAME", dataType = "String"),
@ApiImplicitParam(name = "description", value = "UDF_DESC", dataType = "String"),
@ApiImplicitParam(name = "resourceId", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
})
@PostMapping(value = "/udf-func/update")
@ApiException(UPDATE_UDF_FUNCTION_ERROR)
public Result updateUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int udfFuncId,
@RequestParam(value = "type") UdfType type,
@RequestParam(value = "funcName") String funcName,
@RequestParam(value = "className") String className,
@RequestParam(value = "argTypes", required = false) String argTypes,
@RequestParam(value = "database", required = false) String database,
@RequestParam(value = "description", required = false) String description,
@RequestParam(value = "resourceId") int resourceId) {
logger.info("login user {}, updateProcessInstance udf function id: {},type: {}, funcName: {},argTypes: {} ,database: {},desc: {},resourceId: {}", |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | loginUser.getUserName(), udfFuncId, type, funcName, argTypes, database, description, resourceId);
Map<String, Object> result = udfFuncService.updateUdfFunc(udfFuncId, funcName, className, argTypes, database, description, type, resourceId);
return returnDataList(result);
}
/**
* query udf function list paging
*
* @param loginUser login user
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return udf function list page
*/
@ApiOperation(value = "queryUdfFuncListPaging", notes = "QUERY_UDF_FUNCTION_LIST_PAGING_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "searchVal", value = "SEARCH_VAL", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "PAGE_NO", dataType = "Int", example = "1"),
@ApiImplicitParam(name = "pageSize", value = "PAGE_SIZE", dataType = "Int", example = "20")
})
@GetMapping(value = "/udf-func/list-paging")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_UDF_FUNCTION_LIST_PAGING_ERROR)
public Result<Object> queryUdfFuncListPaging(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("pageNo") Integer pageNo,
@RequestParam(value = "searchVal", required = false) String searchVal,
@RequestParam("pageSize") Integer pageSize
) {
logger.info("query udf functions list, login user:{},search value:{}",
loginUser.getUserName(), searchVal);
Map<String, Object> result = checkPageParams(pageNo, pageSize); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | if (result.get(Constants.STATUS) != Status.SUCCESS) {
return returnDataListPaging(result);
}
result = udfFuncService.queryUdfFuncListPaging(loginUser, searchVal, pageNo, pageSize);
return returnDataListPaging(result);
}
/**
* query udf func list by type
*
* @param loginUser login user
* @param type resource type
* @return resource list
*/
@ApiOperation(value = "queryUdfFuncList", notes = "QUERY_UDF_FUNC_LIST_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "type", value = "UDF_TYPE", required = true, dataType = "UdfType")
})
@GetMapping(value = "/udf-func/list")
@ResponseStatus(HttpStatus.OK)
@ApiException(QUERY_DATASOURCE_BY_TYPE_ERROR)
public Result<Object> queryUdfFuncList(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("type") UdfType type) {
String userName = loginUser.getUserName();
userName = userName.replaceAll("[\n|\r|\t]", "_");
logger.info("query udf func list, user:{}, type:{}", userName, type);
Map<String, Object> result = udfFuncService.queryUdfFuncList(loginUser, type.ordinal());
return returnDataList(result);
}
/**
* verify udf function name can use or not |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | *
* @param loginUser login user
* @param name name
* @return true if the name can user, otherwise return false
*/
@ApiOperation(value = "verifyUdfFuncName", notes = "VERIFY_UDF_FUNCTION_NAME_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "name", value = "FUNC_NAME", required = true, dataType = "String")
})
@GetMapping(value = "/udf-func/verify-name")
@ResponseStatus(HttpStatus.OK)
@ApiException(VERIFY_UDF_FUNCTION_NAME_ERROR)
public Result verifyUdfFuncName(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "name") String name
) {
logger.info("login user {}, verfiy udf function name: {}",
loginUser.getUserName(), name);
return udfFuncService.verifyUdfFuncByName(name);
}
/**
* delete udf function
*
* @param loginUser login user
* @param udfFuncId udf function id
* @return delete result code
*/
@ApiOperation(value = "deleteUdfFunc", notes = "DELETE_UDF_FUNCTION_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType = "Int", example = "100")
}) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @GetMapping(value = "/udf-func/delete")
@ResponseStatus(HttpStatus.OK)
@ApiException(DELETE_UDF_FUNCTION_ERROR)
public Result deleteUdfFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam(value = "id") int udfFuncId
) {
logger.info("login user {}, delete udf function id: {}", loginUser.getUserName(), udfFuncId);
return udfFuncService.delete(udfFuncId);
}
/**
* authorized file resource list
*
* @param loginUser login user
* @param userId user id
* @return authorized result
*/
@ApiOperation(value = "authorizedFile", notes = "AUTHORIZED_FILE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/authed-file")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(AUTHORIZED_FILE_RESOURCE_ERROR)
public Result authorizedFile(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
logger.info("authorized file resource, user: {}, user id:{}", loginUser.getUserName(), userId);
Map<String, Object> result = resourceService.authorizedFile(loginUser, userId);
return returnDataList(result);
}
/** |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | * unauthorized file resource list
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
@ApiOperation(value = "authorizeResourceTree", notes = "AUTHORIZE_RESOURCE_TREE_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/authorize-resource-tree")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(AUTHORIZE_RESOURCE_TREE)
public Result authorizeResourceTree(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
logger.info("all resource file, user:{}, user id:{}", loginUser.getUserName(), userId);
Map<String, Object> result = resourceService.authorizeResourceTree(loginUser, userId);
return returnDataList(result);
}
/**
* unauthorized udf function
*
* @param loginUser login user
* @param userId user id
* @return unauthorized result code
*/
@ApiOperation(value = "unauthUDFFunc", notes = "UNAUTHORIZED_UDF_FUNC_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
}) |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java | @GetMapping(value = "/unauth-udf-func")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(UNAUTHORIZED_UDF_FUNCTION_ERROR)
public Result unauthUDFFunc(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
logger.info("unauthorized udf function, login user:{}, unauthorized user id:{}", loginUser.getUserName(), userId);
Map<String, Object> result = resourceService.unauthorizedUDFFunction(loginUser, userId);
return returnDataList(result);
}
/**
* authorized udf function
*
* @param loginUser login user
* @param userId user id
* @return authorized result code
*/
@ApiOperation(value = "authUDFFunc", notes = "AUTHORIZED_UDF_FUNC_NOTES")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "USER_ID", required = true, dataType = "Int", example = "100")
})
@GetMapping(value = "/authed-udf-func")
@ResponseStatus(HttpStatus.CREATED)
@ApiException(AUTHORIZED_UDF_FUNCTION_ERROR)
public Result authorizedUDFFunction(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser,
@RequestParam("userId") Integer userId) {
logger.info("auth udf function, login user:{}, auth user id:{}", loginUser.getUserName(), userId);
Map<String, Object> result = resourceService.authorizedUDFFunction(loginUser, userId);
return returnDataList(result);
}
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.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;
import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.api.utils.PageInfo;
import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.DbConnectType;
import org.apache.dolphinscheduler.common.enums.DbType;
import org.apache.dolphinscheduler.common.utils.CommonUtils;
import org.apache.dolphinscheduler.common.utils.JSONUtils; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.datasource.BaseDataSource;
import org.apache.dolphinscheduler.dao.datasource.DataSourceFactory;
import org.apache.dolphinscheduler.dao.datasource.OracleDataSource;
import org.apache.dolphinscheduler.dao.entity.DataSource;
import org.apache.dolphinscheduler.dao.entity.Resource;
import org.apache.dolphinscheduler.dao.entity.User;
import org.apache.dolphinscheduler.dao.mapper.DataSourceMapper;
import org.apache.dolphinscheduler.dao.mapper.DataSourceUserMapper;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereo.Service;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.node.ObjectNode;
/**
* datasource service
*/
@Service |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | public class DataSourceService extends BaseService {
private static final Logger logger = LoggerFactory.getLogger(DataSourceService.class);
public static final String NAME = "";
public static final String NOTE = "note";
public static final String TYPE = "";
public static final String HOST = "host";
public static final String PORT = "port";
public static final String PRINCIPAL = "principal";
public static final String DATABASE = "database";
public static final String USER_NAME = "userName";
public static final String OTHER = "other";
@Autowired
private DataSourceMapper dataSourceMapper;
@Autowired
private DataSourceUserMapper datasourceUserMapper;
/**
* create data source
*
* @param loginUser login user
* @param data source
* @param data source ription
* @param data source
* @param datasource s
* @return create result code
*/
public Result<Object> createDataSource(User loginUser, String , String , DbType , String ) {
Result<Object> result = new Result<>(); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | if (checkName()) {
putMsg(result, Status.DATASOURCE_EXIST);
return result;
}
Result<Object> isConnection = checkConnection(, );
if (Status.SUCCESS.getCode() != isConnection.getCode()) {
return result;
}
DataSource dataSource = new DataSource();
Date now = new Date();
dataSource.setName(.trim());
dataSource.setNote();
dataSource.setUserId(loginUser.getId());
dataSource.setUserName(loginUser.getUserName());
dataSource.setType();
dataSource.setConnectionParams();
dataSource.setCreateTime(now);
dataSource.setUpdateTime(now);
dataSourceMapper.insert(dataSource);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* updateProcessInstance datasource
*
* @param loginUser login user
* @param data source
* @param data source ription |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | * @param data source
* @param datasource s
* @param id data source id
* @return update result code
*/
public Result<Object> updateDataSource(int id, User loginUser, String , String , DbType , String ) {
Result<Object> result = new Result<>();
DataSource dataSource = dataSourceMapper.selectById(id);
if (dataSource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
if (!hasPerm(loginUser, dataSource.getUserId())) {
putMsg(result, Status.USER_NO_OPERATION_PERM);
return result;
}
if (!.trim().equals(dataSource.getName()) && checkName()) {
putMsg(result, Status.DATASOURCE_EXIST);
return result;
}
ObjectNode paramObject = JSONUtils.parseObject();
String password = paramObject.path(Constants.PASSWORD).asText();
if (StringUtils.isBlank(password)) {
String oldConnectionParams = dataSource.getConnectionParams();
ObjectNode oldParams = JSONUtils.parseObject(oldConnectionParams);
paramObject.put(Constants.PASSWORD, oldParams.path(Constants.PASSWORD).asText());
} |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | //
String connectionParams = paramObject.toString();
Result<Object> isConnection = checkConnection(, );
if (Status.SUCCESS.getCode() != isConnection.getCode()) {
return result;
}
Date now = new Date();
dataSource.setName(.trim());
dataSource.setNote();
dataSource.setUserName(loginUser.getUserName());
dataSource.setType();
dataSource.setConnectionParams(connectionParams);
dataSource.setUpdateTime(now);
dataSourceMapper.updateById(dataSource);
putMsg(result, Status.SUCCESS);
return result;
}
private boolean checkName(String ) {
List<DataSource> queryDataSource = dataSourceMapper.queryDataSourceByName(.trim());
return queryDataSource != null && queryDataSource.size() > 0;
}
/**
* updateProcessInstance datasource
*
* @param id datasource id
* @return data source detail
*/
public Map<String, Object> queryDataSource(int id) {
Map<String, Object> result = new HashMap<String, Object>(5);
DataSource dataSource = dataSourceMapper.selectById(id); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | if (dataSource == null) {
putMsg(result, Status.RESOURCE_NOT_EXIST);
return result;
}
//
String dataSourceType = dataSource.getType().toString();
//
String dataSourceName = dataSource.getName();
//
String = dataSource.getNote();
//
String = dataSource.getConnectionParams();
BaseDataSource datasourceForm = DataSourceFactory.getDatasource(dataSource.getType(), );
DbConnectType connectType = null;
String hostSeperator = Constants.DOUBLE_SLASH;
if (DbType.ORACLE.equals(dataSource.getType())) {
connectType = ((OracleDataSource) datasourceForm).getConnectType();
if (DbConnectType.ORACLE_SID.equals(connectType)) {
hostSeperator = Constants.AT_SIGN;
}
}
String database = datasourceForm.getDatabase();
//
String other = datasourceForm.getOther();
String address = datasourceForm.getAddress();
String[] hostsPorts = getHostsAndPort(address, hostSeperator);
//
String host = hostsPorts[0];
//
String port = hostsPorts[1]; |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | String separator = "";
switch (dataSource.getType()) {
case HIVE:
case SQLSERVER:
separator = ";";
break;
case MYSQL:
case POSTGRESQL:
case CLICKHOUSE:
case ORACLE:
case PRESTO:
separator = "&";
break;
default:
separator = "&";
break;
}
Map<String, String> otherMap = new LinkedHashMap<String, String>();
if (other != null) {
String[] configs = other.split(separator);
for (String config : configs) {
otherMap.put(config.split("=")[0], config.split("=")[1]);
}
}
Map<String, Object> map = new HashMap<>(10);
map.put(NAME, dataSourceName);
map.put(NOTE, );
map.put(TYPE, dataSourceType);
if (connectType != null) {
map.put(Constants.ORACLE_DB_CONNECT_TYPE, connectType); |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | }
map.put(HOST, host);
map.put(PORT, port);
map.put(PRINCIPAL, datasourceForm.getPrincipal());
map.put(Constants.KERBEROS_KRB5_CONF_PATH, datasourceForm.getJavaSecurityKrb5Conf());
map.put(Constants.KERBEROS_KEY_TAB_USERNAME, datasourceForm.getLoginUserKeytabUser());
map.put(Constants.KERBEROS_KEY_TAB_PATH, datasourceForm.getLoginUserKeytabPath());
map.put(DATABASE, database);
map.put(USER_NAME, datasourceForm.getUser());
map.put(OTHER, otherMap);
result.put(Constants.DATA_LIST, map);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* query datasource list by keyword
*
* @param loginUser login user
* @param searchVal search value
* @param pageNo page number
* @param pageSize page size
* @return data source list page
*/
public Map<String, Object> queryDataSourceListPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
Map<String, Object> result = new HashMap<>();
IPage<DataSource> dataSourceList = null;
Page<DataSource> dataSourcePage = new Page(pageNo, pageSize);
if (isAdmin(loginUser)) {
dataSourceList = dataSourceMapper.selectPaging(dataSourcePage, 0, searchVal);
} else { |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | dataSourceList = dataSourceMapper.selectPaging(dataSourcePage, loginUser.getId(), searchVal);
}
List<DataSource> dataSources = dataSourceList != null ? dataSourceList.getRecords() : new ArrayList<>();
handlePasswd(dataSources);
PageInfo pageInfo = new PageInfo<Resource>(pageNo, pageSize);
pageInfo.setTotalCount((int) (dataSourceList != null ? dataSourceList.getTotal() : 0L));
pageInfo.setLists(dataSources);
result.put(Constants.DATA_LIST, pageInfo);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* handle datasource connection password for safety
*
* @param dataSourceList
*/
private void handlePasswd(List<DataSource> dataSourceList) {
for (DataSource dataSource : dataSourceList) {
String connectionParams = dataSource.getConnectionParams();
ObjectNode object = JSONUtils.parseObject(connectionParams);
object.put(Constants.PASSWORD, Constants.XXXXXX);
dataSource.setConnectionParams(object.toString());
}
}
/**
* query data resource list
*
* @param loginUser login user
* @param data source
* @return data source list page |
closed | apache/dolphinscheduler | https://github.com/apache/dolphinscheduler | 3,369 | [Improvement][api] Introduce interface about api module service | **Describe the question**
Introduce interface about api module service for clearly service module.
**What are the current deficiencies and the benefits of improvement**
- A clear and concise service will help contributor or user to ready the code and locate the function.
**Which version of DolphinScheduler:**
-[dev]
**Describe alternatives you've considered**
Introduce service interface
| https://github.com/apache/dolphinscheduler/issues/3369 | https://github.com/apache/dolphinscheduler/pull/4759 | 9ae29a756f0aeed894c80f5e495d786ccf03f41f | 15a5b0588399bbafd201405af02d611d548fac12 | "2020-07-31T13:52:28Z" | java | "2021-02-18T15:27:37Z" | dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/DataSourceService.java | */
public Map<String, Object> queryDataSourceList(User loginUser, Integer ) {
Map<String, Object> result = new HashMap<>();
List<DataSource> datasourceList;
if (isAdmin(loginUser)) {
datasourceList = dataSourceMapper.listAllDataSourceByType();
} else {
datasourceList = dataSourceMapper.queryDataSourceByType(loginUser.getId(), );
}
result.put(Constants.DATA_LIST, datasourceList);
putMsg(result, Status.SUCCESS);
return result;
}
/**
* verify datasource exists
*
* @param datasource
* @return true if data datasource not exists, otherwise return false
*/
public Result<Object> verifyDataSourceName(String ) {
Result<Object> result = new Result<>();
List<DataSource> dataSourceList = dataSourceMapper.queryDataSourceByName();
if (dataSourceList != null && dataSourceList.size() > 0) {
logger.error("datasource :{} has exist, can't create again.", );
putMsg(result, Status.DATASOURCE_EXIST);
} else {
putMsg(result, Status.SUCCESS);
}
return result;
} |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.