gaogaotiantian commented on code in PR #53306:
URL: https://github.com/apache/spark/pull/53306#discussion_r2615737750
##########
python/pyspark/accumulators.py:
##########
@@ -266,12 +266,37 @@ def handle(self) -> None:
auth_token = self.server.auth_token # type: ignore[attr-defined]
def poll(func: Callable[[], bool]) -> None:
+ poller = None
+ if os.name == "posix":
+ # On posix systems use poll to avoid problems with file
descriptor
+ # numbers above 1024.
+ poller = select.poll()
+ poller.register(self.rfile, select.POLLIN)
+
while not self.server.server_shutdown: # type:
ignore[attr-defined]
# Poll every 1 second for new data -- don't block in case of
shutdown.
- r, _, _ = select.select([self.rfile], [], [], 1)
- if self.rfile in r and func():
+ r: set | list
+ if poller is not None:
+ r = set()
Review Comment:
Is there a reason to use `set` here instead of `list` which is what the
other path uses? I don't believe the performance matters here and there's no
duplication I think? Consistency might be a better option.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]