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

max_attempts should only use n_installed if >0 #403

Merged
merged 3 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _max_attempts(self, in_state: SolverInputState, default: int = 1):
return installed_count
else:
return max_attempts_from_env
elif in_state.update_modifier.FREEZE_INSTALLED:
elif in_state.update_modifier.FREEZE_INSTALLED and installed_count:
# this the default, but can be overriden with --update-specs
# we cap at MAX_SOLVER_ATTEMPTS_CAP attempts to avoid things
# getting too slow in large environments
Expand Down Expand Up @@ -314,6 +314,7 @@ def _solving_loop(
for_history=dict(out_state.for_history),
neutered=dict(out_state.neutered),
conflicts=dict(out_state.conflicts),
pins=dict(out_state.pins),
)
if not solved:
log.debug("Last attempt: reporting all installed as conflicts")
Expand All @@ -335,7 +336,7 @@ def _solving_loop(
self._command = "last_solve_attempt"
else:
self._command += "+last_solve_attempt"
solved = self._solve_attempt(in_state, out_state, index)
solved = self._solve_attempt(in_state, out_state, index, attempt=attempt + 1)
if not solved:
message = self._prepare_problems_message(pins=out_state.pins)
exc = LibMambaUnsatisfiableError(message)
Expand Down
2 changes: 1 addition & 1 deletion news/394-max-attempts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Enhancements

* Add some boundary checks to `CONDA_LIBMAMBA_SOLVER_MAX_ATTEMPTS`. (#394)
* Add some boundary checks to `CONDA_LIBMAMBA_SOLVER_MAX_ATTEMPTS`. (#394, #403)

### Bug fixes

Expand Down
Loading