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

PP plugin, add back 'settings' input #537

Merged
merged 4 commits into from
Jul 14, 2020
Merged

Conversation

yakutovicha
Copy link
Collaborator

@yakutovicha yakutovicha commented Jul 9, 2020

fixes #536

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 @yakutovicha , implementation looks fine. Could you maybe just add a test for the cmdline setting?

@sphuber
Copy link
Contributor

sphuber commented Jul 9, 2020

If you update the branch, the tests should now also run because I pushed a fix to develop

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 @yakutovicha . Three minor things and then this is good to go

@@ -24,6 +24,8 @@ def _generate_inputs(parameters=None):
generate_remote_data(fixture_localhost, fixture_sandbox.abspath, 'quantumespresso.pw'),
'parameters':
orm.Dict(dict=parameters),
'settings':
orm.Dict(dict=settings) or orm.Dict(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this works as expected. The or won't be applied to the value of settings but orm.Dict(dict=settings), so no matter the value of settings you will always hit the first clause. Since orm.Dict(dict=None) is fine and is exactly equal to orm.Dict() you might as well get rid of or orm.Dict()

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah, didn't know. And you are right, empty AiiDA Dict object is not falsy:

In [3]: if Dict(dict={}):
   ...:     print("Hello")
   ...:
Hello

Maybe one should fix this here as well:

'settings': orm.Dict(dict=settings) or orm.Dict(),

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, yes, please do

Copy link
Collaborator Author

@yakutovicha yakutovicha Jul 14, 2020

Choose a reason for hiding this comment

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

also, just a side note:

In [6]: Dict(dict=None) == Dict(dict=None)
Out[6]: False

not sure whether this is what we expect.

tests/calculations/test_pp.py Outdated Show resolved Hide resolved
tests/calculations/test_pp.py Outdated Show resolved Hide resolved
yakutovicha and others added 2 commits July 14, 2020 10:07
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 @yakutovicha

@sphuber sphuber merged commit 260ada4 into develop Jul 14, 2020
@sphuber sphuber deleted the fix/536/add_settings_pp branch July 14, 2020 08:21
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.

Put back settings input to pp.x plugin.
2 participants