Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Felix Seibert
xtreemfs_client
Commits
324810b6
Commit
324810b6
authored
Mar 22, 2018
by
Felix Seibert
Browse files
handling processes that do not terminate even after they got killed
parent
64fddaee
Changes
1
Hide whitespace changes
Inline
Side-by-side
xtreemfs_client/div_util.py
View file @
324810b6
...
...
@@ -86,6 +86,8 @@ def run_commands(commands, max_processes=200, print_errors=True):
for
finished_process
in
difference
:
del
running_processes_map
[
finished_process
]
timeout_processes
=
0
# for finished_process in running_processes:
for
still_running_process
in
running_processes_map
:
try
:
...
...
@@ -94,7 +96,11 @@ def run_commands(commands, max_processes=200, print_errors=True):
print
(
"process timed out: "
+
str
(
still_running_process
.
args
))
still_running_process
.
kill
()
print
(
"process killed."
)
stdout
,
stderr
=
still_running_process
.
communicate
(
timeout
=
10
)
try
:
stdout
,
stderr
=
still_running_process
.
communicate
(
timeout
=
10
)
except
subprocess
.
TimeoutExpired
:
timeout_processes
+=
1
continue
still_running_process
=
(
still_running_process
.
args
,
(
stdout
,
stderr
),
...
...
@@ -107,6 +113,9 @@ def run_commands(commands, max_processes=200, print_errors=True):
num_finished
+=
1
print
(
"progress: "
+
str
(
num_finished
)
+
"/"
+
str
(
num_total
))
if
timeout_processes
>
0
:
print
(
"number of processes with expired timeout: "
+
str
(
timeout_processes
))
return
errored_processes
# return list(map(lambda proc: (proc.args, proc.communicate(), proc.returncode), all_processes))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment