Skip to content

Commit

Permalink
models: avoid dividing by zero in priority workflow calculation
Browse files Browse the repository at this point in the history
Fix the workflow priority calculation to avoid dividing by zero and
causing workflows to be stuck in the ``queued`` status when the number
of allowed concurrent workflow is set to zero. The issue only affects
the "balanced" scheduling strategy.

Closes #195
  • Loading branch information
mdonadoni committed Jul 24, 2023
1 parent 6524827 commit 02c0e4a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changes
=======

Version 0.9.2 (UNRELEASED)
--------------------------

- Fixes the workflow priority calculation to avoid workflows stuck in the ``queued`` status when the number of allowed concurrent workflow is set to zero.

Version 0.9.1 (2023-01-18)
--------------------------

Expand Down
2 changes: 1 addition & 1 deletion reana_db/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ def get_workflow_overload_priority(self):
Workflow.status == RunStatus.running,
)
).count()
if running_count > max_concurrent_workflows:
if running_count >= max_concurrent_workflows:
return 0.1
# we reduce the 10% (* 0.9) to avoid getting a 0 multiplier factor when
# `running_count == `max_concurrent_workflows`, thus taking into
Expand Down

0 comments on commit 02c0e4a

Please sign in to comment.