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;
}
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);
}
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;
}
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;
}
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);
}
}
Aggregations