-
Notifications
You must be signed in to change notification settings - Fork 192
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
deprecate --clear
option of verdi group delete
#4357
deprecate --clear
option of verdi group delete
#4357
Conversation
I do have one more question about the purpose of What is the difference between clearing the contents of a group and then deleting it vs directly deleting the group (using The verdi user interface could remain the same in order to prevent users from accidentally deleting groups that contain nodes - although I would suspect that it is actually more common to use this command on groups that aren't empty. |
I added the |
Codecov Report
@@ Coverage Diff @@
## develop #4357 +/- ##
===========================================
+ Coverage 79.51% 79.52% +0.02%
===========================================
Files 482 482
Lines 35327 35325 -2
===========================================
+ Hits 28085 28088 +3
+ Misses 7242 7237 -5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Thanks, I will make the change. Just wondering, should there also be a flag to actually delete the nodes as well? |
Think that makes sense, however, it should come with a confirmation prompt, because it will have to follow the consistency rules and it may need to delete a lot more nodes than just those that were in the group. |
verdi node delete
docstringverdi group delete
docstring
Great - I'll open an issue for this, since it is a bit beyond the scope of this PR. |
I'd would still merge it. You anyhow won't be able to remove the |
Fine by me to postpone the new interface until 2.0 since we are changing it, but then it would be good to put official deprecation warning for the clear option in this PR. If you can add that then it's fine for me to merge |
I agree. Just to clarify, though: this means I will also remove the necessity to specify the |
verdi group delete
docstring--clear
option of verdi group delete
4b9b91f
to
1d061a6
Compare
I agree that it is not optimal, but I am not sure I agree with the assessment. Some people may actually have come to rely on the behavior, calling it without |
Right - I certainly get the argument (this change could in principle break user's scripts). The reason we are doing this is to cover the potential case of users relying on the fact that leaving out the So, in my view it's a balance to strike here and I lean towards changing the behavior so that people have time to adapt their code to remove the |
That's exactly the point though. How will you get people to stop using it, without having it print a deprecation warning? By the way, there is no |
Sorry if I'm not being clear - I am proposing the current state of the PR, where we of course have a deprecation warning (but we are also changing the behavior of the command without the
Right, sorry.
Well, my point was that we are not offering a way out until 2.0 and that there are definitely going to be a significant number of people affected by this (basically anyone who uses the |
@mbercx I believe this is still waiting for your review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay, @ltalirz! I have just one small suggestion.
) | ||
)) | ||
if clear: | ||
warnings.warn('`--clear` is deprecated and no longer has any effect.', AiidaDeprecationWarning) # pylint: disable=no-member | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can still add a warning in case the group is not empty and the force
flag isn't set?
if group.count() > 0 and not force: | |
echo.echo_warning(f'Group <{label}> contains {group.count()} nodes.') | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
N.B.: .count()
can potentially be expensive, so it's better to call it once and assign to variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @mbercx - I added it but then I had second thoughts
- Warning people about how many nodes there are inside the group can give the impression that we're deleting nodes here (while it is just the group that is being deleted)
- As @sphuber mentions, it can slow down the command
I.e. unless you feel strongly about this, I prefer to leave the code as it is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning people about how many nodes there are inside the group can give the impression that we're deleting nodes here (while it is just the group that is being deleted)
That's a good point, I hadn't thought about that. I suppose we can still rephrase the warning, but it's not critical.
As @sphuber mentions, it can slow down the command
I actually tested this for one of our larger groups on theossrv5, and it's not that time consuming:
In [10]: g.count()
Out[10]: 61134
In [11]: timeit g.count()
174 ms ± 1.39 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
But, I do not feel super strongly about it, so feel free to merge!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this may be on the sqlalchemy backend, where I remember trying to optimize the shit out of it because it was really slow at some point and it shouldn't be. could be different on Django, could be also ok though, not sure. But I am also fine with leaving it as is as @ltalirz suggests. Let's get this thing merged.
Thanks @mbercx ! |
fixes #4357