shahar1 commented on code in PR #76504: URL: https://github.com/apache/airflow/pull/76504#discussion_r4560154580
########## providers/databricks/docs/operators/warehouse.rst: ########## @@ -17,14 +17,20 @@ .. _howto/operator:DatabricksStartWarehouseOperator: .. _howto/operator:DatabricksStopWarehouseOperator: +.. _howto/operator:DatabricksEditWarehouseOperator: -Databricks SQL warehouse lifecycle operators -============================================ +Databricks SQL warehouse operators +================================= + +Use these operators to start, stop, or edit an existing Databricks SQL warehouse through the +`Databricks SQL Warehouses API <https://docs.databricks.com/api/workspace/warehouses>`_. + +Start and stop a SQL warehouse +----------------------------- Review Comment: minor: Same here, 29 vs 30 characters. ```suggestion ------------------------------ ``` ########## providers/databricks/docs/operators/warehouse.rst: ########## @@ -42,6 +48,34 @@ Repeated task attempts are safe: an already running warehouse is not started aga stopped warehouse is not stopped again. If a start is requested while a warehouse is stopping, any transition rejection from Databricks is propagated to the task. +Edit a SQL warehouse Review Comment: nit: This section now sits between the start/stop overview above and the "Start a SQL warehouse" / "Stop a SQL warehouse" example sections below. Moving it to the end of the page would keep the start/stop material together. (Reviewer observation, not a project rule.) ########## providers/databricks/docs/operators/warehouse.rst: ########## @@ -17,14 +17,20 @@ .. _howto/operator:DatabricksStartWarehouseOperator: .. _howto/operator:DatabricksStopWarehouseOperator: +.. _howto/operator:DatabricksEditWarehouseOperator: -Databricks SQL warehouse lifecycle operators -============================================ +Databricks SQL warehouse operators +================================= Review Comment: minor: This underline is one character shorter than the title (33 vs 34). Sphinx reports "Title underline too short", and the docs build treats warnings as errors. (Reviewer observation; CI has not run yet, so nothing has caught it.) ```suggestion ================================== ``` ########## providers/databricks/src/airflow/providers/databricks/operators/warehouse.py: ########## @@ -207,3 +218,57 @@ def execute(self, context: Context) -> None: if state.state != "STOPPING": self._hook.stop_warehouse(self.warehouse_id) self._wait_or_defer("STOPPED") + + +class DatabricksEditWarehouseOperator(_DatabricksWarehouseBaseOperator): + """ + Update the configuration of an existing Databricks SQL warehouse. + + Return ``None`` when the edit request succeeds, without waiting for configuration changes to finish. + + :param warehouse_id: ID of the Databricks SQL warehouse. (templated) + :param json: Non-empty request body for the SQL Warehouses edit API, for example, + ``{"cluster_size": "Small", "auto_stop_mins": 10}``. Use native template rendering for numeric + or boolean Jinja expressions. (templated) + :param databricks_conn_id: Reference to the Databricks connection. + Defaults to ``databricks_default``. (templated) + :param databricks_retry_limit: Maximum number of attempts, including the initial request. + Must be at least 1. Defaults to 3. + :param databricks_retry_delay: Minimum delay in seconds under the default exponential backoff + strategy. Defaults to 1. + :param databricks_retry_args: Arguments for ``tenacity.Retrying``. A non-empty dictionary overrides + the default retry configuration. Defaults to ``None``. + """ + + template_fields: Sequence[str] = ("databricks_conn_id", "warehouse_id", "json") + template_fields_renderers = {"json": "json"} + + def __init__( Review Comment: nit: This still repeats the base signature and its defaults. `def __init__(self, warehouse_id: str, *, json: dict[str, Any], **kwargs)` with `super().__init__(warehouse_id, **kwargs)` would be enough, as you already did for `_DatabricksWarehouseStateOperator`. (Reviewer observation, not a project rule.) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
