Skip to content

Commit c72c1ef

Browse files
calvingilescopybara-github
authored andcommitted
fix: Made Endpoint.raw_predict thread-safe by setting authorized_session last
Fixes: #2068 Closes: #3385 COPYBARA_INTEGRATE_REVIEW=#3385 from calvingiles:make_raw_predict_threadsafe fa2c719 PiperOrigin-RevId: 616187206
1 parent ab5fd4d commit c72c1ef

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

google/cloud/aiplatform/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1687,10 +1687,10 @@ def raw_predict(
16871687
"""
16881688
if not self.authorized_session:
16891689
self.credentials._scopes = constants.base.DEFAULT_AUTHED_SCOPES
1690+
self.raw_predict_request_url = f"https://{self.location}-{constants.base.API_BASE_PATH}/v1/projects/{self.project}/locations/{self.location}/endpoints/{self.name}:rawPredict"
16901691
self.authorized_session = google_auth_requests.AuthorizedSession(
16911692
self.credentials
16921693
)
1693-
self.raw_predict_request_url = f"https://{self.location}-{constants.base.API_BASE_PATH}/v1/projects/{self.project}/locations/{self.location}/endpoints/{self.name}:rawPredict"
16941694

16951695
return self.authorized_session.post(
16961696
url=self.raw_predict_request_url, data=body, headers=headers

0 commit comments

Comments
 (0)