jobflow_remote.jobs.batch module#
- class jobflow_remote.jobs.batch.LocalBatchManager(files_dir: str | Path, process_id: str, multiprocess_lock=None)[source]#
Bases:
object
Manager of local files containing information about Jobs to be handled by a batch worker.
Used in the worker to executes the batch Jobs.
- Parameters:
files_dir – The full path to directory where the files to handle the jobs to be executed in batch processes are stored.
process_id – The uuid associated to the batch process.
multiprocess_lock – A lock from the multiprocessing module to be used when executing jobs in parallel with other processes of the same worker.
- get_job() str | None [source]#
Select randomly a job from the submitted directory to be executed. Move the file to the running directory.
Locks will prevent the same job from being executed from other processes. If no job can be executed, None is returned.
- Returns:
The name of the job that was selected, or None if no job can be executed.
- Return type:
str | None
- class jobflow_remote.jobs.batch.RemoteBatchManager(host: BaseHost, files_dir: str | Path)[source]#
Bases:
object
Manager of remote files containing information about Jobs to be handled by a batch worker.
Used by the Runner.
- Parameters:
host – The host where the files are.
files_dir – The full path to directory where the files are stored.
- get_running() list[tuple[str, int, str]] [source]#
Get job ids and process ids of the running jobs from the corresponding directory on the host.
- Returns:
The list of job ids, job indexes and batch process uuids in the host running directory.
- Return type:
- get_submitted() list[str] [source]#
Get a list of files present in the submitted directory.
- Return type:
The list of file names in the submitted directory.