-
-
Notifications
You must be signed in to change notification settings - Fork 728
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
Remove is_python_shutting_down
#8492
Remove is_python_shutting_down
#8492
Conversation
Unit Test ResultsSee test report for an extended history of previous test failures. This is useful for diagnosing flaky tests. 29 files ±0 29 suites ±0 11h 18m 15s ⏱️ + 3m 1s For more details on these failures and errors, see this check. Results for commit b9b1678. ± Comparison against base commit 50700f3. ♻️ This comment has been updated with latest results. |
is_python_shutting_down
is_python_shutting_down
is_python_shutting_down
is_python_shutting_down
cc @rjzamora in case RAPIDS uses |
if is_python_shutting_down(): | ||
|
||
# Are we shutting down the process? | ||
if self._is_finalizing() or not threading.main_thread().is_alive(): |
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.
This isn't great, but it's the safest way of checking whether the interpreter is shutting down. More concretely, whether it's safe to use threads. Threads are being shutdown before atexit
hooks so we need a mechanism like is_python_shutting_down
that becomes the first atexit
hook in distributed
and lets us know whether we have entered shutdown, or we need to propagate that knowledge during shutdown, or we need to check whether it's safe to use threads where necessary (as done here).
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.
what a mess. I'm fine with this
This PR binds
sys.is_finalizing
to make sure that it's always available during interpreter shutdown and removes the (to the best of my knowledge superfluous)is_python_shutting_down
.This handles errors during shutdown like
pre-commit run --all-files