Create new job from existing job
newjob = recreate(oldjob)
newjob = recreate(oldjob,'TaskState', states)
newjob = recreate(oldjob,'TaskID', ids)
| New job object. |
oldjob | Original job object to be duplicated. |
'TaskID' | Option to include only some tasks |
ids | Vector of integers specifying task IDs |
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.
This example shows how to recreate the entire job myJob.
newJob = recreate(myJob)
This example shows how to recreate an independent job, which
has only pending tasks from the job oldIndependentJob.
newJob = recreate(oldIndependentJob,'TaskState','pending');
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]);
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
createCommunicatingJob | createJob | createTask | findJob | submit