@@ -36,14 +36,21 @@ def run_with_logging(dockercall, cmd, logger, printlog=True):
36
36
printlog : boolean, optional
37
37
Print log to console
38
38
"""
39
+ import datetime ;
39
40
logger .propagate = printlog
40
41
# remove extra whitespace
41
42
normalize = lambda s : subprocess .list2cmdline (shlex .split (s ))
42
43
# format command string for logging
43
44
cmdstr = normalize (dockercall ) + ' "\n ' + '' .join (f'{ "" :<6} { normalize (c )} \n ' for c in cmd ) + '"'
44
45
# save command to log
45
46
logger .info ("++ " + cmdstr + "\n " )
46
- pipe = subprocess .Popen (shlex .split (cmdstr ), stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
47
+ pipe = subprocess .Popen (shlex .split (cmdstr ), stdout = subprocess .PIPE , stderr = subprocess .STDOUT , shell = False )
48
+
49
+ # Maximum number of seconds to wait for "docker run" to finish after
50
+ # its child process exits. The observed times have been < 1 ms.
51
+ # Use a relatively large number to flag a possible problem with Docker.
52
+ timeout = 10
53
+
47
54
with pipe .stdout :
48
55
for line in iter (pipe .stdout .readline , b'' ): # b'\n'-separated lines
49
56
decoded = line .decode ("utf-8" )
@@ -52,7 +59,12 @@ def run_with_logging(dockercall, cmd, logger, printlog=True):
52
59
decoded = decoded [:- 1 ]
53
60
logger .info (decoded )
54
61
ret = pipe .poll ()
55
- if ret != 0 :
62
+ if ret == None :
63
+ ret = pipe .wait (timeout = timeout )
64
+ # ret will be None if exception TimeoutExpired was raised and caught.
65
+ if ret != 0 :
66
+ raise subprocess .CalledProcessError (ret , cmdstr )
67
+ elif ret != 0 :
56
68
raise subprocess .CalledProcessError (ret , cmdstr )
57
69
58
70
# A set of docker images suitable for building and running isce3
@@ -670,12 +682,9 @@ def prdocs(self):
670
682
671
683
def tartests (self ):
672
684
"""
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.
685
+ Tar up test directories for delivery
677
686
"""
678
687
for workflow in workflowtests :
679
688
for test in workflowtests [workflow ]:
680
689
print (f"\n tarring workflow test { test } \n " )
681
- subprocess .check_call (f"tar cvz --exclude scratch*/* -f { test } .tar.gz { test } " .split (), cwd = self .testdir )
690
+ subprocess .check_call (f"tar cvzf { test } .tar.gz { test } " .split (), cwd = self .testdir )
0 commit comments