aglinxinyuan commented on code in PR #4206:
URL: https://github.com/apache/texera/pull/4206#discussion_r3336814738


##########
amber/src/main/python/core/runnables/main_loop.py:
##########
@@ -87,19 +92,54 @@ def __init__(
             target=self.data_processor.run, daemon=True, 
name="data_processor_thread"
         ).start()
 
+    def _attach_loop_start_id(self, output_state: State) -> None:
+        if "LoopStartId" in output_state:
+            return
+        output_state["LoopStartId"] = self.context.worker_id.split("-", 
1)[1].rsplit(
+            "-main-0", 1
+        )[0]

Review Comment:
   Good catch. Replaced the `-main-0` string-chop with a new `get_operator_id` 
helper in `core/util/virtual_identity.py` that parses the worker name with the 
shared `worker_name_pattern` — the same regex the engine already uses for 
`get_worker_index`, mirroring Scala `VirtualIdentityUtils.getPhysicalOpId`. It 
no longer assumes the layer name or worker index, correctly handles operator 
ids that contain dashes, and raises `ValueError` on an unrecognized worker id 
so a future naming change fails loudly instead of silently extracting the wrong 
id. Added `TestGetOperatorId` covering the dashed-op-id, non-`main`-layer / 
nonzero-index, and fail-loud cases. Fixed in 512841a78.



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