-
Notifications
You must be signed in to change notification settings - Fork 235
✨ BaseRestartWorkChain: add max iterations per handler and pause #7139
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7139 +/- ##
===========================================
- Coverage 79.60% 29.17% -50.43%
===========================================
Files 566 566
Lines 43584 43566 -18
===========================================
- Hits 34691 12705 -21986
- Misses 8893 30861 +21968 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @mbercx I tested it directly in the QE App aiida 2.7.1 aiida_quantumespresso 4.13 For me it works, just a minor bug (see image below):
|
607b133 to
1b391bf
Compare
1b391bf to
bda4564
Compare
|
Thanks for testing @cpignedoli! Good catch on the report. I fixed this, but realised a critical issue in my original implementation: Returning an exit code in the To fix this, I've moved all the logic regarding
Tests and documentation have been added, so I think this one is now ready for proper review! EDIT: spoke too soon; some more notes:
def handle_vcrelax_converged_except_final_scf(self, calculation):
"""Handle `ERROR_IONIC_CONVERGENCE_REACHED_EXCEPT_IN_FINAL_SCF` exit code.
Convergence reached in `vc-relax` except thresholds exceeded in final scf: consider as converged.
"""
self.ctx.is_finished = True
action = 'ionic convergence thresholds met except in final scf: consider structure relaxed.'
self.report_error_handled(calculation, action)
self.results() # Call the results method to attach the output nodes
return ProcessHandlerReport(True, self.exit_codes.ERROR_IONIC_CONVERGENCE_REACHED_EXCEPT_IN_FINAL_SCF)Notice the "hack" here: EDIT2: This second issue is now fixed in 09aa0b7, and I've added a test for it. |
| ) | ||
| self.pause(f"Paused for user inspection, see: 'verdi process report {self.node.pk}'") | ||
|
|
||
| return last_report.exit_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.
Here, the BaseRestartWorkChain used the fact that returning ExitCode(0) in a step of the outline doesn't really do anything as far as I can tell: it simply starts executing the next step. Might be there is not even any difference between returning that and None.
I think it's better to be explicit and return the exit code in case its exit status is nonzero, and return None otherwise.
| This is the case as long as the last process has not finished successfully or a handler has been triggered. | ||
| """ | ||
| max_iterations = self.inputs.max_iterations.value | ||
| return not self.ctx.is_finished and self.ctx.iteration < max_iterations |
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.
Whether or not the global max_iterations has been reached is now checked in the inspect_process step.

@cpignedoli this is a rough draft PR for you to test! I have to sign off for the day, but already wanted to get your feedback.
To be clear: this is not ready for proper review. ^^ It's based on/blocked by #7116,
pre-commitwas ignored, no tests, no documentation changes. Just to see if it already works as expected and to get feedback on one question:Some code that may help in testing: