Add tools to evaluate infeasibility#11
Open
dlucredativ wants to merge 3 commits into
Open
Conversation
2761715 to
ed9dbca
Compare
Contributor
Author
…enario converter The cluster_state JSONL event now logs every field the solver receives — full balancing config, all Node fields (incl. memory_reserve, cpu_reserve, storage_free/reserve, pressure metrics, maintenance), and all VM fields (disks, priority, vm_type, pressure metrics). Runtime memory_used stays in the event for the reporter. The snapshot is built from the already- constructed Cluster so there is no duplicated reservation logic. A new scripts/jsonl_to_scenario.py reconstructs a YAML scenario from a solver_run JSONL using the enriched cluster_state plus the constraint events. The output loads cleanly via proxlb_solver.loader.load_scenario, enabling failing prod runs to be replayed as scenarios. Round-trip tests cover three representative scenarios (basic, pin, anti-affinity) and assert node/VM/balancing/constraints all survive scenario → cluster_state → YAML → Cluster.
Adds explain_infeasibility(cluster), a feasibility-only diagnostic solver
that mirrors solve()'s hard constraints but tags each blameable rule with
an AddAssumption() literal and wraps the constraint with .OnlyEnforceIf().
When CP-SAT proves the model unsat, SufficientAssumptionsForInfeasibility()
returns a minimal subset of those literals — they map back to structured
rule descriptions (maintenance, evacuate, ignore, pin, hard anti-affinity,
hard affinity, per-node memory/CPU capacity, per-pool storage capacity).
shadow.py calls the explainer when the main solve returns infeasible and
attaches the result as a new 'blame' field on the existing 'infeasible'
JSONL event, plus a single [solver] blame summary line to the ProxLB log.
Example output for scenarios/infeasible/pin_to_maintenance.yaml:
{'type': 'maintenance', 'node': 'node-B'}
{'type': 'pin', 'vm': 'stuck-vm', 'nodes': ['node-B']}
Tests cover three representative infeasible scenarios (anti-affinity
overflow, pin-vs-maintenance, affinity-vs-pin), feasible and empty
clusters (must return []), plus the shadow integration end-to-end.
cli.py runs explain_infeasibility() once per infeasible scenario and plumbs the result through to all three report writers, mirroring the existing migration_plans plumbing. reporter.py gains _format_blame_line() (one-line human-readable rendering of a blame dict) and prints the blame after the INFEASIBLE marker in: - print_report (terminal: bulleted list under the INFEASIBLE line) - write_markdown_report (Markdown: **Blame** block + list items) - write_html_report (HTML: <p><b>Blame</b></p><ul>…) make report now shows precisely which rules collide for every infeasible scenario (affinity-vs-pin, anti-affinity overflow, pin-to-maintenance, evacuate-vs-capacity, RULE_CONFLICT cases, …) instead of just the bare "INFEASIBLE" status.
ed9dbca to
fd37a94
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.


No description provided.