recreate

Create new job from existing job

Syntax

newjob = recreate(oldjob)
newjob = recreate(oldjob,'TaskState', states)
newjob = recreate(oldjob,'TaskID', ids)

Arguments

newjob

New job object.

oldjobOriginal job object to be duplicated.
'TaskID'Option to include only some tasks
idsVector of integers specifying task IDs

Description

newjob = recreate(oldjob) creates a new job object based on an existing job, containing the same tasks and settable properties as oldjob. The old job can be in any state; the new job state is pending.

newjob = recreate(oldjob,'TaskState', states) creates a job object with tasks that correspond to the tasks with State specified by states. states is a string or cell array of strings representing the State of the required tasks from oldjob. Because communicating jobs have only one task, this option only supports independent jobs. Valid states are 'pending', 'running', 'finished' and 'failed'.

newjob = recreate(oldjob,'TaskID', ids) creates a job object containing the tasks from oldjob that correspond to the tasks with IDs specified by ids, a vector of integers. Because communicating jobs have only one task, this option only supports independent jobs.

Examples

Example 7. Recreate an Entire Job

This example shows how to recreate the entire job myJob.

newJob = recreate(myJob)               
Example 8. Recreate a Job with only pending Tasks

This example shows how to recreate an independent job, which has only pending tasks from the job oldIndependentJob.

newJob = recreate(oldIndependentJob,'TaskState','pending');
Example 9. Recreate a Job with Specified Tasks

This example shows how to recreate an independent job, which has only the tasks with IDs 21 to 32 from the job oldIndependentJob.

newJob = recreate(oldIndependentJob,'TaskID',[21:32]);
Example 10. Recreate Jobs of a Specific User

This example shows how to find and recreate all failed jobs submitted by user Mary. Assume the default cluster is the one Mary had submitted her jobs to.

c = parcluster();
failedjobs = findJob(c,'Username','Mary','State','failed');
for m = 1:length(failedjobs)
    newJob(m) = recreate(failedjobs(m));
end

Introduced in R2014a

Was this topic helpful?