Skip to content

Commit 227bca9

Browse files
committed
handle another PermissionError
1 parent 56552ed commit 227bca9

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

cwltool/job.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -718,12 +718,16 @@ def docker_monitor(self, cidfile, tmpdir_prefix, cleanup_cidfile, process):
718718
max_mem = psutil.virtual_memory().total
719719
tmp_dir, tmp_prefix = os.path.split(tmpdir_prefix)
720720
stats_file = tempfile.NamedTemporaryFile(prefix=tmp_prefix, dir=tmp_dir)
721-
with open(stats_file.name, mode="w") as stats_file_handle:
722-
stats_proc = subprocess.Popen(
723-
['docker', 'stats', '--no-trunc', '--format', '{{.MemPerc}}',
724-
cid], stdout=stats_file_handle, stderr=subprocess.DEVNULL)
725-
process.wait()
726-
stats_proc.kill()
721+
try:
722+
with open(stats_file.name, mode="w") as stats_file_handle:
723+
stats_proc = subprocess.Popen(
724+
['docker', 'stats', '--no-trunc', '--format', '{{.MemPerc}}',
725+
cid], stdout=stats_file_handle, stderr=subprocess.DEVNULL)
726+
process.wait()
727+
stats_proc.kill()
728+
except PermissionError as exc:
729+
_logger.warn("Ignored error with docker stats: %s", exc)
730+
return
727731
max_mem_percent = 0
728732
with open(stats_file.name, mode="r") as stats:
729733
for line in stats:

0 commit comments

Comments
 (0)