Search in sources :

Example 1 with JobPriority

use of org.ow2.proactive.scheduler.common.job.JobPriority in project scheduling by ow2-proactive.

the class TestJobSchedulingStarvationAndPriority method createJobReplicate.

/*
     * Job high priority with one task and high priority
     */
private TaskFlowJob createJobReplicate(int nbRun, JobPriority priority) throws Exception {
    String jobDescriptorPath = new File(jobDescriptor.toURI()).getAbsolutePath();
    TaskFlowJob job = new TaskFlowJob();
    job.setName(this.getClass().getSimpleName() + "_High");
    job.setPriority(JobPriority.HIGHEST);
    JavaTask javaTask = new JavaTask();
    javaTask.setExecutableClassName(EmptyTask.class.getName());
    javaTask.setName("taskHigh");
    job.addTask(javaTask);
    return job;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask) EmptyTask(org.ow2.proactive.scheduler.examples.EmptyTask) File(java.io.File)

Example 2 with JobPriority

use of org.ow2.proactive.scheduler.common.job.JobPriority in project scheduling by ow2-proactive.

the class DefaultPolicyTest method createSingleTaskJob.

private JobDescriptorImpl createSingleTaskJob(JobPriority jobPriority) {
    InternalTaskFlowJob taskFlowJob = new InternalTaskFlowJob("test", jobPriority, OnTaskError.CANCEL_JOB, "");
    taskFlowJob.setId(JobIdImpl.makeJobId(Integer.toString(jobId++)));
    ArrayList<InternalTask> tasks = new ArrayList<>();
    tasks.add(new InternalScriptTask(taskFlowJob));
    taskFlowJob.addTasks(tasks);
    return new JobDescriptorImpl(taskFlowJob);
}
Also used : InternalScriptTask(org.ow2.proactive.scheduler.task.internal.InternalScriptTask) InternalTask(org.ow2.proactive.scheduler.task.internal.InternalTask) ArrayList(java.util.ArrayList) InternalTaskFlowJob(org.ow2.proactive.scheduler.job.InternalTaskFlowJob) JobDescriptorImpl(org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)

Example 3 with JobPriority

use of org.ow2.proactive.scheduler.common.job.JobPriority in project scheduling by ow2-proactive.

the class LiveJobs method lockJobsToSchedule.

Map<JobId, JobDescriptor> lockJobsToSchedule() {
    TreeSet<JobPriority> prioritiesScheduled = new TreeSet<>();
    TreeSet<JobPriority> prioritiesNotScheduled = new TreeSet<>();
    Map<JobId, JobDescriptor> result = new HashMap<>();
    for (Map.Entry<JobId, JobData> entry : jobs.entrySet()) {
        JobData value = entry.getValue();
        if (value.jobLock.tryLock()) {
            InternalJob job = entry.getValue().job;
            result.put(job.getId(), job.getJobDescriptor());
            prioritiesScheduled.add(job.getPriority());
            if (unlockIfConflict(prioritiesScheduled, prioritiesNotScheduled, result))
                return new HashMap<>(0);
        } else {
            prioritiesNotScheduled.add(value.job.getPriority());
            if (unlockIfConflict(prioritiesScheduled, prioritiesNotScheduled, result))
                return new HashMap<>(0);
        }
    }
    return result;
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) JobDescriptor(org.ow2.proactive.scheduler.common.JobDescriptor) HashMap(java.util.HashMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TreeSet(java.util.TreeSet) JobPriority(org.ow2.proactive.scheduler.common.job.JobPriority) HashMap(java.util.HashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) JobId(org.ow2.proactive.scheduler.common.job.JobId)

Example 4 with JobPriority

use of org.ow2.proactive.scheduler.common.job.JobPriority in project scheduling by ow2-proactive.

the class TestLoadJobsPagination method createJob.

private TaskFlowJob createJob(String name, JobPriority priority) throws Exception {
    TaskFlowJob job = new TaskFlowJob();
    job.setName(name);
    job.setPriority(priority);
    JavaTask task = new JavaTask();
    task.setExecutableClassName("className");
    job.addTask(task);
    return job;
}
Also used : TaskFlowJob(org.ow2.proactive.scheduler.common.job.TaskFlowJob) JavaTask(org.ow2.proactive.scheduler.common.task.JavaTask)

Example 5 with JobPriority

use of org.ow2.proactive.scheduler.common.job.JobPriority in project scheduling by ow2-proactive.

the class SchedulerFrontendState method checkChangeJobPriority.

synchronized void checkChangeJobPriority(JobId jobId, JobPriority priority) throws NotConnectedException, UnknownJobException, PermissionException, JobAlreadyFinishedException {
    checkPermissions("changeJobPriority", getIdentifiedJob(jobId), YOU_DO_NOT_HAVE_PERMISSION_TO_CHANGE_THE_PRIORITY_OF_THIS_JOB);
    UserIdentificationImpl ui = identifications.get(PAActiveObject.getContext().getCurrentRequest().getSourceBodyID()).getUser();
    try {
        ui.checkPermission(new ChangePriorityPermission(priority.getPriority()), ui.getUsername() + " does not have permissions to set job priority to " + priority);
    } catch (PermissionException ex) {
        logger.info(ex.getMessage());
        throw ex;
    }
    if (jobs.get(jobId).isFinished()) {
        String msg = " is already finished";
        jlogger.info(jobId, msg);
        throw new JobAlreadyFinishedException("Job " + jobId + msg);
    }
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) ChangePriorityPermission(org.ow2.proactive.scheduler.permissions.ChangePriorityPermission) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)

Aggregations

TaskFlowJob (org.ow2.proactive.scheduler.common.job.TaskFlowJob)2 JavaTask (org.ow2.proactive.scheduler.common.task.JavaTask)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeSet (java.util.TreeSet)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 JobDescriptor (org.ow2.proactive.scheduler.common.JobDescriptor)1 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)1 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)1 JobId (org.ow2.proactive.scheduler.common.job.JobId)1 JobPriority (org.ow2.proactive.scheduler.common.job.JobPriority)1 JobDescriptorImpl (org.ow2.proactive.scheduler.descriptor.JobDescriptorImpl)1 EmptyTask (org.ow2.proactive.scheduler.examples.EmptyTask)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 InternalTaskFlowJob (org.ow2.proactive.scheduler.job.InternalTaskFlowJob)1 UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)1 ChangePriorityPermission (org.ow2.proactive.scheduler.permissions.ChangePriorityPermission)1 InternalScriptTask (org.ow2.proactive.scheduler.task.internal.InternalScriptTask)1