use of com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue in project Taier by DTStack.
the class JobDealer method addRestartJob.
public boolean addRestartJob(JobClient jobClient) {
String jobResource = jobComputeResourcePlain.getJobResource(jobClient);
GroupPriorityQueue groupPriorityQueue = getGroupPriorityQueue(jobResource);
return groupPriorityQueue.addRestartJob(jobClient);
}
use of com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue in project Taier by DTStack.
the class ConsoleService method jobStick.
public Boolean jobStick(String jobId) {
try {
ScheduleEngineJobCache engineJobCache = scheduleEngineJobCacheMapper.getOne(jobId);
if (null == engineJobCache) {
return false;
}
// 只支持DB、PRIORITY两种调整顺序
if (EJobCacheStage.DB.getStage() == engineJobCache.getStage() || EJobCacheStage.PRIORITY.getStage() == engineJobCache.getStage()) {
ParamAction paramAction = PublicUtil.jsonStrToObject(engineJobCache.getJobInfo(), ParamAction.class);
JobClient jobClient = new JobClient(paramAction);
jobClient.setCallBack((jobStatus) -> {
jobDealer.updateJobStatus(jobClient.getJobId(), jobStatus);
});
Long minPriority = scheduleEngineJobCacheMapper.minPriorityByStage(engineJobCache.getJobResource(), Lists.newArrayList(EJobCacheStage.PRIORITY.getStage()), engineJobCache.getNodeAddress());
minPriority = minPriority == null ? 0 : minPriority;
jobClient.setPriority(minPriority - 1);
if (EJobCacheStage.PRIORITY.getStage() == engineJobCache.getStage()) {
// 先将队列中的元素移除,重复插入会被忽略
GroupPriorityQueue groupPriorityQueue = jobDealer.getGroupPriorityQueue(engineJobCache.getJobResource());
groupPriorityQueue.remove(jobClient);
}
return jobDealer.addGroupPriorityQueue(engineJobCache.getJobResource(), jobClient, false, false);
}
} catch (Exception e) {
LOGGER.error("jobStick error:", e);
}
return false;
}
use of com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue in project Taier by DTStack.
the class JobDealer method addGroupPriorityQueue.
public boolean addGroupPriorityQueue(String jobResource, JobClient jobClient, boolean judgeBlock, boolean insert) {
try {
GroupPriorityQueue groupPriorityQueue = getGroupPriorityQueue(jobResource);
boolean rs = groupPriorityQueue.add(jobClient, judgeBlock, insert);
if (!rs) {
saveCache(jobClient, jobResource, EJobCacheStage.DB.getStage(), insert);
}
return rs;
} catch (Exception e) {
LOGGER.error("", e);
dealSubmitFailJob(jobClient.getJobId(), e.toString());
return false;
}
}
Aggregations