Hauptinhalt

promote

Promote job in MATLAB Job Scheduler cluster queue

    Description

    promote(job) promotes the job object, job, that is in a MATLAB® Job Scheduler cluster queue.

    You can also use the promote function on jobs running on a MATLAB Job Scheduler cluster in the cloud. (since R2026a)

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

    example

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

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

    Examples

    collapse all

    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.

    Create a cluster object.

    c = parcluster;

    Use pause to prevent submissions from running.

    pause(c) % Prevent submissions from running.
    

    Create jobs and tasks and submit to 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(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)

    Input Arguments

    collapse all

    Job to promote in a MATLAB Job Scheduler cluster queue, specified as a parallel.Job object.

    You can also use the promote function on jobs running on a MATLAB Job Scheduler cluster in the cloud. (since R2026a)

    Example: job = createJob(c)

    Cluster, specified as a parallel.cluster.MJS or parallel.cluster.MJSComputeCloud object that represents MATLAB Job Scheduler cluster compute resources. To create the object, use the parcluster function.

    Before R2026a: You can only use the promote function on parallel.cluster.MJS objects.

    Example: myCluster = parcluster("myMJSProfile")

    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

    expand all