{aimanager} Always show Feasible column in calculate-cost table output - #10357
Conversation
The 'az aimanager model calculate-cost -o table' output dropped the 'Feasible' column whenever every SKU was infeasible, because the service omits 'feasible' on infeasible plans and azure-cli drops all-blank columns — hiding the single most useful column exactly when it matters. Replace the JMESPath table transformer with a callable formatter that coerces 'feasible' to an explicit True/False for every plan, so the column is always populated and never dropped. Also add an 'InfeasibilityReason' column surfacing the per-plan reason code. Fixes AB#39624918
|
Hi Liqian Luo (@circy9), |
There was a problem hiding this comment.
🟢 Approval recommended
All reviewed changes are covered by the supplied tests and no unresolved issues were identified.
Pull request overview
Updates calculate-cost -o table to always show feasibility and infeasibility reasons for model plans.
Changes:
- Replaces the JMESPath transformer with a callable formatter.
- Displays explicit
True/Falsefeasibility values. - Adds
InfeasibilityReasonoutput and regression tests. - Bumps the extension version to
1.5.5b1.
File summaries
| File | Description |
|---|---|
src/aimanager/setup.py |
Updates the extension version. |
src/aimanager/HISTORY.rst |
Documents the release changes. |
src/aimanager/azext_aimanager/tests/latest/test_aimanager_format.py |
Adds formatter regression tests. |
src/aimanager/azext_aimanager/constants.py |
Removes the obsolete transformer. |
src/aimanager/azext_aimanager/commands.py |
Registers the callable formatter. |
src/aimanager/azext_aimanager/_format.py |
Implements feasibility and reason formatting. |
Review details
- Files reviewed: 6/6 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Local test results ✅Tested with
|
Real output from
|
Real output — mixed feasible/infeasible (sub with actual GPU quota) ✅Re-ran in Small model —
|
The service returns reason codes prefixed with "InfeasibleCode_" (e.g. "InfeasibleCode_InefficientDeployment"), which is redundant and makes the column unnecessarily wide in -o table output. Strip the prefix so the column shows just "InefficientDeployment" / "InsufficientQuota".
Follow-up: strip
|
|
aimanager |
Address PR review feedback:
- Coerce 'feasible' via a strict helper so a JSON-string "false" becomes
False (bool("false") is truthy in Python). The vendored SDK already
deserializes it as a real bool, but this guards any raw-dict path.
- Mention the Feasible / InfeasibilityReason table columns in the
calculate-cost command help long-summary.
93665e9
|
[Release] Update index.json for extension [ aimanager-1.5.5b1 ] : https://dev.azure.com/msazure/One/_build/results?buildId=181767151&view=results |
🤖 PR Validation — ️✔️ All clear
Summary
az aimanager model calculate-cost -o tabledropped theFeasiblecolumn whenever every SKU was infeasible — which is exactly the case where that column is most useful. The service omitsfeasibleon infeasible plans, so the JMESPath projection rendered those cells blank, and azure-cli drops all-blank columns. The result was an unlabeled table with no way to tell that nothing was deployable.CALCULATE_COST_TABLE_TRANSFORMERJMESPath string with a callable formatter (calculate_cost_table_formatin_format.py) that coercesfeasibleto an explicitTrue/Falsefor every plan, so the column is always populated and never dropped.InfeasibilityReasoncolumn surfacing the per-plan reason code (e.g.InsufficientQuota) for infeasible SKUs.1.5.5b1and add aHISTORY.rstentry.Fixes AB#39624918
Test plan
azdev style aimanager— PASSED (pylint + flake8)azdev linter aimanager— no violationspython -m unittest azext_aimanager.tests.latest.test_aimanager_format— 20 tests pass, including newTestCalculateCostTableFormatcovering the all-infeasible regression, explicitTrue/Falserendering, infeasibility reason, and empty/missing plans.