Main Content


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



    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.


    collapse all

    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.


    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

    collapse all

    Pool, job, or task, specified as a parallel.ProcessPool, parallel.ClusterPool, parallel.Job, or parallel.Task object.

    If obj is a job, the AutoAttachFiles property must be true. If obj is a task, the AutoAttachFiles property of the parent job must be true.

    Example: obj = parpool('Processes');

    Example: obj = batch(@magic,1,{3});

    Version History

    Introduced in R2013a