quemb.shared.manage_scratch.WorkDir.from_environment¶
- classmethod WorkDir.from_environment(*, user_defined_root=None, prefix=None, cleanup_at_end=True, ensure_empty=False)¶
Create a WorkDir based on the environment.
The naming scheme is
f"{user_defined_root}/{prefix}{SLURM_JOB_ID}"on systems withSLURM. IfSLURMis not available, then the process ID is used instead.- Parameters:
user_defined_root (
str|PathLike|None) – The root directory where to create temporary directories e.g./tmpor/scratch. IfNone, then theSCRATCH_ROOTvalue fromquemb.shared.config.Settingsis taken.cleanup_at_end (
bool) – Perform cleanup when callingself.cleanup.ensure_empty (
bool) – Delete the contents of the directory, if it already exists.
- Return type:
Self