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

Correctly calculate new manager real capacity #3823

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

khk-globus
Copy link
Collaborator

Description

The inner else condition was never utilized before, as the value of real_capacity never changed. Calculate the value correctly by including the tasks that moved.

Changed Behaviour

No user workflows should be changed; managers will be removed from the interesting_managers variable one iteration sooner.

Type of change

  • Code maintenance/cleanup

@khk-globus khk-globus requested a review from benclifford March 20, 2025 17:20
The inner else condition was never utilized before, as the value of
`real_capacity` never changed.  Calculate the value correctly by including the
tasks that moved.
@khk-globus khk-globus force-pushed the correctly_calculate_real_capacity branch from 086063f to 0acdafb Compare March 20, 2025 17:23
@@ -481,7 +481,7 @@ def process_tasks_to_send(self, interesting_managers: Set[bytes]) -> None:
m['idle_since'] = None
logger.debug("Sent tasks: %s to manager %r", tids, manager_id)
# recompute real_capacity after sending tasks
real_capacity = m['max_capacity'] - tasks_inflight
real_capacity -= task_count
Copy link
Collaborator

Choose a reason for hiding this comment

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

thinking this through to understand it myelf.. and if rewriting this a bit more...

the point of this line is to feed into the if statement below, and nowhere else. the if statement is asking "did we schedule as many tasks as we wanted to (did will fill the original real_capacity?) or do we still have capacity (in which case the manager remains interesting). the actual numeric value of real_capacity is irrelevant here beyond whether it is positive or not.

This assertion should hold, though:
assert real_capacity == m['max_capacity'] - len(m['tasks']) which is the calculation that happens earlier at line 471.

Copy link
Collaborator

Choose a reason for hiding this comment

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

... and then maybe the line 486 debug message would be phrased as "still has free capacity"

@benclifford benclifford added this pull request to the merge queue Mar 25, 2025
Merged via the queue into master with commit a734eef Mar 25, 2025
9 checks passed
@benclifford benclifford deleted the correctly_calculate_real_capacity branch March 25, 2025 10:43
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