Skip to content

Conversation

@jdeamicis
Copy link
Contributor

@jdeamicis jdeamicis commented Jun 16, 2023

Description of changes

  • Avoid duplication of nodes in ClusterManager._find_active_nodes() when nodes belong to multiple Slurm partitions.
  • This is relevant only in cases when the Slurm partition configuration is edited and PC-managed nodes are added to multiple custom partitions.
  • Small extention to the SlurmNode class constructor to allow specifying the slurm_nodes attribute at object creation.

Tests

  • Added unit test to verify that overlapping partitions do not lead to duplication of nodes in the group returned by
    ClusterManager._find_active_nodes().
  • Adapted existing tests to new logic.

References

Checklist

  • Make sure you are pointing to the right branch and add a label in the PR title (i.e. 2.x vs 3.x)
  • Check all commits' messages are clear, describing what and why vs how.
  • Make sure to have added unit tests or integration tests to cover the new/modified code.
  • Check if documentation is impacted by this change.

Please review the guidelines for contributing and Pull Request Instructions.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jdeamicis jdeamicis added the 3.x label Jun 16, 2023
@jdeamicis jdeamicis requested review from a team as code owners June 16, 2023 21:57
@jdeamicis jdeamicis changed the title Avoid duplication of nodes in ClusterManager._find_active_nodes() [3.6] Avoid duplication of nodes in ClusterManager._find_active_nodes() Jun 16, 2023
@codecov
Copy link

codecov bot commented Jun 16, 2023

Codecov Report

Merging #537 (ec7cab8) into release-3.6 (dc340b4) will increase coverage by 0.00%.
The diff coverage is 100.00%.

❗ Current head ec7cab8 differs from pull request most recent head 6eac5c5. Consider uploading reports for the commit 6eac5c5 to get more accurate results

@@             Coverage Diff              @@
##           release-3.6     #537   +/-   ##
============================================
  Coverage        87.31%   87.32%           
============================================
  Files               16       16           
  Lines             2318     2319    +1     
============================================
+ Hits              2024     2025    +1     
  Misses             294      294           
Flag Coverage Δ
unittests 87.32% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/slurm_plugin/clustermgtd.py 92.48% <100.00%> (ø)
src/slurm_plugin/slurm_resources.py 94.82% <100.00%> (+0.01%) ⬆️

davprat
davprat previously approved these changes Jun 17, 2023
Copy link
Contributor

@davprat davprat left a comment

Choose a reason for hiding this comment

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

lgtm

This is relevant only in cases when the Slurm partition configuration
is edited and PC-managed nodes are added to multiple custom partitions.

Add unit test to verify that overlapping partitions do not lead to
duplication of nodes in the group returned by
ClusterManager._find_active_nodes().

Adapt existing unit tests to the changes.

Signed-off-by: Jacopo De Amicis <[email protected]>
@jdeamicis jdeamicis force-pushed the fix/3.6/fix_nodelists_multiple_partitions branch from c7561eb to 6ce409b Compare June 19, 2023 08:18
This preserves the insertion order of nodes in the list of active nodes and
removed the need to sort nodelists manually to compare them in unit tests.

Signed-off-by: Jacopo De Amicis <[email protected]>
@jdeamicis jdeamicis force-pushed the fix/3.6/fix_nodelists_multiple_partitions branch from 8360d5d to ec7cab8 Compare June 19, 2023 14:31
This removed the need to extend the constructor of SlurmPartition to pass
the list of SlurmNode objects `slurm_nodes`, removing the risk of wrong
implementations in the future.

Include additional cases to test_find_active_nodes().

Signed-off-by: Jacopo De Amicis <[email protected]>
@jdeamicis jdeamicis merged commit e52e25b into aws:release-3.6 Jun 19, 2023
@jdeamicis jdeamicis deleted the fix/3.6/fix_nodelists_multiple_partitions branch June 19, 2023 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants