Skip to content

Commit cc1a1a6

Browse files
committed
documentation
1 parent 70e4a87 commit cc1a1a6

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

cwltool/singularity.py

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import sys
99
from io import open
1010

11-
from typing import (Dict, List, Text, MutableMapping, Any)
11+
from typing import (Dict, List, Text, Optional, MutableMapping, Any)
1212

1313
from .errors import WorkflowException
1414
from .job import ContainerCommandLineJob
@@ -21,8 +21,18 @@
2121

2222
class SingularityCommandLineJob(ContainerCommandLineJob):
2323
@staticmethod
24-
def get_image(dockerRequirement, pull_image, dry_run=False):
25-
# type: (Dict[Text, Text], bool, bool) -> bool
24+
def get_image(dockerRequirement, # type: Dict[Text, Text]
25+
pull_image, # type: bool
26+
dry_run=False # type: bool
27+
):
28+
# type: (...) -> bool
29+
"""
30+
Acquire the software container image in the specified dockerRequirement
31+
using Singularity and returns the success as a bool. Updates the
32+
provided dockerRequirement with the specific dockerImageId to the full
33+
path of the local image, if found. Likewise the
34+
dockerRequirement['dockerPull'] is updated to a docker:// URI if needed.
35+
"""
2636
found = False
2737

2838
if "dockerImageId" not in dockerRequirement and "dockerPull" in dockerRequirement:
@@ -77,12 +87,22 @@ def get_image(dockerRequirement, pull_image, dry_run=False):
7787

7888
return found
7989

80-
def get_from_requirements(self, r, req, pull_image, dry_run=False, force_pull=False):
81-
# type: (Dict[Text, Text], bool, bool, bool, bool) -> Text
82-
# returns the filename of the Singularity image (e.g. hello-world-latest.img)
90+
def get_from_requirements(self,
91+
r, # type: Optional[Dict[Text, Text]]
92+
req, # type: bool
93+
pull_image, # type: bool
94+
dry_run=False, # type: bool
95+
force_pull=False # type: bool
96+
):
97+
# type: (...) -> Text
98+
"""
99+
Returns the filename of the Singularity image (e.g.
100+
hello-world-latest.img).
101+
"""
83102

84103
if force_pull:
85-
_logger.warn("--force-docker-pull currently not supported for singularity")
104+
_logger.warning("--force-docker-pull currently not supported for "
105+
"singularity")
86106

87107
if r:
88108
errmsg = None
@@ -160,12 +180,19 @@ def add_volumes(self, pathmapper, runtime, stage_output):
160180
docker_windows_path_adjust(createtmp),
161181
docker_windows_path_adjust(vol.target)))
162182

163-
def create_runtime(self, env, rm_container=True, record_container_id=False, cidfile_dir="",
164-
cidfile_prefix="", **kwargs):
165-
# type: (MutableMapping[Text, Text], bool, bool, Text, Text, **Any) -> List
183+
def create_runtime(self,
184+
env, # type: MutableMapping[Text, Text]
185+
rm_container=True, # type: bool
186+
record_container_id=False, # type: bool
187+
cidfile_dir="", # type: Text
188+
cidfile_prefix="", # type: Text
189+
**kwargs
190+
):
191+
# type: (...) -> List
192+
""" Returns the Singularity runtime list of commands and options."""
166193

167194
runtime = [u"singularity", u"--quiet", u"exec", u"--contain", u"--pid",
168-
u"--ipc"] # , u"--userns"]
195+
u"--ipc"] # , u"--userns"]
169196
runtime.append(u"--bind")
170197
runtime.append(u"{}:{}:rw".format(
171198
docker_windows_path_adjust(os.path.realpath(self.outdir)),

0 commit comments

Comments
 (0)