Skip to content

Commit 20ae02c

Browse files
authored
Merge branch 'master' into fix-832
2 parents 06a8b02 + e7e479b commit 20ae02c

File tree

3 files changed

+27
-14
lines changed

3 files changed

+27
-14
lines changed

Makefile

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,11 @@ coverage.html: htmlcov/index.html
134134
htmlcov/index.html: .coverage
135135
coverage html
136136

137-
diff-cover: coverage-gcovr.xml coverage.xml
138-
diff-cover coverage-gcovr.xml coverage.xml
137+
diff-cover: coverage.xml
138+
diff-cover $^
139139

140-
diff-cover.html: coverage-gcovr.xml coverage.xml
141-
diff-cover coverage-gcovr.xml coverage.xml \
142-
--html-report diff-cover.html
140+
diff-cover.html: coverage.xml
141+
diff-cover $^ --html-report diff-cover.html
143142

144143
## test : run the ${MODULE} test suite
145144
test: $(pysources)

cwltool/docker.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
from .secrets import SecretStore # pylint: disable=unused-import
2323
from .utils import (DEFAULT_TMP_PREFIX, docker_windows_path_adjust, onWindows,
2424
subprocess)
25-
from .context import RuntimeContext
25+
from .context import RuntimeContext # pylint: disable=unused-import
2626

27-
found_images = set() # type: Set[Text]
28-
found_images_lock = threading.Lock()
27+
_IMAGES = set() # type: Set[Text]
28+
_IMAGES_LOCK = threading.Lock()
2929
__docker_machine_mounts = None # type: Optional[List[Text]]
3030
__docker_machine_mounts_lock = threading.Lock()
3131

@@ -91,8 +91,8 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
9191
and "dockerPull" in docker_requirement:
9292
docker_requirement["dockerImageId"] = docker_requirement["dockerPull"]
9393

94-
with found_images_lock:
95-
if docker_requirement["dockerImageId"] in found_images:
94+
with _IMAGES_LOCK:
95+
if docker_requirement["dockerImageId"] in _IMAGES:
9696
return True
9797

9898
for line in subprocess.check_output(
@@ -132,7 +132,7 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
132132
elif "dockerFile" in docker_requirement:
133133
dockerfile_dir = str(tempfile.mkdtemp(prefix=tmp_outdir_prefix))
134134
with open(os.path.join(
135-
dockerfile_dir, "Dockerfile"), "wb") as dfile:
135+
dockerfile_dir, "Dockerfile"), "wb") as dfile:
136136
dfile.write(docker_requirement["dockerFile"].encode('utf-8'))
137137
cmd = ["docker", "build", "--tag=%s" %
138138
str(docker_requirement["dockerImageId"]), dockerfile_dir]
@@ -171,8 +171,8 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
171171
found = True
172172

173173
if found:
174-
with found_images_lock:
175-
found_images.add(docker_requirement["dockerImageId"])
174+
with _IMAGES_LOCK:
175+
_IMAGES.add(docker_requirement["dockerImageId"])
176176

177177
return found
178178

@@ -339,7 +339,7 @@ def create_runtime(self, env, runtimeContext):
339339

340340
# add parameters to docker to write a container ID file
341341
if runtimeContext.record_container_id:
342-
cidfile_dir = runtimeContext.cidfile_
342+
cidfile_dir = runtimeContext.cidfile_dir
343343
if cidfile_dir != "":
344344
if not os.path.isdir(cidfile_dir):
345345
_logger.error("--cidfile-dir %s error:\n%s", cidfile_dir,

tests/test_examples.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import json
44
import logging
55
import shutil
6+
import os
67
import sys
78
import tempfile
89
import unittest
@@ -643,6 +644,19 @@ def test_no_js_console(self):
643644
self.assertNotIn("[log] Log message", stderr)
644645
self.assertNotIn("[err] Error message", stderr)
645646

647+
@needs_docker
648+
class TestRecordContainerId(TestCmdLine):
649+
def test_record_container_id(self):
650+
test_file = "cache_test_workflow.cwl"
651+
cid_dir = tempfile.mkdtemp("cwltool_test_cid")
652+
error_code, _, stderr = self.get_main_output(
653+
["--record-container-id", "--cidfile-dir", cid_dir,
654+
get_data("tests/wf/" + test_file)])
655+
self.assertIn("completed success", stderr)
656+
self.assertEqual(error_code, 0)
657+
self.assertEqual(len(os.listdir(cid_dir)), 2)
658+
shutil.rmtree(cid_dir)
659+
646660

647661
@needs_docker
648662
class TestCache(TestCmdLine):

0 commit comments

Comments
 (0)