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

Migrate verdi computer disable/enable to click #1716

Merged

Conversation

giovannipizzi
Copy link
Member

This is a partial migration of verdi computer (see #1582).
Focuses on enable and disable only, tests added.

I extracted the work I was doing in a different branch to isolate only the changes to disable/enable, and allow other people to help with the commands.

I will take care in a different PR of the interactive commands (setup and configure).

For now only converted enable and disable,
tests added.
@giovannipizzi giovannipizzi requested review from DropD and sphuber July 5, 2018 07:59
@giovannipizzi
Copy link
Member Author

ups... didn't realize there were already some tests for the old cli interface. I'm going to remove them.

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.

Minor changes, you can disregard the comments about using echo_critical instead of print >> stderr because I forgot that you weren't converting everything. Did you add these files to pre-commit or will we wait until full command is migrated?

from aiida.common.exceptions import NotExistent


# pylint: disable=missing-docstring
Copy link
Contributor

Choose a reason for hiding this comment

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

pylint disable does not seem necessary here? Even more so given that these files have not been added to pre-commit yet?

"""

@classmethod
def setUpClass(cls, *args, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

the base AiidaTestCase already provides a computer class property. If this computer is just a base stud, maybe you could that one to avoid duplication

except KeyError:
print >> sys.stderr, ("Internal error! "
"No {} getter defined in Computer".format(getter_name))
print >> sys.stderr, ("Internal error! " "No {} getter defined in Computer".format(getter_name))
Copy link
Contributor

Choose a reason for hiding this comment

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

print with aiida.cmdline.utils.echo based functions. the echo_critical will automatically print to stderr and exit

except KeyError:
print >> sys.stderr, ("Internal error! "
"No {} setter defined in Computer".format(setter_name))
print >> sys.stderr, ("Internal error! " "No {} setter defined in Computer".format(setter_name))
Copy link
Contributor

Choose a reason for hiding this comment

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

see above about echo

echo.echo_info("Computer '{}' already disabled.".format(computer.name))
else:
computer.set_enabled_state(False)
echo.echo_info("Computer '{}' disabled.".format(computer.name))
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe for the cases where the (desired) change is actually effectuated, it would be good to use echo_success instead of echo_info?

@giovannipizzi
Copy link
Member Author

I temporarily added it to at least fix the formatting, but there were too many problems with prospector that will be anyway solved when finishing the conversion, so I disabled it for now.

(old test removed/replaced, and the verdi computer test
moved to the right file)
@giovannipizzi
Copy link
Member Author

hi guys, do you have an idea why the tests are failing?

  1. I fixed the code with yapf and locally it does not show anything to do, but it's still complaining on Travis
  2. I get some mlocate problems, but I don't think I changed anything related to that, maybe something changed on the default Travis configuration?

probably I had committed with a different version?
@giovannipizzi
Copy link
Member Author

I added a sudo updatedb to travis, but now the fixtures that create a Postgres cluster fail, @DropD any suggestion/help here?

@codecov-io
Copy link

Codecov Report

Merging #1716 into verdi will increase coverage by 0.02%.
The diff coverage is 53.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##            verdi    #1716      +/-   ##
==========================================
+ Coverage   61.26%   61.28%   +0.02%     
==========================================
  Files         300      300              
  Lines       33541    33518      -23     
==========================================
- Hits        20550    20543       -7     
+ Misses      12991    12975      -16
Impacted Files Coverage Δ
aiida/orm/implementation/general/computer.py 50.87% <100%> (+0.28%) ⬆️
aiida/cmdline/commands/computer.py 32.17% <52.42%> (-0.5%) ⬇️
aiida/cmdline/baseclass.py 44.07% <0%> (+1.31%) ⬆️

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 f6aed0e...78b438e. Read the comment docs.

@sphuber sphuber merged commit 461cc27 into aiidateam:verdi Jul 6, 2018
@giovannipizzi giovannipizzi deleted the fix_partial_1582_verdi_computer_disable branch July 9, 2018 18:59
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.

3 participants