training: Add support for capacityUnitCount and update command job schema - #9349
Open
saanikaguptamicrosoft wants to merge 2 commits into
Open
training: Add support for capacityUnitCount and update command job schema#9349saanikaguptamicrosoft wants to merge 2 commits into
saanikaguptamicrosoft wants to merge 2 commits into
Conversation
Aligns the training extension with Foundry's new job submission shape: - YAML: add top-level capacity_unit_count and priority; drop gpu_count and trim resources block to instance_count only. The service now infers the SKU from the compute cluster; users express partial-SKU allocation via capacity_unit_count. - Wire: CommandJob gains top-level capacityUnitCount and priority; ResourceConfig trimmed to instanceCount (instance_type, shm_size, docker_args, properties/AISuperComputer removed from the write path). - Read/show: RunHistoryCompute keeps GPUCount, InstanceType and legacy Priority so 'job show' still displays useful info for older jobs; new jobs prefer the top-level CapacityUnitCount and Priority from Get Job, falling back to run history otherwise. - Template: 'azd ai training init' scaffolds the new shape with capacity_unit_count and priority as commented-out optional fields.
saanikaguptamicrosoft
requested review from
JeffreyCA,
achauhan-scc,
kingernupur and
trangevi
as code owners
July 29, 2026 09:28
|
Azure Pipelines: Successfully started running 1 pipeline(s). 21 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
Pull request overview
Aligns training-job YAML, wire models, display logic, and scaffolding with Foundry’s capacity-unit submission schema.
Changes:
- Replaces GPU sizing with top-level capacity units and priority.
- Restricts resource configuration to instance count.
- Updates job display fallbacks and generated YAML.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
pkg/models/job.go |
Adds new command-job wire fields. |
pkg/models/history.go |
Supports new and legacy compute metadata. |
pkg/models/common.go |
Narrows resource configuration. |
internal/utils/yaml_parser.go |
Updates the accepted YAML shape. |
internal/cmd/job_submit.go |
Maps new fields into submissions. |
internal/cmd/job_show.go |
Updates compute-detail rendering. |
internal/cmd/init_template.go |
Scaffolds the new YAML format. |
Comments suppressed due to low confidence (1)
cli/azd/extensions/azure.ai.training/internal/cmd/job_show.go:483
- [azd-code-reviewer] These top-level Get Job fields are still rendered only inside the
History.Compute != nilbranch. Run history is supplementary and may be unavailable, so a new job can show its compute name while omitting bothCapacity UnitsandPriority. Render top-level values independently, then consult run history only for fallback values.
// Prefer the user-submitted capacityUnitCount (from Get Job) when present — for
// partial-SKU jobs it reflects the actual allocation. Fall back to the SKU GPU
// count reported by run history for older jobs that pre-date capacityUnitCount.
if d.Job.Properties.CapacityUnitCount > 0 {
fmt.Fprintf(w, "Capacity Units:\t%d\n", d.Job.Properties.CapacityUnitCount)
Comment on lines
83
to
84
| resources: | ||
| instance_count: 1 |
| Resources *ResourceDefinition `yaml:"resources"` | ||
| InstanceCount int `yaml:"instance_count"` | ||
| GPUCount int `yaml:"gpu_count"` | ||
| CapacityUnitCount int `yaml:"capacity_unit_count"` |
Comment on lines
+389
to
+392
| // Resources — only instance_count is meaningful; instance_type / slaTier / AISuperComputer | ||
| // have been removed from the wire and the service now infers the SKU from the compute | ||
| // cluster. Partial-SKU allocation is surfaced via capacityUnitCount in the Compute section. | ||
| if props.Resources != nil && props.Resources.InstanceCount > 0 { |
Get Job echoes the SKU fields the service infers from the compute cluster (instance_type, and slaTier when applicable). Restore those fields on ResourceConfig so they roundtrip through the client, and show Instance Type alongside Instance Count in 'job show'. The submit path is unchanged (only instance_count is set); everything else is populated by the service and read back.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (4)
cli/azd/extensions/azure.ai.training/internal/utils/yaml_parser.go:85
- [azd-code-reviewer]
yaml.Unmarshalignores unknown keys, so removing these fields makes existing files containinggpu_count,resources.instance_type,shm_size,docker_args, orpropertiesvalidate successfully while silently discarding their allocation settings. Reject removed keys with migration guidance (for example,gpu_count→capacity_unit_count) in both submit and offline-validation parsing paths, or enable strict known-field decoding consistently.
// Only instance_count is honored; instance_type, slaTier, priority and the AISuperComputer
// properties block have been removed — the service now infers the SKU from the compute
// cluster, priority is a top-level job field, and users specify partial capacity via the
// top-level capacity_unit_count field.
type ResourceDefinition struct {
cli/azd/extensions/azure.ai.training/pkg/models/job.go:27
- [azd-code-reviewer] Removing
GPUCounthere dropsgpuCountwhileGetJobdecodes older responses. JSON mode then re-marshals this typed model without fetching run history (job_show.go:83-92), so its documented backward-compatible “raw job response” silently loses the legacy field. KeepGPUCounton the read model; its zero value remains omitted from new submit payloads.
CapacityUnitCount int `json:"capacityUnitCount,omitempty"`
Priority string `json:"priority,omitempty"`
cli/azd/extensions/azure.ai.training/internal/utils/yaml_parser.go:33
- [azd-code-reviewer] The generated template documents constrained values for both new fields, but offline validation currently accepts any integer/string and also allows
capacity_unit_counttogether withinstance_count, despite describing them as alternatives. Invalid values therefore passjob validateand fail only at submission. Add validator rules and table-driven tests for the capacity-unit set, the priority enum, and mutually exclusive sizing options.
CapacityUnitCount int `yaml:"capacity_unit_count"`
Priority string `yaml:"priority"`
cli/azd/extensions/azure.ai.training/internal/cmd/job_show.go:488
- [azd-code-reviewer] These top-level Get Job fields are still inside the
History.Compute != nilbranch. If supplementary run-history retrieval fails or returns no compute object,CapacityUnitCountandPriorityare available ond.Jobbut disappear from table output. Read history into an optional fallback, then render the top-level values independently.
// Capacity Units: prefer the top-level CapacityUnitCount from Get Job,
// then whatever run history reports, then the SKU-level GPU count.
if d.Job.Properties.CapacityUnitCount > 0 {
fmt.Fprintf(w, "Capacity Units:\t%d\n", d.Job.Properties.CapacityUnitCount)
} else if c.CapacityUnitCount > 0 {
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.
Aligns the training extension with Foundry's new job submission shape:
YAML: add top-level capacity_unit_count and priority; drop gpu_count and trim resources block to instance_count only. The service now infers the SKU from the compute cluster; users express partial-SKU allocation via capacity_unit_count.
Wire: CommandJob gains top-level capacityUnitCount and priority; ResourceConfig trimmed to instanceCount (instance_type, shm_size, docker_args, properties/AISuperComputer removed from the write path).
Read/show: RunHistoryCompute keeps GPUCount, InstanceType and legacy Priority so 'job show' still displays useful info for older jobs; new jobs prefer the top-level CapacityUnitCount and Priority from Get Job, falling back to run history otherwise.
Template: 'azd ai training init' scaffolds the new shape with capacity_unit_count and priority as commented-out optional fields.