Syntax
[jobs,names]=getjobs
Output Parameter
jobs : | | array of jobs |
names : | | cell list of job names |
Examples
batch spindumpkill
getjobs; jobs=ans;
delete(jobs(end))
getjobs
Copyright 2023-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, getjobs
, retrieves and manages jobs running on the local MATLAB cluster. It is part of the SolidGeometry library and is used to test a toolbox without user interaction.
Input Parameters
The function does not take any input parameters.
Output Results
- jobs: An array of job objects currently running on the local cluster.
- names: A cell array containing the names of the jobs.
Algorithm Steps
- Suppress warnings related to the inability to cancel or destroy jobs on the local cluster using
warning('off','parallel:cluster:LocalCannotCancelOrDestroyJob');
.
- Create a cluster object for the local cluster with
myCluster = parcluster('local');
.
- Find and delete jobs with the state 'failed' using
findJob(myCluster,'State','failed'); delete(failed);
.
- Find and delete jobs with the state 'finished' using
findJob(myCluster,'State','finished'); delete(finish);
.
- Retrieve all jobs from the local cluster with
jobs=get(myCluster,'Jobs');
.
- Initialize an empty cell array
names
to store job names.
- Iterate over each job to retrieve its name, ID, and state:
- For each job, get its name using
get(jobs(i),'Name');
.
- Get the job ID using
get(jobs(i),'ID');
.
- Get the job state using
get(jobs(i),'State');
.
- Create a hyperlink for the job state to allow deletion of the job via MATLAB command line using
strhyperlink
.
- Format the job name and state into a string and store it in the
names
array.
- If no output arguments are specified, convert the
names
array to a string and print it to the command window, indicating the running local jobs.
Algorithm explaination created using ChatGPT on 2025-08-19 07:34. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21