User`s guide
Apply Callbacks to MJS Jobs and Tasks
6-25
Apply Callbacks to MJS Jobs and Tasks
The MATLAB job scheduler (MJS) has the ability to trigger callbacks in the client session
whenever jobs or tasks in the MJS cluster change to specific states.
Client objects representing jobs and tasks in an MJS cluster include the following
properties:
Callback
Property
Object Description
QueuedFcn Job only Specifies the function to execute in the client when a job is
submitted to the MJS queue
RunningFcn Job or
task
Specifies the function to execute in the client when a job or task
begins its execution
FinishedFcnJob or
task
Specifies the function to execute in the client when a job or task
completes its execution
Each of these properties can be set to any valid MATLAB callback value. The callback
follows the same behavior for Handle Graphics
®
, passing into the callback function the
object (job or task) that makes the call and an empty argument of event data.
These properties apply only in the client MATLAB session in which they are set. Later
sessions that access the same job or task objects do not inherit the settings from previous
sessions. You can apply the properties to existing jobs and tasks at the command-line,
but the cluster profile settings apply only at the time these objects are first created.
Note The callback properties are available only when using an MJS cluster.
Create Callbacks at the Command Line
This example shows how to create job and task callbacks at the client session command
line.
Create and save a callback function clientTaskCompleted.m on the path of the
MATLAB client, with the following content:
function clientTaskCompleted(task,eventdata)