Hauptinhalt

demote

Demote job in MATLAB Job Scheduler cluster queue

    Description

    demote(job) demotes the job object, job, in a MATLAB® Job Scheduler cluster.

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

    If job is not the last job in the queue, demote exchanges the position of job and the job that follows it in the queue.

    example

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

    If job is not the last job in the queue, demote exchanges the position of job and the job that follows 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'

    Demote Job A by one position in its queue.

    demote(j1)

    Examine the new queue sequence.

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

    Resume processing of the job queue.

    resume(c)

    Input Arguments

    collapse all

    Job to demote in the MATLAB Job Scheduler cluster, specified as a parallel.Job object.

    You can also use the demote 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 demote function on parallel.cluster.MJS objects.

    Example: myCluster = parcluster("myMJSProfile")

    Tips

    • After a call to demote or promote, 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