chkwon / PATHSolver.jl

provides a Julia wrapper for the PATH Solver for solving mixed complementarity problems
http://pages.cs.wisc.edu/%7Eferris/path.html
MIT License
50 stars 15 forks source link

Forward user interrupts #100

Closed lassepe closed 8 months ago

lassepe commented 8 months ago

Currently, when running PATH in a for-loop, one cannot really interrupt the program reliably. The reason for this is that the ctrl+c will often just be caught by PATH (in C) but the interrupt is never forwarded to Julia. This PR throws an interrupt error when the status of the C call is MCP_UserInterrupt.

codecov[bot] commented 8 months ago

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (72d8307) 94.33% compared to head (2c34f9e) 94.14%.

Files Patch % Lines
src/C_API.jl 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #100 +/- ## ========================================== - Coverage 94.33% 94.14% -0.20% ========================================== Files 3 3 Lines 459 461 +2 ========================================== + Hits 433 434 +1 - Misses 26 27 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

odow commented 8 months ago

Can't we tell from the fact that the status is MCP_UserInterrupt? Why does an error need to be thrown?

Your for-loop should handle the interrupted status case instead.

lassepe commented 8 months ago

Yeah, if you don't want it here, can also do it downstream in my own lib. Feel free to close this in that case

odow commented 8 months ago

Just to check before closing: does PATH correctly terminate with MCP_UserInterrupt on a CTRL+C?

lassepe commented 8 months ago

Yes, it does.