craiuconstantintiberiu commented on code in PR #51684:
URL: https://github.com/apache/spark/pull/51684#discussion_r2248875903


##########
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:
   Thanks, changed everywhere to use `conf` instead of `authHelper.conf` when 
needed.



##########
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:
   Thanks, done.



##########
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:
   Yes, but should not be a problem at the moment. 
   If we are at `maxIdleWorkerPoolSize` workers in the queue and we add 1 more, 
we will go over the limit and then remove the worker.
   
   Not a problem now but could be an issue in the future if the queue 
implementation is changed to one that actually enforces this and throws an 
exception.
   
   Changed.



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

Reply via email to