-
Couldn't load subscription status.
- Fork 3.4k
Fix handling key keyboard interrupt in parallel testsuite #11299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,6 +11,7 @@ | |
| import unittest | ||
| import tempfile | ||
| import time | ||
| import signal | ||
|
|
||
| from tools.tempfiles import try_delete | ||
|
|
||
|
|
@@ -22,6 +23,7 @@ | |
|
|
||
|
|
||
| def g_testing_thread(work_queue, result_queue, temp_dir): | ||
| signal.signal(signal.SIGINT, signal.SIG_IGN) | ||
| for test in iter(lambda: get_from_queue(work_queue), None): | ||
| result = BufferedParallelTestResult() | ||
| test.set_temp_dir(temp_dir) | ||
|
|
@@ -48,8 +50,14 @@ def __init__(self, max_cores): | |
|
|
||
| def run(self, result): | ||
| test_queue = self.create_test_queue() | ||
| self.init_processes(test_queue) | ||
| results = self.collect_results() | ||
| try: | ||
| self.init_processes(test_queue) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this line need to be inside the try? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Presumably if init-ing fails we might need to clean up... forget what it does and if/how it can fail though. |
||
| results = self.collect_results() | ||
| finally: | ||
| for p in self.processes: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe a comment here too, why this is needed? |
||
| p.terminate() | ||
| p.join() | ||
| self.processes.clear() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume the latter allocates a new array object/id? If so: that's comment-worthy, cause it's a nonlocal concern. |
||
| return self.combine_results(result, results) | ||
|
|
||
| def create_test_queue(self): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a comment here? I'm not sure what this does or how it helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I don't speak signal