From 523a3fccec90c8430b5cb1c3f9a5ee7ff94ee65b Mon Sep 17 00:00:00 2001 From: Jan Rose Date: Wed, 7 Oct 2026 10:02:44 +0200 Subject: [PATCH] PyDABs: Drop sql.SpotInstancePolicy from description override --- python/codegen/codegen/jsonschema_patch.py | 60 ++----------------- python/codegen/codegen/main.py | 1 - .../_models/spot_instance_policy.py | 23 +++---- 3 files changed, 14 insertions(+), 70 deletions(-) diff --git a/python/codegen/codegen/jsonschema_patch.py b/python/codegen/codegen/jsonschema_patch.py index f394695340e..052995c51b5 100644 --- a/python/codegen/codegen/jsonschema_patch.py +++ b/python/codegen/codegen/jsonschema_patch.py @@ -18,41 +18,12 @@ "jobs.SparkJarTask": ["main_class_name"], } -# Burn-down list of upstream API descriptions that aren't valid reStructuredText -# and break the Sphinx docs build. Each entry is a temporary override until the -# proto comment is fixed upstream; remove it once the fix lands (the no-op guard -# in override_descriptions flags entries that upstream has already fixed). -# -# sql.SpotInstancePolicy: the upstream comment is a hard-wrapped ASCII grid table -# that docutils rejects as malformed. Rewritten as a list-table. -# See sqlgateway/scheduler/api/proto/endpoint_common.proto. -DESCRIPTIONS: dict[str, str] = { - "sql.SpotInstancePolicy": ( - "EndpointSpotInstancePolicy configures whether the endpoint should use spot instances.\n" - "\n" - "The breakdown of how the EndpointSpotInstancePolicy converts to per cloud configurations is:\n" - "\n" - ".. list-table::\n" - " :header-rows: 1\n" - "\n" - " * - Cloud\n" - " - COST_OPTIMIZED\n" - " - RELIABILITY_OPTIMIZED\n" - " * - AWS\n" - " - On Demand Driver with Spot Executors\n" - " - On Demand Driver and Executors\n" - " * - AZURE\n" - " - On Demand Driver and Executors\n" - " - On Demand Driver and Executors\n" - ), -} - -# Field-level counterpart to DESCRIPTIONS. Some upstream property descriptions -# aren't valid reStructuredText and break the Sphinx docs build. We can't render -# them and don't want to maintain a hand-copied RST version, so drop the -# description entirely until the proto comment is fixed upstream. Keyed by schema -# name, then the field names whose descriptions to drop. drop_field_descriptions -# flags entries that upstream has already fixed (the description is now empty). +# Burn-down list of upstream property descriptions that aren't valid +# reStructuredText and break the Sphinx docs build. We can't render them and don't +# want to maintain a hand-copied RST version, so drop the description entirely +# until the proto comment is fixed upstream. Keyed by schema name, then the field +# names whose descriptions to drop. drop_field_descriptions flags entries that +# upstream has already fixed (the description is now empty). # # jobs.DeploymentSpec.command_path: embeds a Markdown ```bash code fence, which # docutils parses as an unterminated inline literal. @@ -86,25 +57,6 @@ def add_extra_required_fields(schemas: dict[str, Schema]): return output -def override_descriptions(schemas: dict[str, Schema]): - if missing := DESCRIPTIONS.keys() - schemas.keys(): - raise ValueError(f"Cannot override description for unknown schemas: {missing}") - - output = {} - for name, schema in schemas.items(): - if override := DESCRIPTIONS.get(name): - if schema.description == override: - raise ValueError( - f"Description override for {name} is a no-op; the upstream " - "description was fixed, so remove the override" - ) - output[name] = replace(schema, description=override) - else: - output[name] = schema - - return output - - def drop_field_descriptions(schemas: dict[str, Schema]): if missing := DROP_FIELD_DESCRIPTIONS.keys() - schemas.keys(): raise ValueError( diff --git a/python/codegen/codegen/main.py b/python/codegen/codegen/main.py index a0396994101..83735b8dc4c 100644 --- a/python/codegen/codegen/main.py +++ b/python/codegen/codegen/main.py @@ -25,7 +25,6 @@ def main(output: str): schemas = openapi.get_schemas() schemas = openapi_patch.add_extra_required_fields(schemas) schemas = openapi_patch.remove_unsupported_fields(schemas) - schemas = openapi_patch.override_descriptions(schemas) schemas = openapi_patch.drop_field_descriptions(schemas) schemas = _transitively_mark_deprecated_and_private( diff --git a/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py b/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py index 232731b57ff..e0d5105a95f 100644 --- a/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py +++ b/python/databricks/bundles/sql_warehouses/_models/spot_instance_policy.py @@ -6,23 +6,16 @@ class SpotInstancePolicy(Enum): """ - EndpointSpotInstancePolicy configures whether the endpoint should use spot instances. + EndpointSpotInstancePolicy configures whether the endpoint should use spot + instances. - The breakdown of how the EndpointSpotInstancePolicy converts to per cloud configurations is: - - .. list-table:: - :header-rows: 1 - - * - Cloud - - COST_OPTIMIZED - - RELIABILITY_OPTIMIZED - * - AWS - - On Demand Driver with Spot Executors - - On Demand Driver and Executors - * - AZURE - - On Demand Driver and Executors - - On Demand Driver and Executors + The breakdown of how the EndpointSpotInstancePolicy converts to per cloud + configurations is: + - AWS, COST_OPTIMIZED: On Demand Driver with Spot Executors. + - AWS, RELIABILITY_OPTIMIZED: On Demand Driver and Executors. + - AZURE, COST_OPTIMIZED: On Demand Driver and Executors. + - AZURE, RELIABILITY_OPTIMIZED: On Demand Driver and Executors. """ POLICY_UNSPECIFIED = "POLICY_UNSPECIFIED"