Skip to content

Commit

Permalink
feat: Add support for V1 and V2 classification models for the V1Beta2…
Browse files Browse the repository at this point in the history
… API (#1680)

* feat: add timestamp_outside_retention_rows_count to ImportFeatureValuesResponse and ImportFeatureValuesOperationMetadata in aiplatform v1beta1 featurestore_service.proto
feat: add RemoveContextChildren rpc to aiplatform v1beta1 metadata_service.proto
feat: add order_by to ListArtifactsRequest, ListContextsRequest, and ListExecutionsRequest in aiplatform v1beta1 metadata_service.proto
feat: add InputArtifact to RuntimeConfig in aiplatform v1beta1 pipeline_job.proto
feat: add read_mask to ListPipelineJobsRequest in aiplatform v1beta1 pipeline_service.proto
feat: add TransferLearningConfig in aiplatform v1beta1 study.proto

PiperOrigin-RevId: 475580307

Source-Link: googleapis/googleapis@dbc83bd

Source-Link: googleapis/googleapis-gen@26c1205
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMjZjMTIwNTk0ZDYwNDlkNDAwNjEwMjNjYWUzNDVkYTgwMTgxMDc3YyJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: add timestamp_outside_retention_rows_count to ImportFeatureValuesResponse and ImportFeatureValuesOperationMetadata in aiplatform v1 featurestore_service.proto
feat: add RemoveContextChildren rpc to aiplatform v1 metadata_service.proto
feat: add order_by to ListArtifactsRequest, ListContextsRequest, and ListExecutionsRequest in aiplatform v1 metadata_service.proto

PiperOrigin-RevId: 475580702

Source-Link: googleapis/googleapis@af65a19

Source-Link: googleapis/googleapis-gen@023d431
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDIzZDQzMTU2OWE1M2Y5YjVjZDBkNDdjNmFmODViOGE0NmNlYTVlOCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* feat: Add support for V1 and V2 classification models for the V1Beta2 API

PiperOrigin-RevId: 475604619

Source-Link: googleapis/googleapis@044a15c

Source-Link: googleapis/googleapis-gen@410020a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDEwMDIwYWY5MzRjNzI0OGY3ODA0NzcwZDZmOGVjNDU3MWJmYTU1MSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
gcf-owl-bot[bot] and gcf-owl-bot[bot] authored Sep 20, 2022
1 parent 9a506ee commit 1cda4b4
Show file tree
Hide file tree
Showing 44 changed files with 2,098 additions and 36 deletions.
Empty file added aiplatform-v1beta1-py.tar.gz
Empty file.
4 changes: 4 additions & 0 deletions google/cloud/aiplatform_v1/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@
from .types.metadata_service import QueryArtifactLineageSubgraphRequest
from .types.metadata_service import QueryContextLineageSubgraphRequest
from .types.metadata_service import QueryExecutionInputsAndOutputsRequest
from .types.metadata_service import RemoveContextChildrenRequest
from .types.metadata_service import RemoveContextChildrenResponse
from .types.metadata_service import UpdateArtifactRequest
from .types.metadata_service import UpdateContextRequest
from .types.metadata_service import UpdateExecutionRequest
Expand Down Expand Up @@ -898,6 +900,8 @@
"ReadTensorboardBlobDataResponse",
"ReadTensorboardTimeSeriesDataRequest",
"ReadTensorboardTimeSeriesDataResponse",
"RemoveContextChildrenRequest",
"RemoveContextChildrenResponse",
"RemoveDatapointsRequest",
"RemoveDatapointsResponse",
"ResourcesConsumed",
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 @@ -1078,6 +1078,11 @@
"query_execution_inputs_and_outputs"
]
},
"RemoveContextChildren": {
"methods": [
"remove_context_children"
]
},
"UpdateArtifact": {
"methods": [
"update_artifact"
Expand Down Expand Up @@ -1238,6 +1243,11 @@
"query_execution_inputs_and_outputs"
]
},
"RemoveContextChildren": {
"methods": [
"remove_context_children"
]
},
"UpdateArtifact": {
"methods": [
"update_artifact"
Expand Down
116 changes: 116 additions & 0 deletions google/cloud/aiplatform_v1/services/metadata_service/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,122 @@ async def sample_add_context_children():
# Done; return the response.
return response

async def remove_context_children(
self,
request: Union[metadata_service.RemoveContextChildrenRequest, dict] = None,
*,
context: str = None,
child_contexts: Sequence[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> metadata_service.RemoveContextChildrenResponse:
r"""Remove a set of children contexts from a parent
Context. If any of the child Contexts were NOT added to
the parent Context, they are simply skipped.
.. 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_remove_context_children():
# Create a client
client = aiplatform_v1.MetadataServiceAsyncClient()
# Initialize request argument(s)
request = aiplatform_v1.RemoveContextChildrenRequest(
context="context_value",
)
# Make the request
response = await client.remove_context_children(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.aiplatform_v1.types.RemoveContextChildrenRequest, dict]):
The request object. Request message for
[MetadataService.DeleteContextChildrenRequest][].
context (:class:`str`):
Required. The resource name of the parent Context.
Format:
``projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}``
This corresponds to the ``context`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
child_contexts (:class:`Sequence[str]`):
The resource names of the child
Contexts.
This corresponds to the ``child_contexts`` 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.cloud.aiplatform_v1.types.RemoveContextChildrenResponse:
Response message for
[MetadataService.RemoveContextChildren][google.cloud.aiplatform.v1.MetadataService.RemoveContextChildren].
"""
# 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([context, child_contexts])
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 = metadata_service.RemoveContextChildrenRequest(request)

# If we have keyword arguments corresponding to fields on the
# request, apply these.
if context is not None:
request.context = context
if child_contexts:
request.child_contexts.extend(child_contexts)

# Wrap the RPC method; this adds retry and timeout information,
# and friendly error handling.
rpc = gapic_v1.method_async.wrap_method(
self._client._transport.remove_context_children,
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((("context", request.context),)),
)

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

# Done; return the response.
return response

async def query_context_lineage_subgraph(
self,
request: Union[
Expand Down
116 changes: 116 additions & 0 deletions google/cloud/aiplatform_v1/services/metadata_service/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,122 @@ def sample_add_context_children():
# Done; return the response.
return response

def remove_context_children(
self,
request: Union[metadata_service.RemoveContextChildrenRequest, dict] = None,
*,
context: str = None,
child_contexts: Sequence[str] = None,
retry: OptionalRetry = gapic_v1.method.DEFAULT,
timeout: float = None,
metadata: Sequence[Tuple[str, str]] = (),
) -> metadata_service.RemoveContextChildrenResponse:
r"""Remove a set of children contexts from a parent
Context. If any of the child Contexts were NOT added to
the parent Context, they are simply skipped.
.. 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_remove_context_children():
# Create a client
client = aiplatform_v1.MetadataServiceClient()
# Initialize request argument(s)
request = aiplatform_v1.RemoveContextChildrenRequest(
context="context_value",
)
# Make the request
response = client.remove_context_children(request=request)
# Handle the response
print(response)
Args:
request (Union[google.cloud.aiplatform_v1.types.RemoveContextChildrenRequest, dict]):
The request object. Request message for
[MetadataService.DeleteContextChildrenRequest][].
context (str):
Required. The resource name of the parent Context.
Format:
``projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}``
This corresponds to the ``context`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
child_contexts (Sequence[str]):
The resource names of the child
Contexts.
This corresponds to the ``child_contexts`` 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.cloud.aiplatform_v1.types.RemoveContextChildrenResponse:
Response message for
[MetadataService.RemoveContextChildren][google.cloud.aiplatform.v1.MetadataService.RemoveContextChildren].
"""
# 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([context, child_contexts])
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 metadata_service.RemoveContextChildrenRequest.
# There's no risk of modifying the input as we've already verified
# there are no flattened fields.
if not isinstance(request, metadata_service.RemoveContextChildrenRequest):
request = metadata_service.RemoveContextChildrenRequest(request)
# If we have keyword arguments corresponding to fields on the
# request, apply these.
if context is not None:
request.context = context
if child_contexts is not None:
request.child_contexts = child_contexts

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

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

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

# Done; return the response.
return response

def query_context_lineage_subgraph(
self,
request: Union[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,11 @@ def _prep_wrapped_messages(self, client_info):
default_timeout=None,
client_info=client_info,
),
self.remove_context_children: gapic_v1.method.wrap_method(
self.remove_context_children,
default_timeout=None,
client_info=client_info,
),
self.query_context_lineage_subgraph: gapic_v1.method.wrap_method(
self.query_context_lineage_subgraph,
default_timeout=None,
Expand Down Expand Up @@ -491,6 +496,18 @@ def add_context_children(
]:
raise NotImplementedError()

@property
def remove_context_children(
self,
) -> Callable[
[metadata_service.RemoveContextChildrenRequest],
Union[
metadata_service.RemoveContextChildrenResponse,
Awaitable[metadata_service.RemoveContextChildrenResponse],
],
]:
raise NotImplementedError()

@property
def query_context_lineage_subgraph(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -758,6 +758,37 @@ def add_context_children(
)
return self._stubs["add_context_children"]

@property
def remove_context_children(
self,
) -> Callable[
[metadata_service.RemoveContextChildrenRequest],
metadata_service.RemoveContextChildrenResponse,
]:
r"""Return a callable for the remove context children method over gRPC.
Remove a set of children contexts from a parent
Context. If any of the child Contexts were NOT added to
the parent Context, they are simply skipped.
Returns:
Callable[[~.RemoveContextChildrenRequest],
~.RemoveContextChildrenResponse]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "remove_context_children" not in self._stubs:
self._stubs["remove_context_children"] = self.grpc_channel.unary_unary(
"/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren",
request_serializer=metadata_service.RemoveContextChildrenRequest.serialize,
response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize,
)
return self._stubs["remove_context_children"]

@property
def query_context_lineage_subgraph(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,37 @@ def add_context_children(
)
return self._stubs["add_context_children"]

@property
def remove_context_children(
self,
) -> Callable[
[metadata_service.RemoveContextChildrenRequest],
Awaitable[metadata_service.RemoveContextChildrenResponse],
]:
r"""Return a callable for the remove context children method over gRPC.
Remove a set of children contexts from a parent
Context. If any of the child Contexts were NOT added to
the parent Context, they are simply skipped.
Returns:
Callable[[~.RemoveContextChildrenRequest],
Awaitable[~.RemoveContextChildrenResponse]]:
A function that, when called, will call the underlying RPC
on the server.
"""
# Generate a "stub function" on-the-fly which will actually make
# the request.
# gRPC handles serialization and deserialization, so we just need
# to pass in the functions for each.
if "remove_context_children" not in self._stubs:
self._stubs["remove_context_children"] = self.grpc_channel.unary_unary(
"/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren",
request_serializer=metadata_service.RemoveContextChildrenRequest.serialize,
response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize,
)
return self._stubs["remove_context_children"]

@property
def query_context_lineage_subgraph(
self,
Expand Down
Loading

0 comments on commit 1cda4b4

Please sign in to comment.