listAutoAttachedFiles

List of files automatically attached to job, task, or parallel pool

Syntax

Description

example

listAutoAttachedFiles(obj) performs a dependency analysis on all the task functions, or on the batch job script or function. Then it displays a list of the code files that are already or going to be automatically attached to the job or task object obj.

If obj is a parallel pool, the output lists the files that have already been attached to the parallel pool following an earlier dependency analysis. The dependency analysis runs if a parfor or spmd block errors due to an undefined function. At that point any files, functions, or scripts needed by the parfor or spmd block are attached if possible.

Examples

expand all

Automatically Attach Files via Cluster Profile

Employ a cluster profile to automatically attach code files to a job. Set the AutoAttachFiles property for a job in the cluster's profile. If this property value is true, then all jobs you create on that cluster with this profile will have the necessary code files automatically attached. This example assumes that the cluster profile myAutoCluster has that setting.

Create batch job, applying your cluster.

obj = batch(myScript,'profile','myAutoCluster');

Verify attached files by viewing list.

listAutoAttachedFiles(obj)

Automatically Attach Files Programmatically

Programmatically set a job to automatically attach code files, and then view a list of those files for one of the tasks in the job.

c = parcluster(); % Use default profile
j = createJob(c);
j.AutoAttachFiles = true;
obj = createTask(j,myFun,OutNum,ArgCell);
listAutoAttachedFiles(obj) % View attached list

The files returned in the output listing are those that analysis has determined to be required for the workers to evaluate the function myFun, and which automatically attach to the job.

Input Arguments

expand all

obj — Job, task, or pool to which files automatically attachjob object | task object | parallel pool object

Job, task, or pool to which code files are automatically attached, specified as a parallel.Job, parallel.Task, or parallel.Pool object. The AutoAttachFiles property of the job object must be true; if the input is a task object, then this applies to its parent job object.

Example: obj = createJob(cluster);

Example: obj = gcp

Was this topic helpful?