Skip to content

Commit

Permalink
🦉 Updates from OwlBot post-processor
Browse files Browse the repository at this point in the history
  • Loading branch information
gcf-owl-bot[bot] committed Jun 17, 2023
1 parent 222f6ea commit 75bf15d
Show file tree
Hide file tree
Showing 1,639 changed files with 822 additions and 674,626 deletions.
6 changes: 6 additions & 0 deletions google/cloud/aiplatform_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,9 @@
from .types.model_service import ListModelVersionsRequest
from .types.model_service import ListModelVersionsResponse
from .types.model_service import MergeVersionAliasesRequest
from .types.model_service import UpdateExplanationDatasetOperationMetadata
from .types.model_service import UpdateExplanationDatasetRequest
from .types.model_service import UpdateExplanationDatasetResponse
from .types.model_service import UpdateModelRequest
from .types.model_service import UploadModelOperationMetadata
from .types.model_service import UploadModelRequest
Expand Down Expand Up @@ -1068,6 +1071,9 @@
"UpdateEndpointRequest",
"UpdateEntityTypeRequest",
"UpdateExecutionRequest",
"UpdateExplanationDatasetOperationMetadata",
"UpdateExplanationDatasetRequest",
"UpdateExplanationDatasetResponse",
"UpdateFeatureRequest",
"UpdateFeaturestoreOperationMetadata",
"UpdateFeaturestoreRequest",
Expand Down
10 changes: 10 additions & 0 deletions google/cloud/aiplatform_v1/gapic_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,11 @@
"merge_version_aliases"
]
},
"UpdateExplanationDataset": {
"methods": [
"update_explanation_dataset"
]
},
"UpdateModel": {
"methods": [
"update_model"
Expand Down Expand Up @@ -1639,6 +1644,11 @@
"merge_version_aliases"
]
},
"UpdateExplanationDataset": {
"methods": [
"update_explanation_dataset"
]
},
"UpdateModel": {
"methods": [
"update_model"
Expand Down
18 changes: 9 additions & 9 deletions google/cloud/aiplatform_v1/services/migration_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,18 @@ def parse_annotated_dataset_path(path: str) -> Dict[str, str]:
@staticmethod
def dataset_path(
project: str,
location: str,
dataset: str,
) -> str:
"""Returns a fully-qualified dataset string."""
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
return "projects/{project}/datasets/{dataset}".format(
project=project,
location=location,
dataset=dataset,
)

@staticmethod
def parse_dataset_path(path: str) -> Dict[str, str]:
"""Parses a dataset path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
path,
)
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
return m.groupdict() if m else {}

@staticmethod
Expand Down Expand Up @@ -252,18 +247,23 @@ def parse_dataset_path(path: str) -> Dict[str, str]:
@staticmethod
def dataset_path(
project: str,
location: str,
dataset: str,
) -> str:
"""Returns a fully-qualified dataset string."""
return "projects/{project}/datasets/{dataset}".format(
return "projects/{project}/locations/{location}/datasets/{dataset}".format(
project=project,
location=location,
dataset=dataset,
)

@staticmethod
def parse_dataset_path(path: str) -> Dict[str, str]:
"""Parses a dataset path into its component segments."""
m = re.match(r"^projects/(?P<project>.+?)/datasets/(?P<dataset>.+?)$", path)
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/datasets/(?P<dataset>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
Expand Down
121 changes: 121 additions & 0 deletions google/cloud/aiplatform_v1/services/model_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,127 @@ async def sample_update_model():
# Done; return the response.
return response

async def update_explanation_dataset(
self,
request: Optional[
Union[model_service.UpdateExplanationDatasetRequest, dict]
] = None,
*,
model: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> operation_async.AsyncOperation:
r"""Incrementally update the dataset used for an examples
model.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import aiplatform_v1
async def sample_update_explanation_dataset():
# Create a client
client = aiplatform_v1.ModelServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1.UpdateExplanationDatasetRequest(
model="model_value",
)
# Make the request
operation = client.update_explanation_dataset(request=request)
print("Waiting for operation to complete...")
response = (await operation).result()
# Handle the response
print(response)
Args:
request (Optional[Union[google.cloud.aiplatform_v1.types.UpdateExplanationDatasetRequest, dict]]):
The request object. Request message for
[ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1.ModelService.UpdateExplanationDataset].
model (:class:`str`):
Required. The resource name of the Model to update.
Format:
``projects/{project}/locations/{location}/models/{model}``
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation_async.AsyncOperation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.UpdateExplanationDatasetResponse` Response message of
[ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1.ModelService.UpdateExplanationDataset]
operation.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([model])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

request = model_service.UpdateExplanationDatasetRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if model is not None:
request.model = model

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.update_explanation_dataset,
default_timeout=None,
client_info=DEFAULT_CLIENT_INFO,
)

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("model", request.model),)),
)

# Send the request.
response = await rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = operation_async.from_gapic(
response,
self._client._transport.operations_client,
model_service.UpdateExplanationDatasetResponse,
metadata_type=model_service.UpdateExplanationDatasetOperationMetadata,
)

# Done; return the response.
return response

async def delete_model(
self,
request: Optional[Union[model_service.DeleteModelRequest, dict]] = None,
Expand Down
123 changes: 123 additions & 0 deletions google/cloud/aiplatform_v1/services/model_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,129 @@ def sample_update_model():
# Done; return the response.
return response

def update_explanation_dataset(
self,
request: Optional[
Union[model_service.UpdateExplanationDatasetRequest, dict]
] = None,
*,
model: Optional[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: Union[float, object] = gapic_v1.method.DEFAULT,
metadata: Sequence[Tuple[str, str]] = (),
) -> gac_operation.Operation:
r"""Incrementally update the dataset used for an examples
model.
.. code-block:: python
# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in:
# https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import aiplatform_v1
def sample_update_explanation_dataset():
# Create a client
client = aiplatform_v1.ModelServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.UpdateExplanationDatasetRequest(
model="model_value",
)
# Make the request
operation = client.update_explanation_dataset(request=request)
print("Waiting for operation to complete...")
response = operation.result()
# Handle the response
print(response)
Args:
request (Union[google.cloud.aiplatform_v1.types.UpdateExplanationDatasetRequest, dict]):
The request object. Request message for
[ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1.ModelService.UpdateExplanationDataset].
model (str):
Required. The resource name of the Model to update.
Format:
``projects/{project}/locations/{location}/models/{model}``
This corresponds to the ``model`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
retry (google.api_core.retry.Retry): Designation of what errors, if any,
should be retried.
timeout (float): The timeout for this request.
metadata (Sequence[Tuple[str, str]]): Strings which should be
sent along with the request as metadata.
Returns:
google.api_core.operation.Operation:
An object representing a long-running operation.
The result type for the operation will be :class:`google.cloud.aiplatform_v1.types.UpdateExplanationDatasetResponse` Response message of
[ModelService.UpdateExplanationDataset][google.cloud.aiplatform.v1.ModelService.UpdateExplanationDataset]
operation.
"""
# Create or coerce a protobuf request object.
# Quick check: If we got a request object, we should *not* have
# gotten any keyword arguments that map to the request.
has_flattened_params = any([model])
if request is not None and has_flattened_params:
raise ValueError(
"If the `request` argument is set, then none of "
"the individual field arguments should be set."
)

# Minor optimization to avoid making a copy if the user passes
# in a model_service.UpdateExplanationDatasetRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, model_service.UpdateExplanationDatasetRequest):
request = model_service.UpdateExplanationDatasetRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if model is not None:
request.model = model

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = self._transport._wrapped_methods[
self._transport.update_explanation_dataset
]

# Certain fields should be provided within the metadata header;
# add these here.
metadata = tuple(metadata) + (
gapic_v1.routing_header.to_grpc_metadata((("model", request.model),)),
)

# Send the request.
response = rpc(
request,
retry=retry,
timeout=timeout,
metadata=metadata,
)

# Wrap the response in an operation future.
response = gac_operation.from_gapic(
response,
self._transport.operations_client,
model_service.UpdateExplanationDatasetResponse,
metadata_type=model_service.UpdateExplanationDatasetOperationMetadata,
)

# Done; return the response.
return response

def delete_model(
self,
request: Optional[Union[model_service.DeleteModelRequest, dict]] = None,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.update_explanation_dataset: gapic_v1.method.wrap_method(
self.update_explanation_dataset,
default_timeout=None,
client_info=client_info,
),
self.delete_model: gapic_v1.method.wrap_method(
self.delete_model,
default_timeout=None,
Expand Down Expand Up @@ -285,6 +290,15 @@ def update_model(
]:
raise NotImplementedError()

@property
def update_explanation_dataset(
self,
) -> Callable[
[model_service.UpdateExplanationDatasetRequest],
Union[operations_pb2.Operation, Awaitable[operations_pb2.Operation]],
]:
raise NotImplementedError()

@property
def delete_model(
self,
Expand Down
Loading

0 comments on commit 75bf15d

Please sign in to comment.