Browse Source

[Improvement-3686][service] ProcessService method name meets naming convention. (#3687)

* ProcessService method name meets naming convention.

* add code checkstyle.

* update test.

* update test.

* add code checkstyle.

* add code checkstyle.

* update pom.

* update pom.

* ProcessService method name meets naming convention.

* update processService code.

* update code style.

* update code style.

* update code style.

Co-authored-by: zhuangchong <zhuangchong8@163.com>
pull/3/MERGE
zhuangchong 4 years ago committed by GitHub
parent
commit
2fbbf96cde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java
  2. 29
      dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

2
dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/master/consumer/TaskPriorityQueueConsumer.java

@ -326,7 +326,7 @@ public class TaskPriorityQueueConsumer extends Thread{
udfFunIdsArray[i]=Integer.parseInt(udfFunIds[i]); udfFunIdsArray[i]=Integer.parseInt(udfFunIds[i]);
} }
List<UdfFunc> udfFuncList = processService.queryUdfFunListByids(udfFunIdsArray); List<UdfFunc> udfFuncList = processService.queryUdfFunListByIds(udfFunIdsArray);
Map<UdfFunc,String> udfFuncMap = new HashMap<>(); Map<UdfFunc,String> udfFuncMap = new HashMap<>();
for(UdfFunc udfFunc : udfFuncList) { for(UdfFunc udfFunc : udfFuncList) {
String tenantCode = processService.queryTenantCodeByResName(udfFunc.getResourceName(), ResourceType.UDF); String tenantCode = processService.queryTenantCodeByResName(udfFunc.getResourceName(), ResourceType.UDF);

29
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessService.java

@ -14,6 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.dolphinscheduler.service.process; package org.apache.dolphinscheduler.service.process;
import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE; import static org.apache.dolphinscheduler.common.Constants.CMDPARAM_COMPLEMENT_DATA_END_DATE;
@ -144,8 +145,6 @@ public class ProcessService {
@Autowired @Autowired
private ResourceMapper resourceMapper; private ResourceMapper resourceMapper;
@Autowired @Autowired
private ErrorCommandMapper errorCommandMapper; private ErrorCommandMapper errorCommandMapper;
@ -180,7 +179,7 @@ public class ProcessService {
processInstance.addHistoryCmd(command.getCommandType()); processInstance.addHistoryCmd(command.getCommandType());
saveProcessInstance(processInstance); saveProcessInstance(processInstance);
this.setSubProcessParam(processInstance); this.setSubProcessParam(processInstance);
delCommandByid(command.getId()); delCommandById(command.getId());
return processInstance; return processInstance;
} }
@ -193,7 +192,7 @@ public class ProcessService {
public void moveToErrorCommand(Command command, String message) { public void moveToErrorCommand(Command command, String message) {
ErrorCommand errorCommand = new ErrorCommand(command, message); ErrorCommand errorCommand = new ErrorCommand(command, message);
this.errorCommandMapper.insert(errorCommand); this.errorCommandMapper.insert(errorCommand);
delCommandByid(command.getId()); delCommandById(command.getId());
} }
/** /**
@ -355,7 +354,6 @@ public class ProcessService {
return 1; return 1;
} }
/** /**
* remove task log file * remove task log file
* @param processInstanceId processInstanceId * @param processInstanceId processInstanceId
@ -384,13 +382,11 @@ public class ProcessService {
ip = taskInstance.getHost(); ip = taskInstance.getHost();
} }
// remove task log from loggerserver // remove task log from loggerserver
logClient.removeTaskLog(ip,port,taskLogPath); logClient.removeTaskLog(ip,port,taskLogPath);
} }
} }
/** /**
* calculate sub process number in the process define. * calculate sub process number in the process define.
* @param processDefinitionId processDefinitionId * @param processDefinitionId processDefinitionId
@ -792,7 +788,6 @@ public class ProcessService {
} }
/** /**
* set sub work process parameters. * set sub work process parameters.
* handle sub work process instance, update relation table and command parameters * handle sub work process instance, update relation table and command parameters
@ -1132,7 +1127,6 @@ public class ProcessService {
return taskInstance; return taskInstance;
} }
/** /**
* ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskInstanceId}_${task executed by ip1},${ip2}... * ${processInstancePriority}_${processInstanceId}_${taskInstancePriority}_${taskInstanceId}_${task executed by ip1},${ip2}...
* The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low. * The tasks with the highest priority are selected by comparing the priorities of the above four levels from high to low.
@ -1306,11 +1300,12 @@ public class ProcessService {
int count = taskInstanceMapper.updateById(taskInstance); int count = taskInstanceMapper.updateById(taskInstance);
return count > 0; return count > 0;
} }
/** /**
* delete a command by id * delete a command by id
* @param id id * @param id id
*/ */
public void delCommandByid(int id) { public void delCommandById(int id) {
commandMapper.deleteById(id); commandMapper.deleteById(id);
} }
@ -1323,7 +1318,6 @@ public class ProcessService {
return taskInstanceMapper.selectById(taskId); return taskInstanceMapper.selectById(taskId);
} }
/** /**
* package task instanceassociate processInstance and processDefine * package task instanceassociate processInstance and processDefine
* @param taskInstId taskInstId * @param taskInstId taskInstId
@ -1345,7 +1339,6 @@ public class ProcessService {
return taskInstance; return taskInstance;
} }
/** /**
* get id list by task state * get id list by task state
* @param instanceId instanceId * @param instanceId instanceId
@ -1383,7 +1376,6 @@ public class ProcessService {
return processInstanceMapMapper.updateById(processInstanceMap); return processInstanceMapMapper.updateById(processInstanceMap);
} }
/** /**
* create work process instance map * create work process instance map
* @param processInstanceMap processInstanceMap * @param processInstanceMap processInstanceMap
@ -1448,7 +1440,6 @@ public class ProcessService {
return processInstance; return processInstance;
} }
/** /**
* change task state * change task state
* @param state state * @param state state
@ -1568,7 +1559,6 @@ public class ProcessService {
* @return process instance list * @return process instance list
*/ */
public List<ProcessInstance> queryNeedFailoverProcessInstances(String host) { public List<ProcessInstance> queryNeedFailoverProcessInstances(String host) {
return processInstanceMapper.queryByHostAndStatus(host, stateArray); return processInstanceMapper.queryByHostAndStatus(host, stateArray);
} }
@ -1610,7 +1600,6 @@ public class ProcessService {
return dataSourceMapper.selectById(id); return dataSourceMapper.selectById(id);
} }
/** /**
* update process instance state by id * update process instance state by id
* @param processInstanceId processInstanceId * @param processInstanceId processInstanceId
@ -1642,7 +1631,7 @@ public class ProcessService {
* @param ids ids * @param ids ids
* @return udf function list * @return udf function list
*/ */
public List<UdfFunc> queryUdfFunListByids(int[] ids){ public List<UdfFunc> queryUdfFunListByIds(int[] ids) {
return udfFuncMapper.queryUdfByIdStr(ids, null); return udfFuncMapper.queryUdfByIdStr(ids, null);
} }
@ -1699,7 +1688,6 @@ public class ProcessService {
return cycleDependencyList; return cycleDependencyList;
} }
String strCrontab = ""; String strCrontab = "";
CronExpression depCronExpression; CronExpression depCronExpression;
Cron depCron; Cron depCron;
@ -1809,8 +1797,6 @@ public class ProcessService {
return queue; return queue;
} }
/** /**
* get task worker group * get task worker group
* @param taskInstance taskInstance * @param taskInstance taskInstance
@ -1898,6 +1884,8 @@ public class ProcessService {
Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(t -> t.getId()).collect(toSet()); Set<Integer> authorizedUdfs = udfFuncMapper.listAuthorizedUdfFunc(userId, needChecks).stream().map(t -> t.getId()).collect(toSet());
originResSet.removeAll(authorizedUdfs); originResSet.removeAll(authorizedUdfs);
break; break;
default:
break;
} }
resultList.addAll(originResSet); resultList.addAll(originResSet);
@ -1924,7 +1912,6 @@ public class ProcessService {
return resourceMapper.selectById(resoruceId); return resourceMapper.selectById(resoruceId);
} }
/** /**
* list resources by ids * list resources by ids
* @param resIds resIds * @param resIds resIds

Loading…
Cancel
Save