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

Update job-runner status on GET requests as well as POST #4605

Open
bloodearnest opened this issue Sep 13, 2024 · 1 comment
Open

Update job-runner status on GET requests as well as POST #4605

bloodearnest opened this issue Sep 13, 2024 · 1 comment

Comments

@bloodearnest
Copy link
Member

bloodearnest commented Sep 13, 2024

There are two main jobs APIs - a POST endpoint for job-runner to provide status on currently running Jobs, and a GET endpoint for currently requested JobRequests. Job-runner polls the GET API regularly, but only polls the POST API when jobs are actually running.

Job runner sends a Flags header with the current status (e.g. db maintenance mode) on every request. However, we only use this to update job-servers status on the POST request: https://github.com/opensafely-core/job-server/blob/main/jobserver/api/jobs.py#L193

This means that when any job is running, and thus job-runner is POSTing updates, we get updated status from the Flags header.

However, if there are no jobs running. we don't use that API, we only GET new job requests instead, the status is not updated.

Short term, we should consider switching the updates to the GET API, so we always have the latest state. Longer term, this API need a bit of a redesign, I think.

@evansd
Copy link
Contributor

evansd commented Sep 13, 2024

That seems like a sensible pragmatic step for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants