benrobby commented on code in PR #51684:
URL: https://github.com/apache/spark/pull/51684#discussion_r2247356117
##########
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala:
##########
@@ -111,7 +111,10 @@ private[spark] class PythonWorkerFactory(
@GuardedBy("self")
private var daemonSockPath: String = _
@GuardedBy("self")
- private val idleWorkers = new mutable.Queue[PythonWorker]()
+ // Visible for testing
+ private[spark] val idleWorkers = new mutable.Queue[PythonWorker]()
+ @GuardedBy("self")
+ private val idleWorkerPoolSize =
authHelper.conf.get(PYTHON_FACTORY_IDLE_WORKER_MAX_POOL_SIZE)
Review Comment:
why do we access the spark conf via `authHelper`?
##########
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala:
##########
@@ -484,6 +487,15 @@ private[spark] class PythonWorkerFactory(
self.synchronized {
lastActivityNs = System.nanoTime()
idleWorkers.enqueue(worker)
+ if (idleWorkerPoolSize.exists(idleWorkers.size > _)) {
Review Comment:
should this be `>=`? Otherwise you'll have `idleWorkerPoolSize + 1` worker
in the pool
##########
core/src/main/scala/org/apache/spark/api/python/PythonWorkerFactory.scala:
##########
@@ -111,7 +111,10 @@ private[spark] class PythonWorkerFactory(
@GuardedBy("self")
private var daemonSockPath: String = _
@GuardedBy("self")
- private val idleWorkers = new mutable.Queue[PythonWorker]()
+ // Visible for testing
+ private[spark] val idleWorkers = new mutable.Queue[PythonWorker]()
+ @GuardedBy("self")
+ private val idleWorkerPoolSize =
authHelper.conf.get(PYTHON_FACTORY_IDLE_WORKER_MAX_POOL_SIZE)
Review Comment:
could you adjust the variable name to reflect that it's the maximum size?
--
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]