Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include exception message in errorMessage for failed task #16286

Merged
merged 5 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,10 @@ private void manageInternalCritical(
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,12 +298,13 @@ public void testUserProvidedContextOverrideLockConfig()
@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);
Expand All @@ -314,7 +315,7 @@ public boolean isReady(TaskActionClient taskActionClient)
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Better to verify the whole error message rather than contains.

);
}

Expand Down
Loading