Skip to content

Conversation

@iparask
Copy link
Member

@iparask iparask commented Dec 4, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 4, 2025 21:12
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the resource allocation logic to use the user-requested resources as the upper bound for binary search, rather than a calculated value based on QoS policies. The key change is renaming the cores parameter to requested_cores for clarity and adjusting when QoS policy selection occurs.

Key Changes:

  • Parameter renamed from cores to requested_cores throughout the codebase for improved clarity
  • QoS policy selection moved from before to after the binary search completes
  • Upper bound for binary search now uses requested_resources directly instead of min(2x max workflow, QoS max cores)

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/test_planner.py Updates test calls to use the renamed parameter requested_cores instead of cores
src/socm/planner/heft_planner.py Refactors _plan_with_qos_optimization to accept requested_resources, use it as the binary search upper bound, and perform QoS validation after finding the optimal core count; also improves logging granularity

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)
else:
raise ValueError(
f"Cannot meet {self._objective} min deadline with {requested_resources} cores. "
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The error message format is inconsistent. Line 77 uses "deadline of {self._objective} minutes" while line 150 uses "{self._objective} min deadline". These should use the same format for consistency.

Suggested change
f"Cannot meet {self._objective} min deadline with {requested_resources} cores. "
f"Cannot meet deadline of {self._objective} minutes with {requested_resources} cores. "

Copilot uses AI. Check for mistakes.
else:
raise ValueError(
f"Cannot meet {self._objective} min deadline with {requested_resources} cores. "
f"Please increase deadline or increase requested cores."
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

The error message suggests to "increase requested cores", but the actual problem is that the requested cores are insufficient to meet the deadline. The suggestion should be "increase requested resources" or just remove this suggestion since increasing the deadline is already mentioned and is the more appropriate solution when the deadline cannot be met with the given resources.

Suggested change
f"Please increase deadline or increase requested cores."
f"Please increase deadline or increase requested resources."

Copilot uses AI. Check for mistakes.
assert suitable == QosPolicy(name="long", max_walltime=240, max_jobs=10, max_cores=400)
with pytest.raises(ValueError):
suitable = planner._find_suitable_qos_policies(cores=410)
suitable = planner._find_suitable_qos_policies(requested_cores=410)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

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

Variable suitable is not used.

Suggested change
suitable = planner._find_suitable_qos_policies(requested_cores=410)
planner._find_suitable_qos_policies(requested_cores=410)

Copilot uses AI. Check for mistakes.
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