-
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
Migrate verdi code #1655
Migrate verdi code #1655
Conversation
fix aiidateam#1614 Code.get_code_label is the same as Code.label, but you can get the full code label (including computer name) by specifying 'full=True'
* migrate verdi code rename to click * add verdi code relabel (verdi code rename deprecated) * add Code.relabel function * deprecate verdi code update
+ fix 'code show' and add test
Codecov Report
@@ Coverage Diff @@
## verdi #1655 +/- ##
=========================================
+ Coverage 60.9% 60.92% +0.02%
=========================================
Files 298 299 +1
Lines 34054 33721 -333
=========================================
- Hits 20741 20546 -195
+ Misses 13313 13175 -138
Continue to review full report at Codecov.
|
+ fix bug introduced in merge
Check for absolute path was only done at the very end.
@sphuber should be ready for you to have a look now |
@@ -19,12 +19,14 @@ | |||
aiida/cmdline/tests/.*.py| # the .*.py (.* matches everything) | |||
aiida/cmdline/commands/calculation.py| | |||
aiida/cmdline/commands/daemon.py| | |||
aiida/cmdline/commands/code.py| |
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.
Please also add aiida.backends.tests.cmdline.commands.test_code.py
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.
Done
result = self.runner.invoke(hide, [str(self.code.pk)]) | ||
self.assertIsNone(result.exception) | ||
|
||
self.assertTrue(self.code.get_extra(self.code.HIDDEN_KEY)) |
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.
Probably better to use the method _is_hidden
. The linter will then complain that a protected method is called, but I think that method should be public anyway. So it would be great if you could make _is_hidden
public. While we are at it, I think we should also make _reveal
and _hide
public
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.
yes, I had opened an issue for that #1660 but nobody replied.
If you agree, I'll proceed with it.
self.pk, self.uuid) | ||
return computer_str | ||
|
||
def get_label(self, full=True): |
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.
Is there a specific point to have this construction for get_label
. Given that default is True
, wouldn't it make more sense to just rename this function to get_full_label
without the args, since the normal label should just be gotten with Codel.label
.
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.
Good catch, the intention was full=False
as default. Would you agree with this change?
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.
Why not have a property like:
@property
def full_label(self):
return '{}@{}'.format(self.label, self.computer.name)
That seems a lot cleaner, because I don't see the point of having the method with the argument, if you already have a perfectly good property for label
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.
Agreed.
aiida/cmdline/commands/code.py
Outdated
# continue | ||
# else: | ||
# newlines.append(input_txt) | ||
# except EOFError: |
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.
Why is this commented and not just removed?
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.
Before deleting old code I wanted to make sure all useful bits have been carried over.
I've now removed a bunch more comments, what is still there I'd like to leave until verdi code duplicate
is implemented
leaving in a few comments for verdi code duplicate
fix aiidateam#1660 * Code._hide => Code.hide * Code._reveal => Code.reveal * Code._is_hidden => Code.is_hidden
replacing function with parameter full by property.
I'm now looking into one last thing which is the naming issue of local codes. |
fix aiidateam#127 Adjust help strings similar to suggestion in aiidateam#127 (comment)
ask for input plugin before asking for anything related to the computer where the code is stored.
@sphuber Done. |
@sphuber Should be fine from my side - let me know if there's anything else you'd like to change |
Did this rely on Rico's PR of the prompts? Or it does not matter in which order they are merged? |
No, they should be independent. |
Migrating
verdi code
commands to clickverdi code delete
verdi code hide
verdi code reveal
verdi code relabel
verdi code list
verdi code update
(suggests to useverdi code duplicate
)verdi code rename
(still works for the moment, forwards toverdi code relabel
)verdi code list
verdi code setup
Still to do:
deprecated
decorator forcode update
andcode rename
verdi code setup
=>
prefix be brought back? NO?
for help (will be fixed in make prompts yellow (and add help for invalid args to prompts) #1684)For
verdi code duplicate
I'll add a separate pull request* add option to hide previous code
* potentially make use of callback to fill values of one option by value of other options (ask martin). It might be better though to use context forwarding to
verdi code setup