diff --git a/bundle/internal/schema/annotations_openapi_overrides.yml b/bundle/internal/schema/annotations_openapi_overrides.yml index 35593f2e7f..c2b9b9c23c 100644 --- a/bundle/internal/schema/annotations_openapi_overrides.yml +++ b/bundle/internal/schema/annotations_openapi_overrides.yml @@ -803,6 +803,11 @@ github.com/databricks/databricks-sdk-go/service/compute.InitScriptInfo: "abfss": "description": |- Contains the Azure Data Lake Storage destination path +github.com/databricks/databricks-sdk-go/service/compute.Kind: + "_": + "enum": + - |- + CLASSIC_PREVIEW github.com/databricks/databricks-sdk-go/service/compute.LogAnalyticsInfo: "log_analytics_primary_key": "description": |- diff --git a/bundle/schema/jsonschema.json b/bundle/schema/jsonschema.json index 139b0c6245..eee0d8782a 100644 --- a/bundle/schema/jsonschema.json +++ b/bundle/schema/jsonschema.json @@ -4167,7 +4167,18 @@ ] }, "compute.Kind": { - "type": "string" + "oneOf": [ + { + "type": "string", + "enum": [ + "CLASSIC_PREVIEW" + ] + }, + { + "type": "string", + "pattern": "\\$\\{(var(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\[[0-9]+\\])*)+)\\}" + } + ] }, "compute.Library": { "oneOf": [ diff --git a/experimental/python/codegen/codegen/jsonschema_patch.py b/experimental/python/codegen/codegen/jsonschema_patch.py index 8cfe2981c3..8126739363 100644 --- a/experimental/python/codegen/codegen/jsonschema_patch.py +++ b/experimental/python/codegen/codegen/jsonschema_patch.py @@ -3,10 +3,6 @@ from codegen.jsonschema import Schema REMOVED_FIELDS = { - "compute.ClusterSpec": { - # doesn't work, openapi schema needs to be updated to be enum - "kind", - }, # fields that were deprecated a long time ago "resources.Pipeline": { # 'trigger' is deprecated, use 'continuous' or schedule pipeline refresh using job instead diff --git a/experimental/python/codegen/codegen/packages.py b/experimental/python/codegen/codegen/packages.py index 6762097918..48fe8270ab 100644 --- a/experimental/python/codegen/codegen/packages.py +++ b/experimental/python/codegen/codegen/packages.py @@ -57,10 +57,6 @@ def is_resource(ref: str) -> bool: def should_load_ref(ref: str) -> bool: name = ref.split("/")[-1] - # FIXME doesn't work, looks like enum, but doesn't have any values specified - if name == "compute.Kind": - return False - for namespace in LOADED_NAMESPACES: if name.startswith(f"{namespace}."): return True diff --git a/experimental/python/databricks/bundles/jobs/__init__.py b/experimental/python/databricks/bundles/jobs/__init__.py index 3c3df3a693..860940222a 100644 --- a/experimental/python/databricks/bundles/jobs/__init__.py +++ b/experimental/python/databricks/bundles/jobs/__init__.py @@ -131,6 +131,8 @@ "JobsHealthRules", "JobsHealthRulesDict", "JobsHealthRulesParam", + "Kind", + "KindParam", "Library", "LibraryDict", "LibraryParam", @@ -484,6 +486,7 @@ JobsHealthRulesDict, JobsHealthRulesParam, ) +from databricks.bundles.jobs._models.kind import Kind, KindParam from databricks.bundles.jobs._models.library import Library, LibraryDict, LibraryParam from databricks.bundles.jobs._models.lifecycle import ( Lifecycle, diff --git a/experimental/python/databricks/bundles/jobs/_models/cluster_spec.py b/experimental/python/databricks/bundles/jobs/_models/cluster_spec.py index 32d300a637..e2ecff716a 100644 --- a/experimental/python/databricks/bundles/jobs/_models/cluster_spec.py +++ b/experimental/python/databricks/bundles/jobs/_models/cluster_spec.py @@ -37,6 +37,7 @@ InitScriptInfo, InitScriptInfoParam, ) +from databricks.bundles.jobs._models.kind import Kind, KindParam from databricks.bundles.jobs._models.runtime_engine import ( RuntimeEngine, RuntimeEngineParam, @@ -171,6 +172,8 @@ class ClusterSpec: When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers` """ + kind: VariableOrOptional[Kind] = None + node_type_id: VariableOrOptional[str] = None """ This field encodes, through a single value, the resources available to each of @@ -384,6 +387,8 @@ class ClusterSpecDict(TypedDict, total=False): When set to true, Databricks will automatically set single node related `custom_tags`, `spark_conf`, and `num_workers` """ + kind: VariableOrOptional[KindParam] + node_type_id: VariableOrOptional[str] """ This field encodes, through a single value, the resources available to each of diff --git a/experimental/python/databricks/bundles/jobs/_models/kind.py b/experimental/python/databricks/bundles/jobs/_models/kind.py new file mode 100644 index 0000000000..33a487a90e --- /dev/null +++ b/experimental/python/databricks/bundles/jobs/_models/kind.py @@ -0,0 +1,9 @@ +from enum import Enum +from typing import Literal + + +class Kind(Enum): + CLASSIC_PREVIEW = "CLASSIC_PREVIEW" + + +KindParam = Literal["CLASSIC_PREVIEW"] | Kind