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


##########
amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/PauseTypeSpec.scala:
##########
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.texera.amber.engine.architecture.worker
+
+import 
org.apache.texera.amber.core.virtualidentity.EmbeddedControlMessageIdentity
+import org.scalatest.flatspec.AnyFlatSpec
+
+class PauseTypeSpec extends AnyFlatSpec {
+
+  // --- singletons 
------------------------------------------------------------
+
+  "PauseType singletons" should "all extend the sealed trait PauseType" in {
+    val all: List[PauseType] = List(UserPause, BackpressurePause, 
OperatorLogicPause)
+    all.foreach(p => assert(p.isInstanceOf[PauseType]))
+  }

Review Comment:
   Looked into this — `PauseType` itself has no priority members (it's a sealed 
trait of marker objects + one case class with an `id`). The coexistence / 
override semantics live one level up in `PauseManager`, which stores active 
pauses in a `HashSet[PauseType]` ([PauseManager.scala line 
31](https://github.com/apache/texera/blob/main/amber/src/main/scala/org/apache/texera/amber/engine/architecture/worker/PauseManager.scala))
 — additive, no priority. `pause(t)` adds, `resume(t)` removes only that type, 
`isPaused` returns true if the set is non-empty. Multiple pauses stay active 
until *all* are resumed; there is no override order.
   
   The multi-pause coexistence behavior is already covered in 
[WorkerManagersSpec.scala lines 
236–267](https://github.com/apache/texera/blob/main/amber/src/test/scala/org/apache/texera/amber/engine/architecture/worker/managers/WorkerManagersSpec.scala)
 ("multiple global pauses stay active until all are resumed" + per-channel 
input-pause tests).
   
   Since this PR is scoped to the `PauseType` data type (not the `PauseManager` 
resolver), I'd prefer to keep priority semantics covered in 
`WorkerManagersSpec` where the actual logic lives. Are you remembering an older 
priority scheme that was removed, or would you like me to add a small Set-based 
test in this spec confirming `Set(UserPause, BackpressurePause)` distinguishes 
the two?



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