SU2 icon indicating copy to clipboard operation
SU2 copied to clipboard

[WIP] Signal handling - SIGTERM will stop calculation and force file saving

Open bigfooted opened this issue 2 years ago • 4 comments

Proposed Changes

Special signal handling for SIGTERM. When SIGTERM is sent to the solver, we catch it and simply exit the for-loop for the number of iterations. Files will then automatically be saved.

Related Work

Related to Github discussion #2094

PR Checklist

Put an X by all that apply. You can fill this out after submitting the PR. If you have any questions, don't hesitate to ask! We want to help. These are a guide for you to know what the reviewers will be looking for in your contribution.

  • [x] I am submitting my contribution to the develop branch.
  • [x] My contribution generates no new compiler warnings (try with --warnlevel=3 when using meson).
  • [x] My contribution is commented and consistent with SU2 style (https://su2code.github.io/docs_v7/Style-Guide/).
  • [ ] I have added a test case that demonstrates my contribution, if necessary.
  • [ ] I have updated appropriate documentation (Tutorials, Docs Page, config_template.cpp), if necessary.

bigfooted avatar Aug 15 '23 07:08 bigfooted

Here is a simple proof-of-concept for the fluid iteration where we catch SIGTERM. If you run it and hit ctrl-c, we catch the signal and we set stopcalc to true. This will exit the for-loop and also forces a saving of the files. I think implementing the signal handler like this is the best, because we let the solver handle all the cleanup.

bigfooted avatar Aug 15 '23 07:08 bigfooted

We probably also have to do something like this at other places where we have external iterations.

bigfooted avatar Aug 15 '23 10:08 bigfooted

OK, so I am moving the signal handling to COutput::ConvergenceMonitoring as discussed in the dev-meeting.

bigfooted avatar Aug 16 '23 08:08 bigfooted

@pcarruscag This works for me. Do you think this is OK or we need to do it different/more, maybe a config keyword to activate/deactivate, or other options?

bigfooted avatar Sep 04 '23 08:09 bigfooted