mirror of https://github.com/apache/druid.git
Improve error message when task fails before becoming ready (#16286)
This commit is contained in:
parent
3f2dd46ede
commit
6974498d98
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue