Skip to content

Commit

Permalink
Add missing request builder
Browse files Browse the repository at this point in the history
  • Loading branch information
dbalabka committed Sep 19, 2024
1 parent 3c5a3f4 commit 46bf4a2
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions dask_cloudprovider/gcp/instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,9 +629,11 @@ def __init__(
"gpu_instance": self.gpu_instance,
"bootstrap": self.bootstrap,
"auto_shutdown": self.auto_shutdown,
"preemptible": preemptible
if preemptible is not None
else self.config.get("preemptible"),
"preemptible": (
preemptible
if preemptible is not None
else self.config.get("preemptible")
),
"instance_labels": instance_labels or self.config.get("instance_labels"),
"service_account": service_account or self.config.get("service_account"),
}
Expand Down Expand Up @@ -662,16 +664,23 @@ def refresh_client(self):
if self.service_account_credentials:
import google.oauth2.service_account # google-auth

credentials = google.oauth2.service_account.Credentials.from_service_account_info(
self.service_account_credentials,
scopes=["https://www.googleapis.com/auth/cloud-platform"],
credentials = (
google.oauth2.service_account.Credentials.from_service_account_info(
self.service_account_credentials,
scopes=["https://www.googleapis.com/auth/cloud-platform"],
)
)
else:
# Obtain Application Default Credentials
credentials, _ = google.auth.default()

# Use the credentials to build a service client
return googleapiclient.discovery.build("compute", "v1", credentials=credentials)
return googleapiclient.discovery.build(
"compute",
"v1",
credentials=credentials,
requestBuilder=build_request(credentials),
)

def instances(self):
try:
Expand Down

0 comments on commit 46bf4a2

Please sign in to comment.