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

kfaraz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 6974498d983 Improve error message when task fails before becoming 
ready (#16286)
6974498d983 is described below

commit 6974498d9838e3455f741b4b015a1ab1de4778d0
Author: YongGang <[email protected]>
AuthorDate: Wed Apr 17 19:45:41 2024 -0700

    Improve error message when task fails before becoming ready (#16286)
---
 .../src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java | 6 ++++--
 .../test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java | 5 +++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git 
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
 
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
index a143b93e9ef..70a8869ee52 100644
--- 
a/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
+++ 
b/indexing-service/src/main/java/org/apache/druid/indexing/overlord/TaskQueue.java
@@ -427,8 +427,10 @@ public class TaskQueue
             if (e instanceof MaxAllowedLocksExceededException) {
               errorMessage = e.getMessage();
             } else {
-              errorMessage = "Failed while waiting for the task to be ready to 
run. "
-                                          + "See overlord logs for more 
details.";
+              errorMessage = StringUtils.format(
+                  "Encountered error[%s] while waiting for task to be ready. 
See Overlord logs for more details.",
+                  StringUtils.chop(e.getMessage(), 100)
+              );
             }
             notifyStatus(task, TaskStatus.failure(task.getId(), errorMessage), 
errorMessage);
             continue;
diff --git 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
index d34cb62d57c..6125a4d73be 100644
--- 
a/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
+++ 
b/indexing-service/src/test/java/org/apache/druid/indexing/overlord/TaskQueueTest.java
@@ -298,12 +298,13 @@ public class TaskQueueTest extends IngestionTestBase
   @Test
   public void testExceptionInIsReadyFailsTask()
   {
+    final String exceptionMsg = "isReady failure test";
     final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"))
     {
       @Override
       public boolean isReady(TaskActionClient taskActionClient)
       {
-        throw new RuntimeException("isReady failure test");
+        throw new RuntimeException(exceptionMsg);
       }
     };
     taskQueue.add(task);
@@ -314,7 +315,7 @@ public class TaskQueueTest extends IngestionTestBase
     Assert.assertEquals(TaskState.FAILED, 
statusOptional.get().getStatusCode());
     Assert.assertNotNull(statusOptional.get().getErrorMsg());
     Assert.assertTrue(
-        statusOptional.get().getErrorMsg().startsWith("Failed while waiting 
for the task to be ready to run")
+        statusOptional.get().getErrorMsg().contains(exceptionMsg)
     );
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to