You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "alexott (via GitHub)" <gi...@apache.org> on 2023/09/24 17:22:33 UTC

[GitHub] [airflow] alexott commented on a diff in pull request #34071: Databricks ClusteState & Clsuter GET API

alexott commented on code in PR #34071:
URL: https://github.com/apache/airflow/pull/34071#discussion_r1335168533


##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -312,7 +363,7 @@ def get_run_page_url(self, run_id: int) -> str:
         response = self._do_api_call(GET_RUN_ENDPOINT, json)
         return response["run_page_url"]
 
-    async def a_get_run_page_url(self, run_id: int) -> str:
+    async def async_get_run_page_url(self, run_id: int) -> str:

Review Comment:
   this & other similar changes could be considered as breaking. There is quite heavy direct use of the hook. I suggest that we rename, but leave functions with original names calling the new names, but adding deprecation warnings to them.



##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -490,6 +567,41 @@ def start_cluster(self, json: dict) -> None:
         """
         self._do_api_call(START_CLUSTER_ENDPOINT, json)
 
+    def activate_cluster(self, json: dict, polling: int, timeout: int | None = None) -> None:

Review Comment:
   Maybe call it `start_cluster_and_wait` ?



##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -490,6 +567,41 @@ def start_cluster(self, json: dict) -> None:
         """
         self._do_api_call(START_CLUSTER_ENDPOINT, json)
 
+    def activate_cluster(self, json: dict, polling: int, timeout: int | None = None) -> None:
+        """
+        Start the cluster, and wait for it to be ready.
+
+        :param json: json dictionary containing cluster specification.
+        :param polling: polling interval in seconds.
+        :param timeout: timeout in seconds.
+        """
+        cluster_id = json["cluster_id"]
+
+        api_called = False
+        time_start = time.time()
+
+        while True:

Review Comment:
   I would prefer to have one method only, with default to return immediately, but allow to wait until start/rester when specifying options.



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org