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 server logic to select jobs with high priority #375

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

val500
Copy link
Contributor

@val500 val500 commented Oct 10, 2024

Description

This changes the query to get a job from the database to sort by job_priority first so jobs with highest priority get selected first. In addition, find_one_and_update was replaced by a find_one query and a separate update query. This is due to MongoDB not supporting the sort option for updates leading to a mismatch between the document that was found and the document that was updated.

Resolved issues

Resolves https://warthogs.atlassian.net/browse/CERTTF-373

Documentation

Web service API changes

N/A

Tests

Unit test was added to test_v1.py

@val500 val500 requested a review from plars October 10, 2024 19:13
Copy link
Collaborator

@plars plars left a comment

Choose a reason for hiding this comment

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

A few small things, but looking good.

server/src/database.py Outdated Show resolved Hide resolved
server/src/database.py Outdated Show resolved Hide resolved
@val500 val500 force-pushed the CERTTF-373 branch 3 times, most recently from 5e1ebd9 to 4b0113f Compare October 17, 2024 19:34
@val500 val500 requested a review from plars October 17, 2024 19:38
Copy link
Collaborator

@plars plars left a comment

Choose a reason for hiding this comment

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

Nice and simple! just to follow up on our mm conversation,we talked about adding priority sorting for the API that retrieves the position of a job to keep the user informed how many jobs are ahead of them.

Copy link
Collaborator

@plars plars left a comment

Choose a reason for hiding this comment

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

+1 thanks for the updates!

@val500 val500 merged commit 0043f95 into main Oct 24, 2024
1 check passed
@val500 val500 deleted the CERTTF-373 branch October 24, 2024 16:00
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