You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ueshin (via GitHub)" <gi...@apache.org> on 2023/08/04 17:55:00 UTC

[GitHub] [spark] ueshin commented on a diff in pull request #42340: [SPARK-44433][3.5][PYTHON][CONNECT][SS][FOLLOWUP] Terminate listener process with removeListener and improvements

ueshin commented on code in PR #42340:
URL: https://github.com/apache/spark/pull/42340#discussion_r1284702271


##########
core/src/main/scala/org/apache/spark/api/python/StreamingPythonRunner.scala:
##########
@@ -84,4 +101,19 @@ private[spark] class StreamingPythonRunner(func: PythonFunction, connectUrl: Str
 
     (dataOut, dataIn)
   }
+
+  /**
+   * Stops the Python worker.
+   */
+  def stop(): Unit = {
+    pythonWorker.foreach { worker =>
+      val prevConf = conf.get(PYTHON_USE_DAEMON)
+      conf.set(PYTHON_USE_DAEMON, false)
+      try {
+        pythonWorkerFactory.foreach(_.stopWorker(worker))
+      } finally {
+        conf.set(PYTHON_USE_DAEMON, prevConf)
+      }
+    }
+  }

Review Comment:
   Same as https://github.com/apache/spark/pull/42341#discussion_r1284697366 about `conf`.



-- 
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: reviews-unsubscribe@spark.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org