|
22 | 22 | from .secrets import SecretStore # pylint: disable=unused-import
|
23 | 23 | from .utils import (DEFAULT_TMP_PREFIX, docker_windows_path_adjust, onWindows,
|
24 | 24 | subprocess)
|
25 |
| -from .context import RuntimeContext |
| 25 | +from .context import RuntimeContext # pylint: disable=unused-import |
26 | 26 |
|
27 |
| -found_images = set() # type: Set[Text] |
28 |
| -found_images_lock = threading.Lock() |
| 27 | +_IMAGES = set() # type: Set[Text] |
| 28 | +_IMAGES_LOCK = threading.Lock() |
29 | 29 | __docker_machine_mounts = None # type: Optional[List[Text]]
|
30 | 30 | __docker_machine_mounts_lock = threading.Lock()
|
31 | 31 |
|
@@ -91,8 +91,8 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
|
91 | 91 | and "dockerPull" in docker_requirement:
|
92 | 92 | docker_requirement["dockerImageId"] = docker_requirement["dockerPull"]
|
93 | 93 |
|
94 |
| - with found_images_lock: |
95 |
| - if docker_requirement["dockerImageId"] in found_images: |
| 94 | + with _IMAGES_LOCK: |
| 95 | + if docker_requirement["dockerImageId"] in _IMAGES: |
96 | 96 | return True
|
97 | 97 |
|
98 | 98 | for line in subprocess.check_output(
|
@@ -132,7 +132,7 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
|
132 | 132 | elif "dockerFile" in docker_requirement:
|
133 | 133 | dockerfile_dir = str(tempfile.mkdtemp(prefix=tmp_outdir_prefix))
|
134 | 134 | with open(os.path.join(
|
135 |
| - dockerfile_dir, "Dockerfile"), "wb") as dfile: |
| 135 | + dockerfile_dir, "Dockerfile"), "wb") as dfile: |
136 | 136 | dfile.write(docker_requirement["dockerFile"].encode('utf-8'))
|
137 | 137 | cmd = ["docker", "build", "--tag=%s" %
|
138 | 138 | str(docker_requirement["dockerImageId"]), dockerfile_dir]
|
@@ -171,8 +171,8 @@ def get_image(docker_requirement, # type: Dict[Text, Text]
|
171 | 171 | found = True
|
172 | 172 |
|
173 | 173 | if found:
|
174 |
| - with found_images_lock: |
175 |
| - found_images.add(docker_requirement["dockerImageId"]) |
| 174 | + with _IMAGES_LOCK: |
| 175 | + _IMAGES.add(docker_requirement["dockerImageId"]) |
176 | 176 |
|
177 | 177 | return found
|
178 | 178 |
|
|
0 commit comments