FileStore
Description
FileStore
is an object that stores files owned by a specific
job. Each entry of the object consists of a file and its corresponding key. When the owning
job is deleted, the FileStore
object is deleted as well. Use
FileStore
to store files from MATLAB® workers that can be retrieved by MATLAB clients during the execution of a job (even while the job is still
running).
Any MATLAB process client or worker can write an entry to the
FileStore
at any time. Any MATLAB process client or worker can then read this entry from theFileStore
at any time. However, the ordering of operations executed by different processes is not guaranteed.FileStore
can be used to return files when a cluster has no shared file system, or to run code that is not concerned about the location of any shared file system.FileStore
is not held in system memory, so it can be used to store large results.
Creation
The FileStore
object is automatically created when you create:
A job on a cluster, which is a
parallel.Job
object. To create a job, use thebatch
,createJob
, orcreateCommunicatingJob
function.A parallel pool of process workers on the local machine, which is a
ProcessPool
object. To create a process pool, use theparpool
function.A parallel pool of thread workers on the local machine, which is a
ThreadPool
object. To create a thread pool, use theparpool
function. (since R2023b)A parallel pool of workers on a cluster of machines, which is a
ClusterPool
object. To create a cluster pool, use theparpool
function.
You can access the FileStore
object on a worker by using the getCurrentFileStore
function. You can then retrieve the
FileStore
object on a client by using the FileStore
property that is associated with the job or the parallel pool. For example, see Run Batch Job and Retrieve Files from Workers.
Properties
Object Functions
isKey | Determine if ValueStore or FileStore object
contains keys |
keys | Return all keys of ValueStore or FileStore
object |
copyFileToStore | Copy files from local file system to FileStore
object |
copyFileFromStore | Copy files from FileStore object to local file
system |
remove | Remove entries from ValueStore or FileStore
object |
Examples
Limitations
When using
parallel.cluster.Generic
clusters with'HasSharedFileSystem'
set tofalse
, the visibility of modifications made toFileStore
while a job is running depends on your specific implementation. Without additional synchronization between the MATLAB client and workerJobStorageLocation
, changes might only be visible once the job has completed.
Version History
Introduced in R2022aSee Also
getCurrentFileStore
| parallel.Job
| ProcessPool
| ClusterPool
| ValueStore