This is an automated email from the ASF dual-hosted git repository.

aglinxinyuan pushed a commit to branch xinyuan-scheduler-jump
in repository https://gitbox.apache.org/repos/asf/texera.git


The following commit(s) were added to refs/heads/xinyuan-scheduler-jump by this 
push:
     new 001a409000 Add scheduler jump test
001a409000 is described below

commit 001a4090008fa0613d9ce6681eb5ec04abeaf9c6
Author: Xinyuan Lin <[email protected]>
AuthorDate: Tue Apr 21 01:53:44 2026 -0700

    Add scheduler jump test
---
 .../architecture/scheduling/ScheduleSpec.scala     | 63 ++++++++++++++++++++++
 1 file changed, 63 insertions(+)

diff --git 
a/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleSpec.scala
 
b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleSpec.scala
new file mode 100644
index 0000000000..6655874b75
--- /dev/null
+++ 
b/amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/ScheduleSpec.scala
@@ -0,0 +1,63 @@
+/*
+ * 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.scheduling
+
+import org.apache.texera.amber.core.executor.OpExecInitInfo
+import org.apache.texera.amber.core.virtualidentity.{
+  ExecutionIdentity,
+  OperatorIdentity,
+  PhysicalOpIdentity,
+  WorkflowIdentity
+}
+import org.apache.texera.amber.core.workflow.PhysicalOp
+import org.scalatest.flatspec.AnyFlatSpec
+
+class ScheduleSpec extends AnyFlatSpec {
+
+  private def region(regionId: Long, opId: String): Region = {
+    val physicalOp = PhysicalOp(
+      PhysicalOpIdentity(OperatorIdentity(opId), "main"),
+      WorkflowIdentity(0),
+      ExecutionIdentity(0),
+      OpExecInitInfo.Empty
+    )
+    Region(RegionIdentity(regionId), Set(physicalOp), Set.empty)
+  }
+
+  "Schedule.jumpToOperator" should "make the next scheduled region contain the 
target operator" in {
+    val firstRegion = region(1, "first")
+    val secondRegion = region(2, "second")
+    val thirdRegion = region(3, "third")
+    val schedule = Schedule(
+      Map(
+        0 -> Set(firstRegion),
+        1 -> Set(secondRegion),
+        2 -> Set(thirdRegion)
+      )
+    )
+
+    assert(schedule.next() == Set(firstRegion))
+    assert(schedule.next() == Set(secondRegion))
+
+    schedule.jumpToOperator(OperatorIdentity("first"))
+
+    assert(schedule.next() == Set(firstRegion))
+  }
+}

Reply via email to