RNHTTR commented on code in PR #52981:
URL: https://github.com/apache/airflow/pull/52981#discussion_r2205211336
##########
providers/google/src/airflow/providers/google/cloud/hooks/dataproc.py:
##########
@@ -1404,7 +1441,6 @@ async def create_cluster(
)
return result
- @GoogleBaseHook.fallback_to_default_project_id
Review Comment:
Why are these being removed? I think this would be a breaking change for
anyone who provides `project_id=None`
##########
providers/google/src/airflow/providers/google/cloud/hooks/dataproc.py:
##########
@@ -1286,55 +1288,90 @@ def __init__(
super().__init__(gcp_conn_id=gcp_conn_id,
impersonation_chain=impersonation_chain, **kwargs)
self._cached_client: JobControllerAsyncClient | None = None
- def get_cluster_client(self, region: str | None = None) ->
ClusterControllerAsyncClient:
+ async def get_cluster_client(self, region: str | None = None) ->
ClusterControllerAsyncClient:
"""Create a ClusterControllerAsyncClient."""
client_options = None
if region and region != "global":
client_options =
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
+ sync_hook = await self.get_sync_hook()
return ClusterControllerAsyncClient(
- credentials=self.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
+ credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
)
- def get_template_client(self, region: str | None = None) ->
WorkflowTemplateServiceAsyncClient:
+ async def get_template_client(self, region: str | None = None) ->
WorkflowTemplateServiceAsyncClient:
"""Create a WorkflowTemplateServiceAsyncClient."""
client_options = None
if region and region != "global":
client_options =
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
+ sync_hook = await self.get_sync_hook()
return WorkflowTemplateServiceAsyncClient(
- credentials=self.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
+ credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
)
- def get_job_client(self, region: str | None = None) ->
JobControllerAsyncClient:
+ async def get_job_client(self, region: str | None = None) ->
JobControllerAsyncClient:
"""Create a JobControllerAsyncClient."""
if self._cached_client is None:
client_options = None
if region and region != "global":
client_options =
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
+ sync_hook = await self.get_sync_hook()
self._cached_client = JobControllerAsyncClient(
- credentials=self.get_credentials(),
+ credentials=sync_hook.get_credentials(),
client_info=CLIENT_INFO,
client_options=client_options,
)
return self._cached_client
- def get_batch_client(self, region: str | None = None) ->
BatchControllerAsyncClient:
+ async def get_batch_client(self, region: str | None = None) ->
BatchControllerAsyncClient:
"""Create a BatchControllerAsyncClient."""
client_options = None
if region and region != "global":
client_options =
ClientOptions(api_endpoint=f"{region}-dataproc.googleapis.com:443")
+ sync_hook = await self.get_sync_hook()
return BatchControllerAsyncClient(
- credentials=self.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
+ credentials=sync_hook.get_credentials(), client_info=CLIENT_INFO,
client_options=client_options
)
- def get_operations_client(self, region: str) -> OperationsClient:
+ async def get_operations_client(self, region: str) -> OperationsClient:
"""Create a OperationsClient."""
- return
self.get_template_client(region=region).transport.operations_client
+ template_client = await self.get_template_client(region=region)
+ return template_client.transport.operations_client
+
+ async def get_cluster(
+ self,
+ region: str,
+ project_id: str,
+ cluster_name: str,
Review Comment:
Is there a reason the parameters are in a different order? Because these are
required parameters, this could be a breaking change for users who don't
specify the parameter name.
--
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]