[
https://issues.apache.org/jira/browse/BEAM-8151?focusedWorklogId=344456&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-344456
]
ASF GitHub Bot logged work on BEAM-8151:
----------------------------------------
Author: ASF GitHub Bot
Created on: 15/Nov/19 17:51
Start Date: 15/Nov/19 17:51
Worklog Time Spent: 10m
Work Description: acrites commented on pull request #10123: [BEAM-8151]
Swap to create SdkWorkers on demand when processing jobs
URL: https://github.com/apache/beam/pull/10123#discussion_r346939524
##########
File path: sdks/python/apache_beam/runners/worker/sdk_worker.py
##########
@@ -181,22 +149,15 @@ def _request_register(self, request):
def _request_process_bundle(self, request):
def task():
- # Take the free worker. Wait till a worker is free.
- worker = self.workers.get()
- # Get the first work item in the queue
- work = self._process_bundle_queue.get()
- self._unscheduled_process_bundle.pop(work.instruction_id, None)
+ worker = self._get_or_create_worker()
try:
- self._execute(lambda: worker.do_instruction(work), work)
+ self._execute(lambda: worker.do_instruction(request), request)
finally:
# Put the worker back in the free worker pool
self.workers.put(worker)
- # Create a task for each process_bundle request and schedule it
- self._process_bundle_queue.put(request)
- self._unscheduled_process_bundle[request.instruction_id] = time.time()
- self._process_thread_pool.submit(task)
+ self._worker_thread_pool.submit(task)
logging.debug(
- "Currently using %s threads." %
len(self._process_thread_pool._workers))
+ "Currently using %s threads." % len(self._worker_thread_pool._workers))
Review comment:
It might be nice to also periodically print how many SdkWorkers exist (or
maybe just how many are in the queue) since we never destroy them.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 344456)
Time Spent: 13h 10m (was: 13h)
> Allow the Python SDK to use many many threads
> ---------------------------------------------
>
> Key: BEAM-8151
> URL: https://issues.apache.org/jira/browse/BEAM-8151
> Project: Beam
> Issue Type: Improvement
> Components: sdk-py-core, sdk-py-harness
> Reporter: Luke Cwik
> Assignee: Luke Cwik
> Priority: Major
> Time Spent: 13h 10m
> Remaining Estimate: 0h
>
> We need to use a thread pool which shrinks the number of active threads when
> they are not being used.
>
> This is to prevent any stuckness issues related to a runner scheduling more
> work items then there are "work" threads inside the SDK harness.
>
> By default the control plane should have all "requests" being processed in
> parallel and the runner is responsible for not overloading the SDK with too
> much work.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)