Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions google/cloud/aiplatform/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,6 @@ def init(
# Set api_transport as "rest" if location is "global".
if location == "global" and not api_transport:
self._api_transport = "rest"
elif location == "global" and api_transport == "grpc":
raise ValueError(
"api_transport cannot be 'grpc' when location is 'global'."
)
if experiment_description and experiment is None:
raise ValueError(
"Experiment needs to be set in `init` in order to add experiment"
Expand Down
14 changes: 10 additions & 4 deletions tests/unit/aiplatform/test_initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,10 +306,16 @@ def test_create_client_with_global_location(self):
assert client._transport._host == f"https://{constants.API_BASE_PATH}"

def test_create_client_with_global_location_and_grpc_transport(self):
with pytest.raises(ValueError):
initializer.global_config.init(
project=_TEST_PROJECT, location="global", api_transport="grpc"
)
initializer.global_config.init(
project=_TEST_PROJECT, location="global", api_transport="grpc"
)
client = initializer.global_config.create_client(
client_class=utils.PredictionClientWithOverride
)
assert initializer.global_config.location == "global"
assert initializer.global_config._api_transport == "grpc"
assert isinstance(client, utils.PredictionClientWithOverride)
assert client._transport._host == f"{constants.API_BASE_PATH}:443"

def test_create_client_with_api_key_and_grpc_transport(self):
with pytest.raises(ValueError):
Expand Down
Loading