Skip to content

Commit

Permalink
On demand resources, started via on-demand tags
Browse files Browse the repository at this point in the history
On-demand tickets need to be prioritized over the normal tickets
(priority queue), otherwise we risk that normal tickets take "on demand"
resources.

If we want to prefer one "on demand" pool over the other "on demand"
(e.g. spot AWS over normal instances), we need to sort them through a
priority queue.  The fallback (if SPOT instances don't start) isn't
resolved yet, though, we just prioritize per tag priority as usually.
  • Loading branch information
praiskup committed Aug 2, 2023
1 parent 5ae9781 commit 01f6400
Show file tree
Hide file tree
Showing 3 changed files with 331 additions and 41 deletions.
5 changes: 3 additions & 2 deletions resallocserver/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ def ready(self):
"""
Get ready resources, those which were never assigned or are released.
The sandbox-assigned resources are sorted above others - so they can be
re-used first.
re-used first. The query is already ordered by ID ASC.
"""
return (self.up().filter(models.Resource.ticket_id.is_(None))
.filter(models.Resource.check_failed_count==0))
.filter(models.Resource.check_failed_count==0)
.order_by(models.Resource.id.asc()))

def taken(self):
"""
Expand Down
Loading

0 comments on commit 01f6400

Please sign in to comment.