Main Content

promote

Promote job in MATLAB Job Scheduler cluster queue

Syntax

promote(c,job)

Arguments

c

The MATLAB® Job Scheduler cluster object that contains the job.

job

Job object promoted in the queue.

Description

promote(c,job) promotes the job object job, that is queued in the MATLAB Job Scheduler cluster c.

If job is not the first job in the queue, promote exchanges the position of job and the previous job.

Examples

Create and submit multiple jobs to the cluster identified by the default cluster profile, assuming that the default cluster profile uses a MATLAB Job Scheduler.

c = parcluster;

Use pause to prevent submissions from running.

pause(c)

Create jobs and tasks and submit the jobs to the queue.

j1 = createJob(c,'Name',"Job A");
t1 = createTask(j1,@rand,1,{10,10});
j2 = createJob(c,'Name',"Job B");
t2 = createTask(j2,{@rand,@magic,@ones},1,{{3,3} {3} {3,3}});
j3 = createJob(c,'Name',"Job C");
t3 = createTask(j3,@rand,1,{10,10},CaptureDiary=true);
submit(j1);submit(j2);submit(j3);

Examine the queue sequence.

[pjobs,qjobs,rjobs,fjobs] = findJob(c);
get(qjobs,'Name')
    'Job A'
    'Job B'
    'Job C'

Promote Job C by one position in its queue:

promote(c,j3)

Examine the new queue sequence.

[pjobs,qjobs,rjobs,fjobs] = findJob(c);
get(qjobs,'Name')
    'Job A'
    'Job C'
    'Job B'

Resume processing of the job queue.

resume(c)

Tips

After a call to promote or demote, there is no change in the order of job objects contained in the Jobs property of the MATLAB Job Scheduler cluster object. To see the scheduled order of execution for jobs in the queue, use the findJob function in the form [pending queued running finished] = findJob(c).

Version History

Introduced before R2006a