cruseakshay commented on code in PR #62772:
URL: https://github.com/apache/airflow/pull/62772#discussion_r2899239928


##########
providers/microsoft/azure/src/airflow/providers/microsoft/azure/hooks/container_instance.py:
##########
@@ -170,3 +177,93 @@ def test_connection(self):
             return False, str(e)
 
         return True, "Successfully connected to Azure Container Instance."
+
+
+class AzureContainerInstanceAsyncHook(AzureContainerInstanceHook):
+    """
+    An async hook for communicating with Azure Container Instances.
+
+    :param azure_conn_id: :ref:`Azure connection id<howto/connection:azure>` of
+        a service principal which will be used to start the container instance.
+    """
+
+    def __init__(self, azure_conn_id: str = 
AzureContainerInstanceHook.default_conn_name) -> None:
+        self._async_conn: AsyncContainerInstanceManagementClient | None = None
+        super().__init__(azure_conn_id=azure_conn_id)
+
+    async def __aenter__(self) -> AzureContainerInstanceAsyncHook:
+        return self
+
+    async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> 
None:
+        await self.close()
+
+    async def close(self) -> None:
+        """Close the async connection."""
+        if self._async_conn is not None:
+            await self._async_conn.close()
+            self._async_conn = None

Review Comment:
   Yes, good point.



-- 
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]

Reply via email to