-
Notifications
You must be signed in to change notification settings - Fork 14
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
check if code is none in workchain #505
Conversation
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #505 +/- ##
==========================================
+ Coverage 78.29% 78.31% +0.02%
==========================================
Files 44 44
Lines 3160 3164 +4
==========================================
+ Hits 2474 2478 +4
Misses 686 686
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
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.
Thanks @superstar54, I guess the issue only happens if there are other code, e.g xps involved in the calculation, correct?
The change looks all good for me, can you add a unit test to it?
For all codes. e.g if not calculate |
Thanks for the suggestion. I have added the test. |
"""Test if there is an error when the code is not selected.""" | ||
app = submit_app_generator() | ||
app.submit_step.dos_code.value = None | ||
app.submit_step._create_builder() |
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.
Thanks for adding the test. But I didn’t see what you were testing for. Maybe add an assert statement, what is the value of dos code in the builder?
I also don’t understand why dos code will be None, the drop-down widget only has its value equal to None right after initialization but we already have localhost code for it as default.
But I agree the change is needed for the case such as xps code.
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.
I also don’t understand why dos code will be None, the drop-down widget only has its value equal to None right after initialization but we already have localhost code for it as default.
If I may add something here (as the person that found this bug originally): I confirm that Xing's fix does work, though I agree that the nature of the issue is strange. From my own testing:
- Running Bands or Xps alone without dos or pdos set returns the error:
ValueError: one of the parameters 'identifier', pk', 'uuid' or 'label' has to be specified
. You can actually request a Pdos calculation in step 2, set the dos.x and projwfc.x codes in step 3, then un-tick the Pdos calculation in step 2 to avoid the error without running Pdos. - Removing the line
codes = {key: orm.load_node(value) for key, value in codes.items()}
and just passingcodes
without converting the inputs (i.e.codes = parameters["codes"]
) works without issues for Bands and Xps, but causes a different crash for Pdos. Unfortunately, I can't find the traceback for that one right now, but it seemed to be that the values for dos and pdos codes were in the form of their UUID, rather than a node like for pw.x.
Hope this helps a little in diagnosing the problem.
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.
Thanks a lot for the details @PNOGillespie very helpful.
but it seemed to be that the values for dos and pdos codes were in the form of their UUID, rather than a node like for pw.x.
I have a feeling this could be related to the source of issue. The change look all good and I should not block the PR. approved.
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.
@PNOGillespie Thanks for the information.
fix #506
If no code is not selected, it is
None
. So, in the workchain, we avoid loading it.