Skip to content

Conversation

@FabianHofmann
Copy link
Collaborator

When solving with HiGHS (highspy), interrupting Python via Ctrl-C could leave the underlying solver running. This PR runs Highs.run() in a worker thread so the main thread can catch KeyboardInterrupt and signal cancelSolve().

  • Fix: linopy/solvers.py
  • Test: test/test_highs_keyboard_interrupt.py

Run HiGHS in a worker thread so the main thread can catch KeyboardInterrupt and signal cancelSolve(), preventing orphaned/continuing solves.
@FabianHofmann
Copy link
Collaborator Author

@euronion I think I remember you had an issue here? hope this will fix it

@euronion
Copy link

euronion commented Jan 7, 2026

Yes, indeed, I was facing this issue. Will try it over the next days 👍

@FabianHofmann FabianHofmann merged commit 5671eb1 into master Jan 15, 2026
18 of 20 checks passed
@FabianHofmann FabianHofmann deleted the fix/highs-ctrl-c-cancels branch January 15, 2026 13:51
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.

3 participants