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) {
|
if (e instanceof MaxAllowedLocksExceededException) {
|
||||||
errorMessage = e.getMessage();
|
errorMessage = e.getMessage();
|
||||||
} else {
|
} else {
|
||||||
errorMessage = "Failed while waiting for the task to be ready to run. "
|
errorMessage = StringUtils.format(
|
||||||
+ "See overlord logs for more details.";
|
"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);
|
notifyStatus(task, TaskStatus.failure(task.getId(), errorMessage), errorMessage);
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -298,12 +298,13 @@ public class TaskQueueTest extends IngestionTestBase
|
||||||
@Test
|
@Test
|
||||||
public void testExceptionInIsReadyFailsTask()
|
public void testExceptionInIsReadyFailsTask()
|
||||||
{
|
{
|
||||||
|
final String exceptionMsg = "isReady failure test";
|
||||||
final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"))
|
final Task task = new TestTask("t1", Intervals.of("2021-01-01/P1D"))
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public boolean isReady(TaskActionClient taskActionClient)
|
public boolean isReady(TaskActionClient taskActionClient)
|
||||||
{
|
{
|
||||||
throw new RuntimeException("isReady failure test");
|
throw new RuntimeException(exceptionMsg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
taskQueue.add(task);
|
taskQueue.add(task);
|
||||||
|
@ -314,7 +315,7 @@ public class TaskQueueTest extends IngestionTestBase
|
||||||
Assert.assertEquals(TaskState.FAILED, statusOptional.get().getStatusCode());
|
Assert.assertEquals(TaskState.FAILED, statusOptional.get().getStatusCode());
|
||||||
Assert.assertNotNull(statusOptional.get().getErrorMsg());
|
Assert.assertNotNull(statusOptional.get().getErrorMsg());
|
||||||
Assert.assertTrue(
|
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