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

Add option to verdi group delete to delete nodes themselves #4358

Closed
ltalirz opened this issue Sep 7, 2020 · 5 comments
Closed

Add option to verdi group delete to delete nodes themselves #4358

ltalirz opened this issue Sep 7, 2020 · 5 comments
Labels
good first issue Issues that should be relatively easy to fix also for beginning contributors type/feature request status undecided

Comments

@ltalirz
Copy link
Member

ltalirz commented Sep 7, 2020

So far, verdi group delete only acts on groups - there is no option to also delete the nodes inside a group.

It would be useful if there was an option --delete-nodes (or similar) that allows to delete both the group as well as the nodes it contains.
As mentioned by @sphuber, this should be followed by the usual prompt listing the number of nodes actually to be deleted (when including the provenance rules).

P.S. This is just a minor nitpick but I actually prefer the verdi node delete command without the --clear option introduced here.
In particular, it is not obvious to me why deleting a group that contains nodes should be treated any different than deleting a group that doesn't contain nodes - after all, it is only the group instance being deleted in both cases (happy to be convinced otherwise).

Here is what I would suggest:

  • By default (no flags), the command prompts when trying to delete a group. The prompt clearly shows how many nodes the group contains. All groups are treated equal.
  • When using the -f/--force flag, no prompt is shown and the group is deleted
  • When using the --delete-nodes flag, a prompt is shown that describes how many nodes the group contains as well as how many nodes would be deleted (usually more). The prompt includes some sort of warning sign, similar to what appears in verdi node delete
  • When using both --force and --delete-nodes, no prompt is shown.
@ltalirz ltalirz added type/feature request status undecided good first issue Issues that should be relatively easy to fix also for beginning contributors labels Sep 7, 2020
@mbercx
Copy link
Member

mbercx commented Sep 7, 2020

Agreed on both points! I tend to make tmp groups where I just run test calculations that I won't be keeping afterwards. So once I'm done, it'd be easier to run verdi group delete -f --delete-nodes tmp than verdi group show -r 73 | xargs -n1 verdi node delete -f; verdi group delete tmp.

I've also wondered why the --clear option is there. Why would I want to clear the group of nodes before deleting it? I suppose it is a safety measure so you don't accidentally delete groups with nodes?

Your suggestion for how verdi node delete should function seems good to me. I'd actually extend this list of features with two more additions:

  • verdi group move-nodes: Move nodes from one group to another. It's tedious having to do remove-nodes and then add-nodes. 😅
  • verdi group delete-nodes: Delete all the nodes in one group. Sometimes I start a whole series of calculations and add them to a group, only to realise 5 minutes later that I messed up one of the settings. It's be nice to be able to just delete all the nodes in the group.

Maybe these should be put in a different issue though? Either way, I'm happy to work on this.

@ltalirz
Copy link
Member Author

ltalirz commented Sep 7, 2020

Since @sphuber originally introduced the --clear flag, let's hear his opinion as well - perhaps it was introduced for a specific use case that we are not considering.

As for the other two commands, I can see the use but I'm not enough of a Group power user whether they are needed

Maybe these should be put in a different issue though?

I would prefer that.

Either way, I'm happy to work on this.

Great! Let's wait for a little more feedback from others.

@sphuber
Copy link
Contributor

sphuber commented Sep 9, 2020

I've also wondered why the --clear option is there. Why would I want to clear the group of nodes before deleting it? I suppose it is a safety measure so you don't accidentally delete groups with nodes?

As my commit message explained, the force flag bundled two different parts of the behavior: ignoring the prompt, and deleting groups even if they contained nodes. You can check the old implementation that my commit changes to see this. Given that old meaning of the force flag, I found the behavior dangerous and so decided to make it explicit without changing the actual behavior of treating filled groups different from empty ones. That being said, I agree with the proposed new behavior and think that makes more sense. So if we are changing the behavior and interface, then I am all on board with @ltalirz 's suggestion.

more additions:
verdi group move-nodes: Move nodes from one group to another. It's tedious having to do remove-nodes and then add-nodes. sweat_smile

Agree that this would be useful, but should indeed go in a separate feature request issue. Would be accepted feature request for me.

verdi group delete-nodes: Delete all the nodes in one group. Sometimes I start a whole series of calculations and add them to a group, only to realise 5 minutes later that I messed up one of the settings. It's be nice to be able to just delete all the nodes in the group.

This actually already exists: verdi group remove-nodes --clear GROUP

@mbercx
Copy link
Member

mbercx commented Sep 10, 2020

That being said, I agree with the proposed new behavior and think that makes more sense. So if we are changing the behavior and interface, then I am all on board with @ltalirz 's suggestion.

Alright, I'll start working on this and open a PR!

Agree that this would be useful, but should indeed go in a separate feature request issue. Would be accepted feature request for me.

Will open an issue then! Another idea that I had (which I don't think we have as a feature now?) is introducing verdi aliases, which can be configured at different levels (profile, installation, system), similar to git aliases. Autocomplete makes typing the commands pretty fast already, but I'd love to be able to type e.g. verdi gll to get verdi group list -O label.

This actually already exists: verdi group remove-nodes --clear GROUP

This just removes the nodes from the group, right? I meant deleting the nodes that are in a group, as in my example the calculations won't be useful, so we can just delete them entirely.

@ltalirz
Copy link
Member Author

ltalirz commented Jan 27, 2021

this was addressed in #4578

@ltalirz ltalirz closed this as completed Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Issues that should be relatively easy to fix also for beginning contributors type/feature request status undecided
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants