You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/06/01 18:36:01 UTC

[GitHub] [beam] tvalentyn commented on a change in pull request #11867: [BEAM-10158] Use a shared unbounded thread pool within Beam Python.

tvalentyn commented on a change in pull request #11867:
URL: https://github.com/apache/beam/pull/11867#discussion_r433415504



##########
File path: sdks/python/apache_beam/utils/thread_pool_executor.py
##########
@@ -134,3 +134,12 @@ def shutdown(self, wait=True):
       if wait:
         for worker in self._workers:
           worker.join()
+
+
+class _SharedUnboundedThreadPoolExecutor(UnboundedThreadPoolExecutor):
+  def shutdown(self, wait=True):
+    # Prevent shutting down the shared thread pool
+    pass
+
+
+SharedUnboundedThreadPoolExecutor = _SharedUnboundedThreadPoolExecutor()

Review comment:
       +1, this is confusing.
   I would declare the global instance private to ```thread_pool_executor``` module (```_shared_thread_pool_executor```), and add a public getter function: ```thread_pool_executor.get_shared_executor()```.
   
   This is also recommended by http://google.github.io/styleguide/pyguide.html#254-decision.
   
   




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org