georgew5656 opened a new pull request, #14285:
URL: https://github.com/apache/druid/pull/14285
Fix issues with task log streaming + pushing logs when a task in cancelled
### Description
I was trying to fix the bug where task logs are not pushed if a task is
cancelled because the job is deleted before the main thread has a chance to
grab logs, but when doing this I noticed that there is a issue with streaming
logs.
The LogWatch fabric8 class doesn't really play well with the way we are
streaming logs (it seems to keep the stream open for as long as the logWatch
controller is open, so when a request to stream logs to the K8sTaskRunner is
ran, it just hangs since there are technically more lines in the stream as long
as the LogWatcher is still open.
The LogWatcher only seems to get closed if .close is explicitly called or if
the underlying k8s condition is satisfied (i think it waits for the container
to be completed).
The regular getLogInputStream stream returned by fabric8 works well enough
for streaming task logs (it just captures a stream of the k8s logs in a
moment), since the druid console will periodically call the overlordResource to
refresh the logs anyways.
it would probably be good if we actually used the offset parameter to the
streamTaskLog in KubernetesTaskRunner instead of just returning the whole
stream, I can look into that in a future PR.
I also included the work to push logs from cancelled tasks in this PR,
basically just having the shutdown thread try to push logs before shutting down
the job and then updating the log push logic to not push if there is no log
stream (so that the log doesn't get overwritten with a empty file).
It would be better if we could somehow mark a job as failed, grab the logs
in our regular logic, and then delete the job, but I'm not aware of a way to do
this, I can look into this more later.
#### Release note
- FIx bugs around K8s Task scheduling log streaming and logging for
cancelled tasks.
<hr>
##### Key changed/added classes in this PR
Changes are only to the kubernetes-overlord-extensions module.
This PR has:
- [X ] been self-reviewed.
- [ ] using the [concurrency
checklist](https://github.com/apache/druid/blob/master/dev/code-review/concurrency.md)
(Remove this item if the PR doesn't have any relation to concurrency.)
- [ ] added documentation for new or modified features or behaviors.
- [ ] a release note entry in the PR description.
- [ ] added Javadocs for most classes and all non-trivial methods. Linked
related entities via Javadoc links.
- [ ] added or updated version, license, or notice information in
[licenses.yaml](https://github.com/apache/druid/blob/master/dev/license.md)
- [ ] added comments explaining the "why" and the intent of the code
wherever would not be obvious for an unfamiliar reader.
- [ X] added unit tests or modified existing tests to cover new code paths,
ensuring the threshold for [code
coverage](https://github.com/apache/druid/blob/master/dev/code-review/code-coverage.md)
is met.
- [ ] added integration tests.
- [X ] been tested in a test Druid cluster.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]