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

Tagged job searching #191

Merged
merged 4 commits into from
Jan 30, 2024
Merged

Tagged job searching #191

merged 4 commits into from
Jan 30, 2024

Conversation

plars
Copy link
Collaborator

@plars plars commented Jan 25, 2024

Description

The motivation for this is to help support the creation of a spread backend for testflinger. (see jira card below)
The spread backend would submit a job that requests the devices it wants but only have them provision and stay in the allocate state. Then it would later go clean up the ones that were left. Ideally, it should just use the job_id and cancel the jobs once it's done with them, but they have some circumstances where they are unable to retain those job IDs and need to find the jobs somehow. They accomplish this on some of the cloud backends they support by tagging the systems they are using, then searching for them by that tag name. They also need the timestamp when the job was created so they can automate cancellation of the ones that are old.

The search API here defaults to only consider jobs that are active (not cancelled or completed). However, it was pretty straightforward to also add support for specifying that you wan to search for jobs in a specific state. This could be used for all sorts of other things, and I think the search API might be extended in the future to cover some other needs that we haven't though of yet.

Resolved issues

Fixes CERTTF-192

Documentation

Documentation added to the README and also to the job_schema reference docs.

Tests

Unit tests modified and added to cover both the addition of tags to the job, as well as the search API and all the different ways it can be used. I also tried this out locally of course.

@plars plars requested a review from a team January 25, 2024 15:46
@plars plars force-pushed the tagged-job-searching branch from f167eea to b08f35d Compare January 25, 2024 16:14
@plars plars requested a review from tang-mm January 25, 2024 20:22
@plars
Copy link
Collaborator Author

plars commented Jan 25, 2024

Also added a how-to and tagged @tang-mm for the review on that

@plars plars force-pushed the tagged-job-searching branch 2 times, most recently from 92c51dd to 4034167 Compare January 25, 2024 20:39
docs/how-to/search-job.rst Outdated Show resolved Hide resolved
docs/how-to/search-job.rst Outdated Show resolved Hide resolved
server/src/api/schemas.py Outdated Show resolved Hide resolved
server/src/api/schemas.py Outdated Show resolved Hide resolved
server/src/api/v1.py Show resolved Hide resolved
server/src/api/v1.py Show resolved Hide resolved
@plars plars force-pushed the tagged-job-searching branch from 4034167 to e8f9c49 Compare January 26, 2024 18:32
@plars plars force-pushed the tagged-job-searching branch from 9f8f2f3 to 4cbbb7a Compare January 29, 2024 21:34
@plars plars requested a review from omar-selo January 29, 2024 21:41
Copy link

@omar-selo omar-selo left a comment

Choose a reason for hiding this comment

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

Looks great

@plars plars merged commit a94339a into main Jan 30, 2024
5 checks passed
@plars plars deleted the tagged-job-searching branch January 30, 2024 17:45
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

Successfully merging this pull request may close these issues.

2 participants