quemb.shared.manage_scratch.WorkDir.from_environment¶
- classmethod WorkDir.from_environment(*, user_defined_root=None, prefix=None, cleanup_at_end=True)¶
Create a WorkDir based on the environment.
The naming scheme is
f"{user_defined_root}/{prefix}{SLURM_JOB_ID}"
on systems withSLURM
. IfSLURM
is 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./tmp
or/scratch
. IfNone
, then theSCRATCH_ROOT
value fromquemb.shared.config.Settings
is taken.cleanup_at_end (
bool
) – Perform cleanup when callingself.cleanup
.
- Return type: