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

control-service: logs endpoint doesn't hang #2370

Merged
merged 5 commits into from
Jul 10, 2023

Conversation

murphp15
Copy link
Collaborator

@murphp15 murphp15 commented Jul 7, 2023

Why

Closes: #2041
if a job is running and we make a request for its logs the control service hangs and after a very long time returns an error.

What

The error was happening because we were reading the logs for kubernetes using an inputStream function.
Kuberenetes was streaming the logs to the control plane and doesn't close the input stream till the jobs is completed.

Prevoiusly we were using

new PodLogs(client).streamNamespacedPodLog(...)

Within this function Kubernetes calls

new CoreV1Api(client).readNamespacedPodLogCall(... , follow=true)

Instead of calling PodLogs.streamNamespacedPodLog instead I call CoreV1Api.readNamespacedPodLogCall directly and I set follow=false.
Now the function returns immediately.

How has this been tested

Integration test.
I have created a job that runs for 20 minutes. I query for its logs and make sure that it returns within 5 seconds.

Signed-off-by: murphp15 [email protected]

@murphp15 murphp15 marked this pull request as draft July 7, 2023 14:02
@murphp15 murphp15 changed the title control-service: logs endpoint doesn't hang [DRAFT] control-service: logs endpoint doesn't hang Jul 7, 2023
@murphp15 murphp15 force-pushed the person/murphp15/logs_endpoint_does_not_hang branch from ac33c04 to 05d0592 Compare July 9, 2023 15:11
@murphp15 murphp15 changed the title [DRAFT] control-service: logs endpoint doesn't hang control-service: logs endpoint doesn't hang Jul 9, 2023
@murphp15 murphp15 marked this pull request as ready for review July 9, 2023 15:50
@murphp15 murphp15 merged commit 62e2da9 into main Jul 10, 2023
@murphp15 murphp15 deleted the person/murphp15/logs_endpoint_does_not_hang branch July 10, 2023 08:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

control-service: logs endpoint hangs and eventually throws an error if the job is still running
4 participants