cwltool.singularity
¶
Support for executing Docker containers using the Singularity 2.x engine.
Module Contents¶
Classes¶
Commandline job using containers. |
Functions¶
Parse the output of 'singularity --version' to determine the singularity flavor / |
|
Check if apptainer singularity distribution is version 1.0 or higher. |
|
Check if this singularity version is exactly version 2.6. |
|
Check if this version is singularity version 3 or newer or equivalent. |
|
Check if this version is singularity version 3.1 or newer or equivalent. |
|
Detect if Singularity v3.4+ is available. |
- cwltool.singularity.get_version()¶
Parse the output of ‘singularity –version’ to determine the singularity flavor / distribution (singularity, singularity-ce or apptainer) and the singularity version. Both pieces of information will be cached.
A tuple containing: - A tuple with major and minor version numbers as integer. - A string with the name of the singularity flavor.
- Return type
Tuple[List[int], str]
- cwltool.singularity.is_apptainer_1_or_newer()¶
Check if apptainer singularity distribution is version 1.0 or higher.
Apptainer v1.0.0 is compatible with SingularityCE 3.9.5. See: https://github.com/apptainer/apptainer/releases
- Return type
bool
- cwltool.singularity.is_version_2_6()¶
Check if this singularity version is exactly version 2.6.
Also returns False if the flavor is not singularity or singularity-ce.
- Return type
bool
- cwltool.singularity.is_version_3_or_newer()¶
Check if this version is singularity version 3 or newer or equivalent.
- Return type
bool
- cwltool.singularity.is_version_3_1_or_newer()¶
Check if this version is singularity version 3.1 or newer or equivalent.
- Return type
bool
- cwltool.singularity.is_version_3_4_or_newer()¶
Detect if Singularity v3.4+ is available.
- Return type
bool
- class cwltool.singularity.SingularityCommandLineJob(builder, joborder, make_path_mapper, requirements, hints, name)¶
Bases:
cwltool.job.ContainerCommandLineJob
Commandline job using containers.
- Parameters
builder (cwltool.builder.Builder) –
joborder (cwltool.utils.CWLObjectType) –
make_path_mapper (Callable[Ellipsis, cwltool.pathmapper.PathMapper]) –
requirements (List[cwltool.utils.CWLObjectType]) –
hints (List[cwltool.utils.CWLObjectType]) –
name (str) –
- static get_image(dockerRequirement, pull_image, force_pull=False)¶
Acquire the software container image in the specified dockerRequirement.
Uses Singularity and returns the success as a bool. Updates the provided dockerRequirement with the specific dockerImageId to the full path of the local image, if found. Likewise the dockerRequirement[‘dockerPull’] is updated to a docker:// URI if needed.
- Parameters
dockerRequirement (Dict[str, str]) –
pull_image (bool) –
force_pull (bool) –
- Return type
bool
- get_from_requirements(self, r, pull_image, force_pull, tmp_outdir_prefix)¶
Return the filename of the Singularity image.
(e.g. hello-world-latest.{img,sif}).
- Parameters
r (cwltool.utils.CWLObjectType) –
pull_image (bool) –
force_pull (bool) –
tmp_outdir_prefix (str) –
- Return type
Optional[str]
- static append_volume(runtime, source, target, writable=False)¶
Add binding arguments to the runtime list.
- Parameters
runtime (List[str]) –
source (str) –
target (str) –
writable (bool) –
- Return type
None
- add_file_or_directory_volume(self, runtime, volume, host_outdir_tgt)¶
Append volume a file/dir mapping to the runtime option list.
- Parameters
runtime (List[str]) –
volume (cwltool.pathmapper.MapperEnt) –
host_outdir_tgt (Optional[str]) –
- Return type
None
- add_writable_file_volume(self, runtime, volume, host_outdir_tgt, tmpdir_prefix)¶
Append a writable file mapping to the runtime option list.
- Parameters
runtime (List[str]) –
volume (cwltool.pathmapper.MapperEnt) –
host_outdir_tgt (Optional[str]) –
tmpdir_prefix (str) –
- Return type
None
- add_writable_directory_volume(self, runtime, volume, host_outdir_tgt, tmpdir_prefix)¶
Append a writable directory mapping to the runtime option list.
- Parameters
runtime (List[str]) –
volume (cwltool.pathmapper.MapperEnt) –
host_outdir_tgt (Optional[str]) –
tmpdir_prefix (str) –
- Return type
None
- create_runtime(self, env, runtime_context)¶
Return the Singularity runtime list of commands and options.
- Parameters
env (MutableMapping[str, str]) –
runtime_context (cwltool.context.RuntimeContext) –
- Return type
Tuple[List[str], Optional[str]]