perform solving by polling clingo with asyncio to handle SIGINT#51338
Draft
cosmicexplorer wants to merge 2 commits intospack:developfrom
Draft
perform solving by polling clingo with asyncio to handle SIGINT#51338cosmicexplorer wants to merge 2 commits intospack:developfrom
cosmicexplorer wants to merge 2 commits intospack:developfrom
Conversation
fd535fd to
893b2fb
Compare
Contributor
Author
|
Ok, a few things I need to fix:
|
Member
|
@cosmicexplorer I just saw this PR, and noticed I was experimenting with the same thing for a different reason. I think we can do what you want in a few lines, see 6b61d2b, since we already perform the solve in a different thread. Let me know if that works for your use case. |
a738280 to
6868442
Compare
Contributor
Author
|
@alalazo well, I had a lot of fun figuring out how to make this approach work in asyncio. I think your solution is great! I will leave this as a draft and we can come back to it if we want to coordinate e.g. highly parallel solves. |
77770a2 to
196eed1
Compare
- move to llnl.util.subthread - now move it back to asp.py - add docs and justification - remove future annotations for py36 compat Signed-off-by: Danny McClanahan <[email protected]>
Signed-off-by: Danny McClanahan <[email protected]>
1ab1b12 to
1f1e881
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem: interrupting the solver is impossible
I'm hacking away at #51245. In particular see the followup tasks I'm working on at #51245 (comment), which note how the solver is unresponsive to
^Cwhen it triggers the invalid variant condition described in that issue.It turns that clingo isn't doing anything wrong, but we really need to avoid blocking on the
SolveHandle.wait(-1)method. Without spack/spack-packages#1600, the following hangs:Aside: this is a really frustrating failure mode
I triggered this failure mode by accident trying to add new build variants for python 3.15
--disable-gil, and I triggered it again when trying to buildicu4cstatically to impress a friend of mine who does packaging for alpine. So until we have a handle on the infinite looping (#51245 narrows it down to variant defaults), I think this will be especially important.Even once we do fix the infinite looping, this is the one part of the spack run that is completely unresponsive to user input or progress output.
Solution: push the solver to asyncio
spack.llnl.util.subthreadto characterize threaded processes which produce outputResult
^Cworks during solver hangs