Search in sources :

Example 1 with GroupPriorityQueue

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);
}
Also used : GroupPriorityQueue(com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue)

Example 2 with GroupPriorityQueue

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;
}
Also used : ParamAction(com.dtstack.taier.pluginapi.pojo.ParamAction) GroupPriorityQueue(com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue) JobClient(com.dtstack.taier.pluginapi.JobClient) RdosDefineException(com.dtstack.taier.common.exception.RdosDefineException)

Example 3 with GroupPriorityQueue

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;
    }
}
Also used : GroupPriorityQueue(com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue) BeansException(org.springframework.beans.BeansException)

Aggregations

GroupPriorityQueue (com.dtstack.taier.scheduler.server.queue.GroupPriorityQueue)3 RdosDefineException (com.dtstack.taier.common.exception.RdosDefineException)1 JobClient (com.dtstack.taier.pluginapi.JobClient)1 ParamAction (com.dtstack.taier.pluginapi.pojo.ParamAction)1 BeansException (org.springframework.beans.BeansException)1