Skip to content

Commit 2aac942

Browse files
authored
[air] Remove yaml dependencies requirement when environment.version is specified (#6718)
## Changes - Allow `environment.version` without requiring `environment.dependencies`. - Cover omitted, empty, and non-empty dependency lists and submission payload behavior. - Update the environment version help text. ## Why `environment.version` is submitted independently from dependencies. Requiring `dependencies: []` adds no-op YAML because omitted and empty dependencies produce the same payload. ## Tests - Focused AIR config and payload unit tests. - AIR config-help and submit acceptance tests. - Live AIR version 5 workload without dependencies completed successfully. _This PR was written with Codex._ Co-authored-by: Caroline Chen <324939130+caroline-db@users.noreply.github.com>
1 parent 76603c3 commit 2aac942

8 files changed

Lines changed: 26 additions & 17 deletions

File tree

‎acceptance/experimental/air/config-help/output.txt‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,13 @@ config.environment.dependencies
9999
Type: list of strings
100100
Required: no
101101

102+
>>> [CLI] experimental air run -h config.environment.version
103+
config.environment.version
104+
Client image version to pin.
105+
106+
Type: string or int
107+
Required: no
108+
102109
=== leaf field
103110
>>> [CLI] experimental air run -h config.compute.accelerator_type
104111
config.compute.accelerator_type

‎acceptance/experimental/air/config-help/script‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ trace $CLI experimental air run -h config.mlflow_artifact_location
1717
trace $CLI experimental air run -h config.compute.pool_id
1818
trace $CLI experimental air run -h config.compute.priority_class
1919
trace $CLI experimental air run -h config.environment.dependencies
20+
trace $CLI experimental air run -h config.environment.version
2021

2122
title "leaf field"
2223
trace $CLI experimental air run -h config.compute.accelerator_type

‎acceptance/experimental/air/run-submit-databricks-ai/output.txt‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
=== submit with a Databricks AI environment
2+
=== submit with a Databricks AI environment and no dependencies
33
>>> [CLI] experimental air run -f run.yaml
44
Submitting experiment: databricks-ai-v5-smoke
55
Submitted workload with Job Run ID: 555
@@ -9,7 +9,7 @@ Tip: use --watch when submitting a run to stream logs to your terminal.
99
Stream logs after submission using:
1010
databricks experimental air logs 555
1111

12-
=== submit accepts a Databricks AI environment version
12+
=== submit includes the Databricks AI environment version and omits dependencies
1313
>>> print_requests.py //api/2.2/jobs/runs/submit
1414
{
1515
"method": "POST",
@@ -19,10 +19,7 @@ Stream logs after submission using:
1919
{
2020
"environment_key": "default",
2121
"spec": {
22-
"base_environment": "workspace-base-environments/databricks_ai_v5",
23-
"dependencies": [
24-
"accelerate"
25-
]
22+
"base_environment": "workspace-base-environments/databricks_ai_v5"
2623
}
2724
}
2825
],

‎acceptance/experimental/air/run-submit-databricks-ai/run.yaml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,3 @@ compute:
55
num_accelerators: 1
66
environment:
77
version: databricks_ai_v5
8-
dependencies:
9-
- accelerate
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
title "submit with a Databricks AI environment"
1+
title "submit with a Databricks AI environment and no dependencies"
22
trace $CLI experimental air run -f run.yaml
33

4-
title "submit accepts a Databricks AI environment version"
4+
title "submit includes the Databricks AI environment version and omits dependencies"
55
trace print_requests.py //api/2.2/jobs/runs/submit

‎experimental/air/cmd/runconfig.go‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ func validateSecretRefs(secrets map[string]string) error {
253253
// settings.
254254
type environmentConfig struct {
255255
Dependencies dependencies `yaml:"dependencies" help:"Inline list of packages to install. Not allowed alongside unity_catalog_image."`
256-
Version stringOrInt `yaml:"version" help:"Client image version to pin. Only valid alongside inline dependencies."`
256+
Version stringOrInt `yaml:"version" help:"Client image version to pin."`
257257
UnityCatalogImage string `yaml:"unity_catalog_image" help:"Unity Catalog custom image to run the workload on, as <catalog>.<schema>.<image>:<tag>. Not allowed alongside dependencies or version."`
258258
}
259259

@@ -279,11 +279,6 @@ func (e *environmentConfig) validate() error {
279279
return nil
280280
}
281281

282-
// version pins the client image version, which is only meaningful alongside an
283-
// inline dependency set.
284-
if e.Version.set && !e.Dependencies.set {
285-
return errors.New("'environment.version' requires inline 'dependencies' (a list of packages)")
286-
}
287282
if e.Version.set {
288283
version, err := validateRuntimeVersion(e.Version.raw, "environment.version")
289284
if err != nil {

‎experimental/air/cmd/runconfig_test.go‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,15 @@ func TestEnvironmentConfigValidate(t *testing.T) {
332332
{
333333
"version without deps",
334334
environmentConfig{Version: stringOrInt{set: true, raw: "5"}},
335-
"requires inline 'dependencies'",
335+
"",
336+
},
337+
{
338+
"version with empty deps",
339+
environmentConfig{
340+
Version: stringOrInt{set: true, raw: "5"},
341+
Dependencies: dependencies{set: true, list: []string{}},
342+
},
343+
"",
336344
},
337345
{
338346
"version with inline deps ok",

‎experimental/air/cmd/runsubmit_test.go‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ func TestBuildSubmitPayload(t *testing.T) {
6565
assert.Equal(t, aiRuntimeEnvironmentKey, p.Environments[0].EnvironmentKey)
6666
require.NotNil(t, p.Environments[0].Spec)
6767
assert.Equal(t, "5", p.Environments[0].Spec.EnvironmentVersion)
68+
environmentJSON, err := json.Marshal(p.Environments[0].Spec)
69+
require.NoError(t, err)
70+
assert.JSONEq(t, `{"environment_version":"5"}`, string(environmentJSON))
6871

6972
require.Len(t, p.Tasks, 1)
7073
task := p.Tasks[0]

0 commit comments

Comments
 (0)