-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-48634][PYTHON][CONNECT] Avoid statically initialize threadpool at ExecutePlanResponseReattachableIterator #46993
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
Conversation
7835ef1 to
c177228
Compare
| if not self._is_shutdown: | ||
| self._release_thread_pool.apply_async(target) |
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 code is a bit confusing to me, but it might simply because of the way Python works. My understanding was that self only gives me access to instance but not class variables, but _release_thread_pool is an actual class variable.
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 It actually accesses to the class variable, and it is not either discouraged or encouraged in PEP 8 if I am correctly remembering this. I just used self to make it look consistent, e.g., at shutdown but I don't mind changing it back to explicit ExecutePlanResponseReattachableIterator.
Co-authored-by: Martin Grund <[email protected]>
|
Merged to master. |
|
@HyukjinKwon I am seeing such failure in two PRs (1, 2): But I can reproduce it locally, would you mind taking a look? |
|
Yeah will do. I think i know the cause. |
…readpool is not initialized ### What changes were proposed in this pull request? This PR proposes to not make a request if threadpool is not initialized to keep the same behaviour before #46993. ### Why are the changes needed? To make Python exit slient. ### Does this PR introduce _any_ user-facing change? Virtually no. ### How was this patch tested? Manually tested, with long running Python job and exiting it. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #47034 from HyukjinKwon/SPARK-48634-followup. Authored-by: Hyukjin Kwon <[email protected]> Signed-off-by: Hyukjin Kwon <[email protected]>
What changes were proposed in this pull request?
This PR propose to avoid having
ExecutePlanResponseReattachableIterator._release_thread_poolto initializeThreadPool.Why are the changes needed?
This instance might be dragged in during pickle because it's statically initialized.
which requires to change in OS level.
Does this PR introduce any user-facing change?
Yeah, potentially this could trigger some random job failures in some environment like Ubuntu
How was this patch tested?
Manually tested.
Was this patch authored or co-authored using generative AI tooling?
No.