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

Disable sorting of NodeSet? #437

Open
brianjmurrell opened this issue Apr 14, 2020 · 4 comments
Open

Disable sorting of NodeSet? #437

brianjmurrell opened this issue Apr 14, 2020 · 4 comments

Comments

@brianjmurrell
Copy link

I'd like to be able to disable NodeSet sorting so that, for example, cluset -e -I 0 5,4,3,2,1 returns me 5.

Is this possible? If not, could it be possible?

@degremont
Copy link
Collaborator

This is not possible. I think this is a duplicate of #410. They both relies on the same internal behaviour of NodeSet which sorts, by design, the elements.
It should be easier to implement that using an ordered dict or something similar in Python 3+.

@brianjmurrell
Copy link
Author

So, yeah. I thought I had bug reported that before, but I was using sort as my search term, not order, which is why I didn't find it.

It should be easier to implement that using an ordered dict or something similar in Python 3+.

Are you suggesting that is something that could be done under the hood here, or that it's something that should be done outside of clustershell?

If the latter (a) I am using the cluset command, not a Python script and (b) I still want all of the other nodeset handling (folding, expanding, etc.) that cluset provides.

Am I misunderstanding your suggestion?

@degremont
Copy link
Collaborator

It was more a note for anybody wanted to dig into the code side of this feature :)

Actually, the internal data structure of nodeset is a set, which is non-ordered, it is not possible to restore the original order in which the element were added. That's why we need to change this to a ordered set (or kind of), in the future to enable the feature you are looking for.

@brianjmurrell
Copy link
Author

Fair enough. Thanks for your time on this. I will try to remember this issue in the future.

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

No branches or pull requests

2 participants