-
Notifications
You must be signed in to change notification settings - Fork 61
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
Prevent experiment hanging when worker is killed by OS [Resolves #501] #506
Conversation
Codecov Report
@@ Coverage Diff @@
## master #506 +/- ##
==========================================
- Coverage 82.63% 82.51% -0.13%
==========================================
Files 81 81
Lines 4629 4660 +31
==========================================
+ Hits 3825 3845 +20
- Misses 804 815 +11
Continue to review full report at Codecov.
|
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.
Looks reasonable to me.
But I'm curious, is the OOM-handling specific to Pebble, rather than to all the concurrency stuff that was added in Python 3? There's so much high-level concurrency stuff in Python 3, I was just a little surprised that another library would be necessary.
It looks like the big change is that we use a future
, and can handle exceptions in child processes. But, abstractly, that's not unique to Pebble.
I did look into vanilla concurrent.futures. It does claim to provide the process dying functionality. But it does not allow a |
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.
Huh yeah – that's weird, but OK 👍
num_failures += 1 | ||
results.append(result) | ||
logging.exception('Child failure') |
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.
I really prefer the clarity of try/except/else but NBD:
try:
result = next(iterator)
except StopIteration:
break
except Exception:
logging.exception(...)
num_failures += 1
else:
results.append(result)
num_successes += 1
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.
Looks good to me.
Converts the MulticoreExperiment to use Pebble instead of multiprocessing. This allows us to wrap the ProcessExpired exception in the case of the operating system (or something else) killing the subprocess. This ensures the process pool can keep going and provide useful information in the logs.
49b5d60
to
c15d51c
Compare
Converts the MulticoreExperiment to use Pebble instead of
multiprocessing.
This allows us to wrap the ProcessExpired exception in the case of
the operating system (or something else) killing the subprocess. This
ensures the process pool can keep going and provide useful information
in the logs.