Skip to content

Commit f51151a

Browse files
authored
fix: Rename /regions/ path to /locations/ in client (#13)
2 parents d3cca9d + 8d7e4c8 commit f51151a

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
build/
2-
dist/
3-
.idea
41
*.egg-info/
52
*~
3+
.*.sw[nop]
4+
.idea
65
__pycache__
6+
build/
7+
dist/

google/cloud/dataproc_spark_connect/session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,13 @@ def __create(self) -> "SparkSession":
196196
session_id = self.generate_dataproc_session_id()
197197

198198
session_request.session_id = session_id
199-
dataproc_config.name = f"projects/{self._project_id}/regions/{self._region}/sessions/{session_id}"
199+
dataproc_config.name = f"projects/{self._project_id}/locations/{self._region}/sessions/{session_id}"
200200
logger.debug(
201201
f"Configurations used to create serverless session:\n {dataproc_config}"
202202
)
203203
session_request.session = dataproc_config
204204
session_request.parent = (
205-
f"projects/{self._project_id}/regions/{self._region}"
205+
f"projects/{self._project_id}/locations/{self._region}"
206206
)
207207

208208
logger.debug("Creating serverless session")

tests/unit/test_session.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,9 @@ def test_create_spark_session_with_default_notebook_behavior(
9292
create_session_request = CreateSessionRequest.wrap(
9393
text_format.Parse(
9494
"""
95-
parent: "projects/test-project/regions/test-region"
95+
parent: "projects/test-project/locations/test-region"
9696
session {
97-
name: "projects/test-project/regions/test-region/sessions/sc-20240702-103952-abcdef"
97+
name: "projects/test-project/locations/test-region/sessions/sc-20240702-103952-abcdef"
9898
runtime_config {
9999
version: "_DEFAULT_RUNTIME_VERSION_"
100100
}
@@ -183,9 +183,9 @@ def test_create_session_with_user_provided_dataproc_config(
183183
create_session_request = CreateSessionRequest.wrap(
184184
text_format.Parse(
185185
"""
186-
parent: "projects/test-project/regions/test-region"
186+
parent: "projects/test-project/locations/test-region"
187187
session {
188-
name: "projects/test-project/regions/test-region/sessions/sc-20240702-103952-abcdef"
188+
name: "projects/test-project/locations/test-region/sessions/sc-20240702-103952-abcdef"
189189
runtime_config {
190190
version: "_DEFAULT_RUNTIME_VERSION_"
191191
properties: {
@@ -306,9 +306,9 @@ def test_create_session_with_session_template(
306306
create_session_request = CreateSessionRequest.wrap(
307307
text_format.Parse(
308308
"""
309-
parent: "projects/test-project/regions/test-region"
309+
parent: "projects/test-project/locations/test-region"
310310
session {
311-
name: "projects/test-project/regions/test-region/sessions/sc-20240702-103952-abcdef"
311+
name: "projects/test-project/locations/test-region/sessions/sc-20240702-103952-abcdef"
312312
runtime_config {
313313
version: "_DEFAULT_RUNTIME_VERSION_"
314314
}
@@ -407,9 +407,9 @@ def test_create_session_with_user_provided_dataproc_config_and_session_template(
407407
create_session_request = CreateSessionRequest.wrap(
408408
text_format.Parse(
409409
"""
410-
parent: "projects/test-project/regions/test-region"
410+
parent: "projects/test-project/locations/test-region"
411411
session {
412-
name: "projects/test-project/regions/test-region/sessions/sc-20240702-103952-abcdef"
412+
name: "projects/test-project/locations/test-region/sessions/sc-20240702-103952-abcdef"
413413
runtime_config {
414414
version: "_DEFAULT_RUNTIME_VERSION_"
415415
}

0 commit comments

Comments
 (0)