Matthew-DWM commented on code in PR #9364:
URL: https://github.com/apache/texera/pull/9364#discussion_r4555861950


##########
amber/src/main/scala/org/apache/texera/amber/engine/architecture/pythonworker/PythonWorkflowWorker.scala:
##########
@@ -207,9 +252,30 @@ class PythonWorkflowWorker(
   override def initState(): Unit = {
     startProxyServer()
     startPythonProcess()
+    awaitPythonPort()
     startProxyClient()
   }
 
+  /**
+    * Waits for the Python process to report its Flight port, failing if the 
process exits
+    * first: the proxy client's constructor waits for that port with no limit, 
on this actor's
+    * thread, so it must not be built for a process that will never connect.
+    */
+  private def awaitPythonPort(): Unit = {

Review Comment:
   Done. The client now waits for the port on its own thread, so `preStart` 
returns and the worker registers right away. If Python exits first, the watcher 
reports it like any other exit, on the operator (screenshot in the 
description). The wait ends when the client is closed, so a stopped worker 
leaves no thread waiting, and `awaitPythonPort` is gone. A failure can still 
reach the coordinator before the registration message, so the coordinator now 
also takes the worker from the error's `relatedWorkerId` when the child isn't 
registered yet. Tests: "have its early exit attributed to it by a real 
coordinator", "stop without leaving a thread waiting when Python never reports 
its port", and in `CoordinatorSpec` "attribute an unregistered child's failure 
to the worker its error names".



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

Reply via email to