Add logging for task stop operations (#14192)

Log more details when task cannot be stopped for various reasons
This commit is contained in:
Rishabh Singh 2023-05-30 18:50:52 +05:30 committed by GitHub
parent 1ac5544da7
commit 2086ff88bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 5 deletions

View File

@ -145,10 +145,16 @@ public abstract class SeekableStreamIndexTaskClientAsyncImpl<PartitionIdType, Se
{
return makeRequest(id, new RequestBuilder(HttpMethod.POST, "/stop" + (publish ? "?publish=true" : "")))
.onSuccess(r -> true)
.onHttpError(e -> Either.value(false))
.onNotAvailable(e -> Either.value(false))
.onHttpError(e -> {
log.warn("Task [%s] coundln't be stopped because of http request failure [%s].", id, e.getMessage());
return Either.value(false);
})
.onNotAvailable(e -> {
log.warn("Task [%s] coundln't be stopped because it is not available.", id);
return Either.value(false);
})
.onClosed(e -> {
log.debug("Task [%s] couldn't be stopped because it is no longer running.", id);
log.warn("Task [%s] couldn't be stopped because it is no longer running.", id);
return Either.value(true);
})
.go();

View File

@ -85,7 +85,16 @@ public abstract class SeekableStreamIndexTaskClientSyncImpl<PartitionIdType, Seq
publish ? "publish=true" : null,
true
);
return isSuccess(response);
boolean isSuccess = isSuccess(response);
if (!isSuccess) {
log.warn(
"Task [%s] coundln't be stopped because of http request failure. Error code [%d], description [%s].",
id,
response.getStatus().getCode(),
response.getStatus().getReasonPhrase()
);
}
return isSuccess;
}
catch (NoTaskLocationException e) {
return false;

View File

@ -156,7 +156,7 @@ public class ExecutorLifecycle
}
// Kind of gross, but best way to kill the JVM as far as I know
log.info("Triggering JVM shutdown.");
log.info("Triggering JVM shutdown. Check overlord logs to see why the task is being shut down.");
System.exit(2);
}
);