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 verdi code duplicate #1737

Merged
merged 21 commits into from
Sep 3, 2018
Merged

Conversation

ltalirz
Copy link
Member

@ltalirz ltalirz commented Jul 10, 2018

fix #1500
fix #1790

Still to do:

  • add option to hide previous code
  • add tests
  • think about whether it makes sense to avoid duplication of click parameters for verdi code duplicate and verdi code setup

ltalirz added 5 commits July 9, 2018 11:42
Still to do:
 * add possibility to override parameters
 * store duplicated code
 * add tests
still to do
 * add option to hide previous code
 * add tests
@ltalirz
Copy link
Member Author

ltalirz commented Jul 14, 2018

@sphuber The tests fail when "submitting 15 old-style calculations to the daemon", and the error is

aiida.common.exceptions.MissingEntryPointError: Entry point 'simpleplugins.templatereplacer = aiida.orm.calculation.job.simpleplugins.templatereplacer:TemplatereplacerCalculation' not found in group 'aiida.calculations'

https://travis-ci.org/ltalirz/aiida_core/jobs/403912242#L1540

This is unexpected, since I haven't modified any calculation-related files.
Also, when I do verdi calculation plugins, the simpleplugins.templatereplacer plugin still shows up.

Is the reason for the error that it tries to find the string simpleplugins.templatereplacer = ... instead of just simpleplugins.templatereplacer?

If you don't have any pointers, I'll investigate, just wanted to ask first.

}

def cli(self, *args): # pylint: disable=unused-argument,no-self-use
verdi.main()

# pylint: disable=fixme
Copy link
Contributor

@DropD DropD Jul 17, 2018

Choose a reason for hiding this comment

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

Never use this, instead replace old TODO comment with an issue, unless it is obviously outdated of course.
For new TODO comments: commit using --no-verify.
Reason: TODO comments should only be used to indicate that action is required before merging. In which case they should cause tests to fail.

@sphuber
Copy link
Contributor

sphuber commented Jul 23, 2018

@ltalirz I found the problem that cause the tests to fail. You accidentally removed the .name attribute call on the entry point in the CodeBuilder, so now the EntryPoint instance is set as opposed the string name. See this commit to fix it: 0753c7c

@sphuber
Copy link
Contributor

sphuber commented Jul 23, 2018

This is the last open PR for the verdi branch. Would it be possible to get it ready for merging by tomorrow? In that case @DropD and me can rip out the old plumbing and rely solely on click. If not, maybe we could merge anyway and open an issue for the remaining sub tasks?

@ltalirz
Copy link
Member Author

ltalirz commented Jul 23, 2018 via email

sphuber added 2 commits July 24, 2018 12:46
The `.name` attribute call was removed, leading the EntryPoint instance
to be set, instead of its `simpleplugins.templatereplacer` name
@codecov-io
Copy link

codecov-io commented Jul 24, 2018

Codecov Report

Merging #1737 into develop will increase coverage by 0.09%.
The diff coverage is 90.09%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #1737      +/-   ##
===========================================
+ Coverage    67.28%   67.37%   +0.09%     
===========================================
  Files          320      320              
  Lines        33178    33264      +86     
===========================================
+ Hits         22325    22413      +88     
+ Misses       10853    10851       -2
Impacted Files Coverage Δ
aiida/cmdline/params/options/__init__.py 100% <ø> (ø) ⬆️
aiida/cmdline/commands/cmd_user.py 92.68% <ø> (ø) ⬆️
aiida/control/code.py 83.33% <86.66%> (+8.62%) ⬆️
aiida/cmdline/commands/cmd_code.py 92.37% <91.54%> (-0.27%) ⬇️
aiida/orm/implementation/sqlalchemy/group.py 88.26% <0%> (+0.51%) ⬆️
aiida/orm/implementation/general/code.py 79.49% <0%> (+1.25%) ⬆️

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 a48ae14...8d080e4. Read the comment docs.

DropD
DropD previously requested changes Jul 24, 2018
Copy link
Contributor

@DropD DropD left a comment

Choose a reason for hiding this comment

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

@ltalirz should rebase this in order to be attributed as author for the changes.

@sphuber sphuber changed the base branch from verdi to develop July 27, 2018 07:48
@ltalirz ltalirz self-assigned this Aug 3, 2018
@ltalirz
Copy link
Member Author

ltalirz commented Aug 3, 2018

I've now added a test for the non-interactive version and for the interactive version.
The non-interactive test passes. For the interactive one, the test exits with exit status 2 but I don't know why (testing the interactive version by hand works) and I have no idea how to debug it.

fix interactive unit test for verdi code duplicate
@ltalirz
Copy link
Member Author

ltalirz commented Aug 6, 2018

@DropD Please have a look, from my point of view it can be merged.

Currently, code_duplicate duplicates the options of code setup (with some extra stuff to set the defaults from the code to be duplicated).
This results in quite a bit of code duplication but I don't know how to avoid it - is there another way of copying the options from verdi code setup into verdi code duplicate without actually copying the lines for the click arguments/options?

P.S. When you said I should rebase this in order to be credited, is this still needed?
I.e. when I squash and merge, will it not be my commit?

@sphuber
Copy link
Contributor

sphuber commented Aug 14, 2018

Why can't we just define the common options/arguments once in the cmdline.params.options file and just override those keyword arguments that are different when you decorate the actual command?

As far as the rebase goes, since you have added the last few commits, I think the attribution will go to you when we squash and merge

Finally, you put in the PR header that this fixes #1788 , but that does not seem to be the case?

@ltalirz
Copy link
Member Author

ltalirz commented Aug 20, 2018

Why can't we just define the common options/arguments once in the cmdline.params.options file and just override those keyword arguments that are different when you decorate the actual command?

@sphuber I started doing this but I'm not sure this belongs together with the other options since it is rather code-specific (and this is not always obvious from the name of the option):

ON_COMPUTER = OverridableOption(
    '--on-computer/--store-in-db',
    is_eager=False,
    default=True,
    prompt='Installed on target computer?')

REMOTE_ABS_PATH = OverridableOption(
    '--remote-abs-path',
    prompt='Remote absolute path',
    type=types.AbsolutePathParamType(dir_okay=False),
    help=('[if --on-computer]: the absolute path to the executable on the remote machine'))

CODE_FOLDER = OverridableOption(
    '--code-folder',
    prompt='Local directory containing the code',
    type=click.Path(file_okay=False, exists=True, readable=True),
    help=('[if --store-in-db]: directory containing the executable and all other files necessary for running it'))

CODE_REL_PATH = OverridableOption(
    '--code-rel-path',
    prompt='Relative path of executable inside code folder',
    type=click.Path(dir_okay=False),
    help=('[if --store-in-db]: relative path of the executable ' + \
          'inside the code-folder'))

If you like, I can still define them as OverridableOptions inside cmd_code.py (or cmd_code_options.py, whatever...) and then reuse them.

Finally, you put in the PR header that this fixes #1788 , but that does not seem to be the case?

Good catch - I must have misread the PR title

@sphuber
Copy link
Contributor

sphuber commented Aug 21, 2018

I don't think it would be too big of a problem too put them in the general options.py even though they are a bit specific, because there are already some other options that are also specific to just a few commands. However, I would also be fine with just defining them as OverridableOptions in cmd_code.py

@ltalirz
Copy link
Member Author

ltalirz commented Aug 30, 2018

@sphuber I am getting error messages (see particularly sqlalchemy build on travis) that seem to be entirely unrelated to my PR.
Already the bug fixed in my last commit is something where I don't understand how it could end up here (I didn't touch verdi user).
Do you have an idea what could be going wrong here?

@sphuber
Copy link
Contributor

sphuber commented Aug 30, 2018

I have no clue, the build simply seems to timeout because one of the unittests seems stuck. Do the tests run locally? I have at least a problem one my local workstation that the test that tries to delete a profile aiida.backends.test.cmdline.commands.profile hangs indefinitely. I think that might have to do with sudo issues, but not sure. Not sure if that is the same one on Travis and if so why all of sudden this is happening. Unfortuately I am busy in meetings all day, so cannot look in detail now

@ltalirz ltalirz changed the title [WIP] Add verdi code duplicate Add verdi code duplicate Sep 3, 2018
@ltalirz ltalirz dismissed DropD’s stale review September 3, 2018 11:58

according to @sphuber, rebasing should not be necessary

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.

Looks good, thanks @ltalirz

@sphuber sphuber merged commit a575e8c into aiidateam:develop Sep 3, 2018
@ltalirz ltalirz deleted the add_verdi_code_duplicate branch October 21, 2018 16:03
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.

Add tests for verdi code duplicate verdi code update now crashes
4 participants