Seokyun-Ha commented on code in PR #34071:
URL: https://github.com/apache/airflow/pull/34071#discussion_r1316772936
##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -388,6 +437,32 @@ def repair_run(self, json: dict) -> None:
"""
self._do_api_call(REPAIR_RUN_ENDPOINT, json)
+ def get_cluster_state(self, cluster_id: str) -> ClusterState:
+ """
+ Retrieves run state of the cluster.
+
+ :param cluster_id: id of the cluster
+ :return: state of the cluster
+ """
+ json = {"cluster_id": cluster_id}
+ response = self._do_api_call(GET_CLUSTER_ENDPOINT, json)
+ state = response["state"]
+ state_message = response["state_message"]
+ return ClusterState(state, state_message)
+
+ async def a_get_cluster_state(self, cluster_id: str) -> ClusterState:
+ """
+ Async version of `get_cluster_state`.
+
+ :param cluster_id: id of the cluster
+ :return: state of the cluster
+ """
+ json = {"cluster_id": cluster_id}
+ response = await self._a_do_api_call(GET_CLUSTER_ENDPOINT, json)
+ state = response["state"]
+ state_message = response["state_message"]
+ return ClusterState(state, state_message)
Review Comment:
Same as above thread 🙏
##########
airflow/providers/databricks/hooks/databricks.py:
##########
@@ -388,6 +437,32 @@ def repair_run(self, json: dict) -> None:
"""
self._do_api_call(REPAIR_RUN_ENDPOINT, json)
+ def get_cluster_state(self, cluster_id: str) -> ClusterState:
+ """
+ Retrieves run state of the cluster.
+
+ :param cluster_id: id of the cluster
+ :return: state of the cluster
+ """
+ json = {"cluster_id": cluster_id}
+ response = self._do_api_call(GET_CLUSTER_ENDPOINT, json)
+ state = response["state"]
+ state_message = response["state_message"]
+ return ClusterState(state, state_message)
+
+ async def a_get_cluster_state(self, cluster_id: str) -> ClusterState:
+ """
+ Async version of `get_cluster_state`.
+
+ :param cluster_id: id of the cluster
+ :return: state of the cluster
+ """
+ json = {"cluster_id": cluster_id}
+ response = await self._a_do_api_call(GET_CLUSTER_ENDPOINT, json)
+ state = response["state"]
+ state_message = response["state_message"]
+ return ClusterState(state, state_message)
Review Comment:
Same as above thread 🙏
--
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]