Skip to content

Commit ee1b500

Browse files
authored
[Python] Fix missing compute.Kind (#3717)
## Changes Fix missing `compute.Kind`. There is a single documented value that applies a behaviour different from the absent value. Add an enum annotation because it's missing in the OpenAPI spec. ## Why Fixes #3622 ## Tests Looking at the diff for the generated code
1 parent bbd7650 commit ee1b500

File tree

7 files changed

+34
-9
lines changed

7 files changed

+34
-9
lines changed

bundle/internal/schema/annotations_openapi_overrides.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,11 @@ github.com/databricks/databricks-sdk-go/service/compute.InitScriptInfo:
803803
"abfss":
804804
"description": |-
805805
Contains the Azure Data Lake Storage destination path
806+
github.com/databricks/databricks-sdk-go/service/compute.Kind:
807+
"_":
808+
"enum":
809+
- |-
810+
CLASSIC_PREVIEW
806811
github.com/databricks/databricks-sdk-go/service/compute.LogAnalyticsInfo:
807812
"log_analytics_primary_key":
808813
"description": |-

bundle/schema/jsonschema.json

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

experimental/python/codegen/codegen/jsonschema_patch.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@
33
from codegen.jsonschema import Schema
44

55
REMOVED_FIELDS = {
6-
"compute.ClusterSpec": {
7-
# doesn't work, openapi schema needs to be updated to be enum
8-
"kind",
9-
},
106
# fields that were deprecated a long time ago
117
"resources.Pipeline": {
128
# 'trigger' is deprecated, use 'continuous' or schedule pipeline refresh using job instead

experimental/python/codegen/codegen/packages.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,6 @@ def is_resource(ref: str) -> bool:
5757
def should_load_ref(ref: str) -> bool:
5858
name = ref.split("/")[-1]
5959

60-
# FIXME doesn't work, looks like enum, but doesn't have any values specified
61-
if name == "compute.Kind":
62-
return False
63-
6460
for namespace in LOADED_NAMESPACES:
6561
if name.startswith(f"{namespace}."):
6662
return True

experimental/python/databricks/bundles/jobs/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@
131131
"JobsHealthRules",
132132
"JobsHealthRulesDict",
133133
"JobsHealthRulesParam",
134+
"Kind",
135+
"KindParam",
134136
"Library",
135137
"LibraryDict",
136138
"LibraryParam",
@@ -484,6 +486,7 @@
484486
JobsHealthRulesDict,
485487
JobsHealthRulesParam,
486488
)
489+
from databricks.bundles.jobs._models.kind import Kind, KindParam
487490
from databricks.bundles.jobs._models.library import Library, LibraryDict, LibraryParam
488491
from databricks.bundles.jobs._models.lifecycle import (
489492
Lifecycle,

experimental/python/databricks/bundles/jobs/_models/cluster_spec.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
InitScriptInfo,
3838
InitScriptInfoParam,
3939
)
40+
from databricks.bundles.jobs._models.kind import Kind, KindParam
4041
from databricks.bundles.jobs._models.runtime_engine import (
4142
RuntimeEngine,
4243
RuntimeEngineParam,
@@ -171,6 +172,8 @@ class ClusterSpec:
171172
When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers`
172173
"""
173174

175+
kind: VariableOrOptional[Kind] = None
176+
174177
node_type_id: VariableOrOptional[str] = None
175178
"""
176179
This field encodes, through a single value, the resources available to each of
@@ -384,6 +387,8 @@ class ClusterSpecDict(TypedDict, total=False):
384387
When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers`
385388
"""
386389

390+
kind: VariableOrOptional[KindParam]
391+
387392
node_type_id: VariableOrOptional[str]
388393
"""
389394
This field encodes, through a single value, the resources available to each of
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from enum import Enum
2+
from typing import Literal
3+
4+
5+
class Kind(Enum):
6+
CLASSIC_PREVIEW = "CLASSIC_PREVIEW"
7+
8+
9+
KindParam = Literal["CLASSIC_PREVIEW"] | Kind

0 commit comments

Comments
 (0)