findTask - Task objects belonging to job object

Syntax

tasks = findTask(obj)
[pending running finished] = findTask(obj)
tasks = findTask(obj,'p1',v1,'p2',v2,...)

Arguments

obj

Job object.

tasks

Returned task objects.

pending

Array of tasks in job obj whose State is pending.

running

Array of tasks in job obj whose State is running.

finished

Array of tasks in job obj whose State is finished.

p1, p2

Task object properties to match.

v1, v2

Values for corresponding object properties.

Description

tasks = findTask(obj) gets a 1-by-N array of task objects belonging to a job object obj Tasks in the array are ordered by the ID property of the tasks, indicating the sequence in which they were created.

[pending running finished] = findTask(obj) returns arrays of all task objects stored in the job object obj, sorted by state. Within each state (pending, running, and finished), the tasks are returned in sequence of creation.

tasks = findTask(obj,'p1',v1,'p2',v2,...) gets a 1-by-N array of task objects belonging to a job object obj. The returned task objects will be only those having the specified property-value pairs.

Note that the property value pairs can be in any format supported by the set function, i.e., param-value string pairs, structures, and param-value cell array pairs. If a structure is used, the structure field names are object property names and the field values are the appropriate property values to match.

When a property value is specified, it must use the same exact value that the get function returns, including letter case. For example, if get returns the Name property value as MyTask, then findTask will not find that object while searching for a Name property value of mytask.

Remarks

If obj is contained in a remote service, findTask will result in a call to the remote service. This could result in findTask taking a long time to complete, depending on the number of tasks retrieved and the network speed. Also, if the remote service is no longer available, an error will be thrown.

Examples

Create a job object.

jm = findResource('scheduler','type','jobmanager', ...
          'name','MyJobManager','LookupURL','JobMgrHost');
obj = createJob(jm);

Add a task to the job object.

createTask(obj, @rand, 1, {10})

Create the task object t, which refers to the task we just added to obj.

t = findTask(obj)

See Also

createJob, createTask, findJob

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS