Skip to content

Commit fa28b7f

Browse files
authored
Speed up GCP validate_credentials (#3795)
1 parent 1ad9e5b commit fa28b7f

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • src/dstack/_internal/core/backends/gcp

src/dstack/_internal/core/backends/gcp/auth.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ def get_credentials(creds: AnyGCPCreds) -> Tuple[Credentials, Optional[str]]:
4949

5050
def validate_credentials(credentials: Credentials, project_id: str):
5151
try:
52-
regions_client = compute_v1.RegionsClient(credentials=credentials)
53-
regions_client.list(project=project_id)
52+
client = compute_v1.ProjectsClient(credentials=credentials)
53+
client.get(project=project_id)
5454
except google.api_core.exceptions.NotFound:
5555
raise BackendAuthError(f"project_id {project_id} not found")
5656
except Exception:

0 commit comments

Comments
 (0)