%% Get Scheduler IDs of Tasks
% Create a cluster object by using parcluster. In the code below, change MyThirdPartyScheduler to the name of the profile of your third-party scheduler.

c = parcluster('MyThirdPartyScheduler');

% Create a job and create some tasks for it. Then, submit the job.

job = createJob(c);
for idx = 1:2
    createTask(job,@ode45,2,{@vdp1,[0,10],[idx,0]});
end
submit(job)

% To get the scheduler IDs of the tasks on the job, use getTaskSchedulerIDs. You can use these IDs to refer to the corresponding jobs on the third-party scheduler.

getTaskSchedulerIDs(job)

% In this case, the scheduler has assigned the ID 4933 to this job.
% Wait for the job to finish and fetch its outputs.

wait(job);
out = fetchOutputs(job)

% When you are done retrieving information from the job, delete it to clean up its data.

delete(job);
clear job

% Copyright 2019 The MathWorks, Inc.