Skip to content

Commit e4bc04b

Browse files
jshimada47GitHub Enterprise
authored andcommitted
Merge pull request #954 from isce-3/docker_pipe
Correct handling of "docker run" process after its workflow test case completes
2 parents ec5248c + 837a2f9 commit e4bc04b

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

tools/imagesets/imgset.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ def run_with_logging(dockercall, cmd, logger, printlog=True):
4444
# save command to log
4545
logger.info("++ " + cmdstr + "\n")
4646
pipe = subprocess.Popen(shlex.split(cmdstr), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
47+
48+
# Maximum number of seconds to wait for "docker run" to finish after
49+
# its child process exits. The observed times have been < 1 ms.
50+
# Use a relatively large number to flag a possible problem with Docker.
51+
timeout = 10
52+
4753
with pipe.stdout:
4854
for line in iter(pipe.stdout.readline, b''): # b'\n'-separated lines
4955
decoded = line.decode("utf-8")
@@ -52,6 +58,9 @@ def run_with_logging(dockercall, cmd, logger, printlog=True):
5258
decoded = decoded[:-1]
5359
logger.info(decoded)
5460
ret = pipe.poll()
61+
if ret is None:
62+
ret = pipe.wait(timeout=timeout)
63+
# ret will be None if exception TimeoutExpired was raised and caught.
5564
if ret != 0:
5665
raise subprocess.CalledProcessError(ret, cmdstr)
5766

@@ -670,10 +679,7 @@ def prdocs(self):
670679

671680
def tartests(self):
672681
"""
673-
Tar up test directories for delivery. PGE has requested that
674-
the scratch directory contents be excluded from the deliveries.
675-
Include the scratch directories only as empty directories to
676-
maintain consistency with the runconfigs.
682+
Tar up test directories for delivery
677683
"""
678684
for workflow in workflowtests:
679685
for test in workflowtests[workflow]:

0 commit comments

Comments
 (0)