sshiv012 commented on code in PR #9015:
URL: https://github.com/apache/texera/pull/9015#discussion_r4674073510
##########
amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/RegionExecutionManagerSpec.scala:
##########
@@ -683,6 +683,7 @@ class RegionExecutionManagerSpec
errorMessage = "transient EndWorker failure",
errorDetails = "",
stackTrace = "",
- language = ErrorLanguage.SCALA
+ language = ErrorLanguage.SCALA,
+ None
Review Comment:
Done, named it.
##########
amber/src/test/scala/org/apache/texera/amber/engine/architecture/scheduling/WorkflowExecutionManagerSpec.scala:
##########
@@ -213,7 +213,8 @@ class WorkflowExecutionManagerSpec
errorMessage = udfInitError,
errorDetails = "",
stackTrace = "",
- language = ErrorLanguage.PYTHON
+ language = ErrorLanguage.PYTHON,
+ None
Review Comment:
Done, same here.
##########
amber/src/test/scala/org/apache/texera/amber/error/ErrorUtilsSpec.scala:
##########
@@ -204,4 +208,50 @@ class ErrorUtilsSpec extends AnyFlatSpec with Matchers {
operatorId shouldBe "__DummyOperator"
workerId shouldBe "COORDINATOR"
}
+
+ // ----- carrying the failing worker through ControlError -----
+
+ private val failingWorker =
+ ActorVirtualIdentity("Worker:WF23-PythonUDFV2-operator-udfdemo-main-0")
+
+ "mkControlError with a WorkflowRuntimeException" should "carry the failing
worker" in {
+ val ce = ErrorUtils.mkControlError(new WorkflowRuntimeException("boom",
Some(failingWorker)))
+ ce.relatedWorkerId shouldBe Some(failingWorker)
+ }
+
+ it should "leave the worker empty for errors that are not tied to one" in {
+ ErrorUtils.mkControlError(new RuntimeException("boom")).relatedWorkerId
shouldBe None
+ ErrorUtils
+ .mkControlError(new WorkflowRuntimeException("boom", None))
+ .relatedWorkerId shouldBe None
+ }
+
+ "reconstructThrowable with a related worker" should "rebuild a
WorkflowRuntimeException" in {
+ val original =
+ new WorkflowRuntimeException("boom", new IllegalStateException("root"),
Some(failingWorker))
+ val rebuilt =
ErrorUtils.reconstructThrowable(ErrorUtils.mkControlError(original))
+ rebuilt shouldBe a[WorkflowRuntimeException]
+ val wre = rebuilt.asInstanceOf[WorkflowRuntimeException]
+ wre.relatedWorkerId shouldBe Some(failingWorker)
+ wre.getMessage shouldBe "boom"
+ wre.getCause.getMessage shouldBe new IllegalStateException("root").toString
+ }
+
+ it should "let the error be attributed to the failing operator" in {
+ // WorkflowService reads relatedWorkerId from the rebuilt error; before
this,
+ // the worker was dropped and the UI showed "unknown operator".
+ val rebuilt = ErrorUtils
+ .reconstructThrowable(
+ ErrorUtils.mkControlError(new WorkflowRuntimeException("boom",
Some(failingWorker)))
+ )
+ .asInstanceOf[WorkflowRuntimeException]
+ ErrorUtils.getOperatorFromActorIdOpt(rebuilt.relatedWorkerId) shouldBe
+ ("PythonUDFV2-operator-udfdemo", failingWorker.name)
+ }
+
+ it should "still rebuild a plain Throwable when no worker is set" in {
Review Comment:
Good point. It now has its own heading: "reconstructThrowable without a
related worker should rebuild a plain Throwable". The `mkControlError` case
above it had the same problem under the WorkflowRuntimeException heading, so I
split that one out too.
--
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]