-
Notifications
You must be signed in to change notification settings - Fork 990
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
Greedy router #3360
Greedy router #3360
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
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.
Thank you for taking the time digging this out!! The fix looks good to me, as it is covered by tests. However, it would be great to put a test around it so that we can prevent regression (like what we have now).
The test would run a minimal instance where we can prove that the algorithm would run on infinite loops without this fix, but fast (<1s) with the fix. The algorithm would run in a separate process that we should measure if it finishes within the expected time. Can you find a graph instance like that?
… greedy_router
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.
LGTM - One more nit
Thanks for adding the test, I just tried it out and it works nicely! :)
We should make the timeout 5 seconds to avoid flakes, on my Mac it runs just above 2 seconds.
process.join(timeout=1) | ||
alive = process.is_alive() | ||
if alive: | ||
process.terminate() |
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 would do something like this instead - this takes care of the coverage issue as well
try:
assert not process.is_alive(), "Greedy router timeout"
finally:
process.terminate()
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.
Cool, thanks! Was happy to contribute. It looks like all tests passed now.:)
Fixes issue #3056. Fixes hanging greedy router on some circuit instances by partially reverting changes from 6d81ddb.