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: [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