|
|
@ -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 instance,associate processInstance and processDefine |
|
|
|
* package task instance,associate 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 |
|
|
|