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

Implement priority mechanism in new scheduler #8139

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jptrindade
Copy link
Contributor

@jptrindade jptrindade commented Sep 30, 2024

Description

Added priority mechanism to the new scheduler with priorities for every existing task.

closes #8015

Self Check:

Strike through any lines that are not applicable (~~line~~) then check the box

  • Attached issue to pull request
  • Changelog entry
  • Type annotations are present
  • Code is clear and sufficiently documented
  • No (preventable) type errors (check using make mypy or make mypy-diff)
  • Sufficient test cases (reproduces the bug/tests the requested feature)
  • Correct, in line with design
  • End user documentation is included or an issue is created for end-user documentation (add ref to issue here: )
  • If this PR fixes a race condition in the test suite, also push the fix to the relevant stable branche(s) (see test-fixes for more info)

async def test_scheduler_priority(agent: TestAgent, environment, make_resource_minimal):
"""
Ensure that the tasks are placed in the queue in the correct order
And that existing tasks in the queue are replaced if a task that
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
And that existing tasks in the queue are replaced if a task that
and that existing tasks in the queue are replaced if a task that

@@ -377,11 +392,12 @@ def extend_blocked_on(resource: ResourceIdStr, new_blockers: set[ResourceIdStr])
# discard rather than remove because task may already be running, in which case we leave it run its course
# and simply add a new one
task: tasks.Deploy = tasks.Deploy(resource=resource)
priority: Optional[int] = self.agent_queues.discard(task)
task_priority: Optional[int] = self.agent_queues.discard(task)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we update the typing as well ? e.g.:

Suggested change
task_priority: Optional[int] = self.agent_queues.discard(task)
task_priority: Optional[TaskPriority] = self.agent_queues.discard(task)

And similarly for the method's signature ?

src/inmanta/deploy/work.py Show resolved Hide resolved
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.

resource scheduler: priorities
3 participants