Skip to content
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

Adds --stop-on-block/--stop option to solver #1016

Merged
merged 2 commits into from
Jun 5, 2024
Merged

Conversation

dcookspi
Copy link
Collaborator

@dcookspi dcookspi commented Apr 30, 2024

This adds --stop-on-block/--stop option to solver. This option stops the solver completely when it reaches the first BLOCKED state (step-back).

This turned out to be useful when working out missing dependencies, e.g. when porting a package between OSes or python versions, or otherwise dealing with lots of dependencies changing. While debugging solves that entered solver hell, I found myself running and interrupting the solve over and over. I would scroll back up the output to the first BLOCKED line and use that to work out what request to change, or what other package needed to be converted or built and published. Having the solver stop when it hit BLOCKED streamlined the process for me.

For example:

> spk env mypackage --stop-on-block
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! BLOCKED could not satisfy 'openvdb:all/Binary:10.0.1,Binary:9.0.0' as required by: my-plugins/0.1.56/EIEIO my-something/1.0.5/ABCDEF, openimageio/2.6.0.2/ABCEII
hit BLOCKED state with '--stop-on-block' enabled.
ERROR (link)

  x Solver interrupted: hit BLOCKED state with '--stop-on-block' enabled.

It can be combined with all the usual verbosity and report settings to show more context around the point that it BLOCKED. By default, using --stop-on-block does not print the solver report that interrupting the solver with Ctrl-C or a timeout does, but you can use -t to see the report as well.

@dcookspi dcookspi added enhancement New feature or request SPI AOI Area of interest for SPI SPI-0.41 labels Apr 30, 2024
@dcookspi dcookspi requested review from jrray and rydrman April 30, 2024 19:59
@dcookspi dcookspi self-assigned this Apr 30, 2024
@dcookspi dcookspi changed the title Adds --stop-on-block/--stop option to solver. Adds --stop-on-block/--stop option to solver Apr 30, 2024
Copy link
Collaborator

@rydrman rydrman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output-related code continues to be our biggest wart, I think 😓

crates/spk-solve/src/io.rs Outdated Show resolved Hide resolved
crates/spk-solve/src/io.rs Outdated Show resolved Hide resolved
@@ -1089,16 +1124,21 @@ impl DecisionFormatter {
self.send_sentry_warning_message(
&runtime.solver,
solve_time,
if mesg.contains("by user") {
if mesg.contains("by user") || mesg.contains("--stop-on-block") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to replace this magic string with a constant? Like maybe save the message string from above as a const and then refer to it here so that it doesn't break if we change the message in the future?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added constants for this check and used them in the messages.

dcookspi and others added 2 commits May 31, 2024 12:09
This stops the solver when it first reaches a BLOCKED state and would
step back. This is useful when working out missing dependencies,
e.g. when porting a package between OSes or python versions.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
This pauses the solver when a BLOCKED state is reached (a step-back
change). The solver will start up again when the user hits Enter.

Signed-off-by: David Gilligan-Cook <dcook@imageworks.com>
@dcookspi dcookspi merged commit 5b02a07 into main Jun 5, 2024
7 checks passed
@dcookspi dcookspi deleted the adding-stop-on-block branch June 5, 2024 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SPI AOI Area of interest for SPI SPI-0.41
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants