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

Fix verdi calcjob cleanworkdir command #5209

Merged
merged 3 commits into from
Jan 20, 2022

Conversation

zhubonan
Copy link
Contributor

Previously the AND condition is not apply when -o and -p are both supplied, only the former is applied....
Also adds the ability to filter by exit_status of the calcjob.

@zhubonan zhubonan marked this pull request as draft October 30, 2021 18:28
@zhubonan
Copy link
Contributor Author

Also, since cleaning hundres of calculations can be very slow, is it worth storing a flag for those that has been cleaned in extras, so they can be skipped the next time the command issued?

@codecov
Copy link

codecov bot commented Oct 30, 2021

Codecov Report

Merging #5209 (1a1363c) into develop (44577af) will increase coverage by 0.04%.
The diff coverage is 93.94%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #5209      +/-   ##
===========================================
+ Coverage    82.03%   82.06%   +0.04%     
===========================================
  Files          533      533              
  Lines        38281    38296      +15     
===========================================
+ Hits         31399    31423      +24     
+ Misses        6882     6873       -9     
Flag Coverage Δ
django 77.12% <93.94%> (+0.04%) ⬆️
sqlalchemy 76.41% <93.94%> (+0.04%) ⬆️

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

Impacted Files Coverage Δ
aiida/orm/nodes/data/remote/base.py 67.02% <87.50%> (+0.35%) ⬆️
aiida/orm/utils/remote.py 90.57% <94.12%> (+6.85%) ⬆️
aiida/cmdline/commands/cmd_calcjob.py 79.87% <100.00%> (+5.37%) ⬆️
aiida/transports/transport.py 81.15% <100.00%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 44577af...1a1363c. Read the comment docs.

@zhubonan zhubonan requested a review from sphuber November 5, 2021 12:46
@zhubonan zhubonan marked this pull request as ready for review November 5, 2021 12:46
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Thanks a lot @zhubonan
Sorry for the delay in reviewing it.

I have some minor questions about the implementation. The exit_status part looks good to me, but not pretty sure the past and older options should be applied at the same time for filtering.

aiida/orm/utils/remote.py Show resolved Hide resolved
aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
@unkcpz
Copy link
Member

unkcpz commented Jan 11, 2022

Hi @zhubonan, do you get a chance to have a look and finish this PR. If you need any help please let me know, I also require this feature to clear the remote folder.

@zhubonan
Copy link
Contributor Author

Hi @unkcpz sorry for leaving it for a while! Just replied to your comments. I think it is almost ready to merge now

unkcpz
unkcpz previously requested changes Jan 13, 2022
Copy link
Member

@unkcpz unkcpz left a comment

Choose a reason for hiding this comment

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

Cheers! All tests passed after the outstanding fix on CI. I add a minor commit to pass the verdi performance test fail I hope you not mind @zhubonan.

I am all good with the changes except the --include-cleaned option. pinning @ramirezfranciscof for the votes.

aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks @zhubonan . Realize that I am late to the party, but have some comments.

aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_calcjob.py Outdated Show resolved Hide resolved
Copy link
Contributor

@sphuber sphuber left a comment

Choose a reason for hiding this comment

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

Thanks @zhubonan . I apologize for yet more requests, but there are a few more things I noticed. After this, I would be ok to merge this, promise 😅

aiida/orm/nodes/data/remote/base.py Show resolved Hide resolved
aiida/orm/utils/remote.py Outdated Show resolved Hide resolved
aiida/cmdline/commands/cmd_calcjob.py Show resolved Hide resolved
aiida/orm/utils/remote.py Outdated Show resolved Hide resolved
aiida/orm/nodes/data/remote/base.py Outdated Show resolved Hide resolved
A `Transport` is created for a `Computer`, but to keep the transport
class independent of the `Computer` ORM class, it is not passed as an
argument. This means however that, given a transport instance, it was
not possible to know for which `Computer` it was constructed, which is
sometimes necessary for consistency checks.

When the transport is constructed the hostname of the `Computer` is
passed as the `machine` keyword argument, and normally the hostname
should identify the computer uniquely. Note that there is still the
question of for which user the transport is configured, but that is
currently not taken into account.
@sphuber
Copy link
Contributor

sphuber commented Jan 20, 2022

@zhubonan I realized that due to my requests, the scope of the PR had broadened considerably and so I thought it best to have separate commits for clarity. Since I didn't want to burden you with this additional work, I took the liberty to rebase it myself. In the process I also updated the tests for RemoteData._clean to check the new extra. Hope you don't mind. Let me know if you want to have a final look and are ok with the changes. If so, I will merge.

@zhubonan
Copy link
Contributor Author

@sphuber No problem at all. Please free feel to edit, rebase and merge.

zhubonan and others added 2 commits January 20, 2022 11:57
Allowing to pass an already open `Transport` to the `_clean` method,
prevents having to open the same transport multiple times when cleaning
many `RemoteData` nodes on the same computer. The downside is that it is
possible for a user to pass a transport that is configured for a
computer that is not the one of the `RemoteData`. A check is added to
prevent this, but it only checks the hostname as it cannot check the
user for which the transport is configured.

In addition to this efficiency update, if the clean operation is
successful, an extra with the key `KEY_EXTRA_CLEANED` is set to `True`.
This is useful to identify `RemoteData` nodes that have been cleaned.

Co-Authored-By: Sebastiaan Huber <mail@sphuber.net>
The command did not apply the `AND` clause when both the `-o` and the
`-p` options were provided simultaneously and only the former would be
applied. This is now corrected.

On top of that, a new option `-E/--exit-status` is added that allows to
filter on a specific exit status of the calculation jobs.
@sphuber sphuber merged commit e880ab7 into aiidateam:develop Jan 20, 2022
@sphuber
Copy link
Contributor

sphuber commented Jan 20, 2022

Thanks a lot @zhubonan !

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

Successfully merging this pull request may close these issues.

None yet

3 participants