{{ message }}
Nodeset: add --index command to cluset/nodeset#637
Merged
Conversation
Collaborator
Add a --index NODE command that outputs the zero-based position of a node in the resulting set, the reverse of -I/--slice. Works in both NodeSet and RangeSet (-R) modes. Signed-off-by: Stephane Thiell <sthiell@stanford.edu>
30412bb to
1d06faa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Add a
--index NODEcommand tocluset/nodesetthat outputs the zero-based position of a node in the resulting node set. It is the command-line front-end to theNodeSet.index()/RangeSet.index()methods (#631) and the inverse of-I/--slice. Suggested by @mattaezell in #631.A node that is not in the set prints an error on stderr and exits non-zero (like
list.index()), so it doubles as a membership test:Notes:
-c/-e/-f/...), computed on the final set, so it honors-x/-i/-X,-I/--sliceand stdin, and works in RangeSet mode (-R).--indexcombined with--pickis rejected, since random sampling would make the position meaningless.-e/--expand); the docs cover the non-obvious cases (alphabetical pattern order, multidimensional flattening) and warn it is not guaranteed to match a resource manager's rank such as Slurm's$SLURM_NODEID.See #631.