GeezerVison is showing github.com — feat: Add support for V1 and V2 classification models for the V1Beta2… · googleapis/python-aiplatform@1cda4b4
File treeExpand file treeCollapse file tree Open diff view settings services/metadata_service
samples/generated_samples
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: aiplatform-v1beta1-py.tar.gz Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/__init__.py +4Lines changed: 4 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 317 | 317 | from .types.metadata_service import QueryArtifactLineageSubgraphRequest | 318 | 318 | from .types.metadata_service import QueryContextLineageSubgraphRequest | 319 | 319 | from .types.metadata_service import QueryExecutionInputsAndOutputsRequest | | 320 | +from .types.metadata_service import RemoveContextChildrenRequest | | 321 | +from .types.metadata_service import RemoveContextChildrenResponse | 320 | 322 | from .types.metadata_service import UpdateArtifactRequest | 321 | 323 | from .types.metadata_service import UpdateContextRequest | 322 | 324 | from .types.metadata_service import UpdateExecutionRequest | | 898 | 900 | "ReadTensorboardBlobDataResponse", | 899 | 901 | "ReadTensorboardTimeSeriesDataRequest", | 900 | 902 | "ReadTensorboardTimeSeriesDataResponse", | | 903 | + "RemoveContextChildrenRequest", | | 904 | + "RemoveContextChildrenResponse", | 901 | 905 | "RemoveDatapointsRequest", | 902 | 906 | "RemoveDatapointsResponse", | 903 | 907 | "ResourcesConsumed", | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/gapic_metadata.json +10Lines changed: 10 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1078 | 1078 | "query_execution_inputs_and_outputs" | 1079 | 1079 | ] | 1080 | 1080 | }, | | 1081 | + "RemoveContextChildren": { | | 1082 | + "methods": [ | | 1083 | + "remove_context_children" | | 1084 | + ] | | 1085 | + }, | 1081 | 1086 | "UpdateArtifact": { | 1082 | 1087 | "methods": [ | 1083 | 1088 | "update_artifact" | | 1238 | 1243 | "query_execution_inputs_and_outputs" | 1239 | 1244 | ] | 1240 | 1245 | }, | | 1246 | + "RemoveContextChildren": { | | 1247 | + "methods": [ | | 1248 | + "remove_context_children" | | 1249 | + ] | | 1250 | + }, | 1241 | 1251 | "UpdateArtifact": { | 1242 | 1252 | "methods": [ | 1243 | 1253 | "update_artifact" | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/services/metadata_service/async_client.py +116Lines changed: 116 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2392,6 +2392,122 @@ async def sample_add_context_children(): | 2392 | 2392 | # Done; return the response. | 2393 | 2393 | return response | 2394 | 2394 |
| | 2395 | + async def remove_context_children( | | 2396 | + self, | | 2397 | + request: Union[metadata_service.RemoveContextChildrenRequest, dict] = None, | | 2398 | + *, | | 2399 | + context: str = None, | | 2400 | + child_contexts: Sequence[str] = None, | | 2401 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, | | 2402 | + timeout: float = None, | | 2403 | + metadata: Sequence[Tuple[str, str]] = (), | | 2404 | + ) -> metadata_service.RemoveContextChildrenResponse: | | 2405 | + r"""Remove a set of children contexts from a parent | | 2406 | + Context. If any of the child Contexts were NOT added to | | 2407 | + the parent Context, they are simply skipped. | | 2408 | +
| | 2409 | + .. code-block:: python | | 2410 | +
| | 2411 | + # This snippet has been automatically generated and should be regarded as a | | 2412 | + # code template only. | | 2413 | + # It will require modifications to work: | | 2414 | + # - It may require correct/in-range values for request initialization. | | 2415 | + # - It may require specifying regional endpoints when creating the service | | 2416 | + # client as shown in: | | 2417 | + # https://googleapis.dev/python/google-api-core/latest/client_options.html | | 2418 | + from google.cloud import aiplatform_v1 | | 2419 | +
| | 2420 | + async def sample_remove_context_children(): | | 2421 | + # Create a client | | 2422 | + client = aiplatform_v1.MetadataServiceAsyncClient() | | 2423 | +
| | 2424 | + # Initialize request argument(s) | | 2425 | + request = aiplatform_v1.RemoveContextChildrenRequest( | | 2426 | + context="context_value", | | 2427 | + ) | | 2428 | +
| | 2429 | + # Make the request | | 2430 | + response = await client.remove_context_children(request=request) | | 2431 | +
| | 2432 | + # Handle the response | | 2433 | + print(response) | | 2434 | +
| | 2435 | + Args: | | 2436 | + request (Union[google.cloud.aiplatform_v1.types.RemoveContextChildrenRequest, dict]): | | 2437 | + The request object. Request message for | | 2438 | + [MetadataService.DeleteContextChildrenRequest][]. | | 2439 | + context (:class:`str`): | | 2440 | + Required. The resource name of the parent Context. | | 2441 | +
| | 2442 | + Format: | | 2443 | + ``projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`` | | 2444 | +
| | 2445 | + This corresponds to the ``context`` field | | 2446 | + on the ``request`` instance; if ``request`` is provided, this | | 2447 | + should not be set. | | 2448 | + child_contexts (:class:`Sequence[str]`): | | 2449 | + The resource names of the child | | 2450 | + Contexts. | | 2451 | +
| | 2452 | + This corresponds to the ``child_contexts`` field | | 2453 | + on the ``request`` instance; if ``request`` is provided, this | | 2454 | + should not be set. | | 2455 | + retry (google.api_core.retry.Retry): Designation of what errors, if any, | | 2456 | + should be retried. | | 2457 | + timeout (float): The timeout for this request. | | 2458 | + metadata (Sequence[Tuple[str, str]]): Strings which should be | | 2459 | + sent along with the request as metadata. | | 2460 | +
| | 2461 | + Returns: | | 2462 | + google.cloud.aiplatform_v1.types.RemoveContextChildrenResponse: | | 2463 | + Response message for | | 2464 | + [MetadataService.RemoveContextChildren][google.cloud.aiplatform.v1.MetadataService.RemoveContextChildren]. | | 2465 | +
| | 2466 | + """ | | 2467 | + # Create or coerce a protobuf request object. | | 2468 | + # Quick check: If we got a request object, we should *not* have | | 2469 | + # gotten any keyword arguments that map to the request. | | 2470 | + has_flattened_params = any([context, child_contexts]) | | 2471 | + if request is not None and has_flattened_params: | | 2472 | + raise ValueError( | | 2473 | + "If the `request` argument is set, then none of " | | 2474 | + "the individual field arguments should be set." | | 2475 | + ) | | 2476 | + | | 2477 | + request = metadata_service.RemoveContextChildrenRequest(request) | | 2478 | + | | 2479 | + # If we have keyword arguments corresponding to fields on the | | 2480 | + # request, apply these. | | 2481 | + if context is not None: | | 2482 | + request.context = context | | 2483 | + if child_contexts: | | 2484 | + request.child_contexts.extend(child_contexts) | | 2485 | + | | 2486 | + # Wrap the RPC method; this adds retry and timeout information, | | 2487 | + # and friendly error handling. | | 2488 | + rpc = gapic_v1.method_async.wrap_method( | | 2489 | + self._client._transport.remove_context_children, | | 2490 | + default_timeout=None, | | 2491 | + client_info=DEFAULT_CLIENT_INFO, | | 2492 | + ) | | 2493 | + | | 2494 | + # Certain fields should be provided within the metadata header; | | 2495 | + # add these here. | | 2496 | + metadata = tuple(metadata) + ( | | 2497 | + gapic_v1.routing_header.to_grpc_metadata((("context", request.context),)), | | 2498 | + ) | | 2499 | + | | 2500 | + # Send the request. | | 2501 | + response = await rpc( | | 2502 | + request, | | 2503 | + retry=retry, | | 2504 | + timeout=timeout, | | 2505 | + metadata=metadata, | | 2506 | + ) | | 2507 | + | | 2508 | + # Done; return the response. | | 2509 | + return response | | 2510 | + | 2395 | 2511 | async def query_context_lineage_subgraph( | 2396 | 2512 | self, | 2397 | 2513 | request: Union[ | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/services/metadata_service/client.py +116Lines changed: 116 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -2705,6 +2705,122 @@ def sample_add_context_children(): | 2705 | 2705 | # Done; return the response. | 2706 | 2706 | return response | 2707 | 2707 |
| | 2708 | + def remove_context_children( | | 2709 | + self, | | 2710 | + request: Union[metadata_service.RemoveContextChildrenRequest, dict] = None, | | 2711 | + *, | | 2712 | + context: str = None, | | 2713 | + child_contexts: Sequence[str] = None, | | 2714 | + retry: OptionalRetry = gapic_v1.method.DEFAULT, | | 2715 | + timeout: float = None, | | 2716 | + metadata: Sequence[Tuple[str, str]] = (), | | 2717 | + ) -> metadata_service.RemoveContextChildrenResponse: | | 2718 | + r"""Remove a set of children contexts from a parent | | 2719 | + Context. If any of the child Contexts were NOT added to | | 2720 | + the parent Context, they are simply skipped. | | 2721 | +
| | 2722 | + .. code-block:: python | | 2723 | +
| | 2724 | + # This snippet has been automatically generated and should be regarded as a | | 2725 | + # code template only. | | 2726 | + # It will require modifications to work: | | 2727 | + # - It may require correct/in-range values for request initialization. | | 2728 | + # - It may require specifying regional endpoints when creating the service | | 2729 | + # client as shown in: | | 2730 | + # https://googleapis.dev/python/google-api-core/latest/client_options.html | | 2731 | + from google.cloud import aiplatform_v1 | | 2732 | +
| | 2733 | + def sample_remove_context_children(): | | 2734 | + # Create a client | | 2735 | + client = aiplatform_v1.MetadataServiceClient() | | 2736 | +
| | 2737 | + # Initialize request argument(s) | | 2738 | + request = aiplatform_v1.RemoveContextChildrenRequest( | | 2739 | + context="context_value", | | 2740 | + ) | | 2741 | +
| | 2742 | + # Make the request | | 2743 | + response = client.remove_context_children(request=request) | | 2744 | +
| | 2745 | + # Handle the response | | 2746 | + print(response) | | 2747 | +
| | 2748 | + Args: | | 2749 | + request (Union[google.cloud.aiplatform_v1.types.RemoveContextChildrenRequest, dict]): | | 2750 | + The request object. Request message for | | 2751 | + [MetadataService.DeleteContextChildrenRequest][]. | | 2752 | + context (str): | | 2753 | + Required. The resource name of the parent Context. | | 2754 | +
| | 2755 | + Format: | | 2756 | + ``projects/{project}/locations/{location}/metadataStores/{metadatastore}/contexts/{context}`` | | 2757 | +
| | 2758 | + This corresponds to the ``context`` field | | 2759 | + on the ``request`` instance; if ``request`` is provided, this | | 2760 | + should not be set. | | 2761 | + child_contexts (Sequence[str]): | | 2762 | + The resource names of the child | | 2763 | + Contexts. | | 2764 | +
| | 2765 | + This corresponds to the ``child_contexts`` field | | 2766 | + on the ``request`` instance; if ``request`` is provided, this | | 2767 | + should not be set. | | 2768 | + retry (google.api_core.retry.Retry): Designation of what errors, if any, | | 2769 | + should be retried. | | 2770 | + timeout (float): The timeout for this request. | | 2771 | + metadata (Sequence[Tuple[str, str]]): Strings which should be | | 2772 | + sent along with the request as metadata. | | 2773 | +
| | 2774 | + Returns: | | 2775 | + google.cloud.aiplatform_v1.types.RemoveContextChildrenResponse: | | 2776 | + Response message for | | 2777 | + [MetadataService.RemoveContextChildren][google.cloud.aiplatform.v1.MetadataService.RemoveContextChildren]. | | 2778 | +
| | 2779 | + """ | | 2780 | + # Create or coerce a protobuf request object. | | 2781 | + # Quick check: If we got a request object, we should *not* have | | 2782 | + # gotten any keyword arguments that map to the request. | | 2783 | + has_flattened_params = any([context, child_contexts]) | | 2784 | + if request is not None and has_flattened_params: | | 2785 | + raise ValueError( | | 2786 | + "If the `request` argument is set, then none of " | | 2787 | + "the individual field arguments should be set." | | 2788 | + ) | | 2789 | + | | 2790 | + # Minor optimization to avoid making a copy if the user passes | | 2791 | + # in a metadata_service.RemoveContextChildrenRequest. | | 2792 | + # There's no risk of modifying the input as we've already verified | | 2793 | + # there are no flattened fields. | | 2794 | + if not isinstance(request, metadata_service.RemoveContextChildrenRequest): | | 2795 | + request = metadata_service.RemoveContextChildrenRequest(request) | | 2796 | + # If we have keyword arguments corresponding to fields on the | | 2797 | + # request, apply these. | | 2798 | + if context is not None: | | 2799 | + request.context = context | | 2800 | + if child_contexts is not None: | | 2801 | + request.child_contexts = child_contexts | | 2802 | + | | 2803 | + # Wrap the RPC method; this adds retry and timeout information, | | 2804 | + # and friendly error handling. | | 2805 | + rpc = self._transport._wrapped_methods[self._transport.remove_context_children] | | 2806 | + | | 2807 | + # Certain fields should be provided within the metadata header; | | 2808 | + # add these here. | | 2809 | + metadata = tuple(metadata) + ( | | 2810 | + gapic_v1.routing_header.to_grpc_metadata((("context", request.context),)), | | 2811 | + ) | | 2812 | + | | 2813 | + # Send the request. | | 2814 | + response = rpc( | | 2815 | + request, | | 2816 | + retry=retry, | | 2817 | + timeout=timeout, | | 2818 | + metadata=metadata, | | 2819 | + ) | | 2820 | + | | 2821 | + # Done; return the response. | | 2822 | + return response | | 2823 | + | 2708 | 2824 | def query_context_lineage_subgraph( | 2709 | 2825 | self, | 2710 | 2826 | request: Union[ | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/services/metadata_service/transports/base.py +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -233,6 +233,11 @@ def _prep_wrapped_messages(self, client_info): | 233 | 233 | default_timeout=None, | 234 | 234 | client_info=client_info, | 235 | 235 | ), | | 236 | + self.remove_context_children: gapic_v1.method.wrap_method( | | 237 | + self.remove_context_children, | | 238 | + default_timeout=None, | | 239 | + client_info=client_info, | | 240 | + ), | 236 | 241 | self.query_context_lineage_subgraph: gapic_v1.method.wrap_method( | 237 | 242 | self.query_context_lineage_subgraph, | 238 | 243 | default_timeout=None, | @@ -491,6 +496,18 @@ def add_context_children( | 491 | 496 | ]: | 492 | 497 | raise NotImplementedError() | 493 | 498 |
| | 499 | + @property | | 500 | + def remove_context_children( | | 501 | + self, | | 502 | + ) -> Callable[ | | 503 | + [metadata_service.RemoveContextChildrenRequest], | | 504 | + Union[ | | 505 | + metadata_service.RemoveContextChildrenResponse, | | 506 | + Awaitable[metadata_service.RemoveContextChildrenResponse], | | 507 | + ], | | 508 | + ]: | | 509 | + raise NotImplementedError() | | 510 | + | 494 | 511 | @property | 495 | 512 | def query_context_lineage_subgraph( | 496 | 513 | self, | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/services/metadata_service/transports/grpc.py +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -758,6 +758,37 @@ def add_context_children( | 758 | 758 | ) | 759 | 759 | return self._stubs["add_context_children"] | 760 | 760 |
| | 761 | + @property | | 762 | + def remove_context_children( | | 763 | + self, | | 764 | + ) -> Callable[ | | 765 | + [metadata_service.RemoveContextChildrenRequest], | | 766 | + metadata_service.RemoveContextChildrenResponse, | | 767 | + ]: | | 768 | + r"""Return a callable for the remove context children method over gRPC. | | 769 | +
| | 770 | + Remove a set of children contexts from a parent | | 771 | + Context. If any of the child Contexts were NOT added to | | 772 | + the parent Context, they are simply skipped. | | 773 | +
| | 774 | + Returns: | | 775 | + Callable[[~.RemoveContextChildrenRequest], | | 776 | + ~.RemoveContextChildrenResponse]: | | 777 | + A function that, when called, will call the underlying RPC | | 778 | + on the server. | | 779 | + """ | | 780 | + # Generate a "stub function" on-the-fly which will actually make | | 781 | + # the request. | | 782 | + # gRPC handles serialization and deserialization, so we just need | | 783 | + # to pass in the functions for each. | | 784 | + if "remove_context_children" not in self._stubs: | | 785 | + self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( | | 786 | + "/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren", | | 787 | + request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, | | 788 | + response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, | | 789 | + ) | | 790 | + return self._stubs["remove_context_children"] | | 791 | + | 761 | 792 | @property | 762 | 793 | def query_context_lineage_subgraph( | 763 | 794 | self, | |
Collapse file Copy file name to clipboardExpand all lines: google/cloud/aiplatform_v1/services/metadata_service/transports/grpc_asyncio.py +31Lines changed: 31 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -784,6 +784,37 @@ def add_context_children( | 784 | 784 | ) | 785 | 785 | return self._stubs["add_context_children"] | 786 | 786 |
| | 787 | + @property | | 788 | + def remove_context_children( | | 789 | + self, | | 790 | + ) -> Callable[ | | 791 | + [metadata_service.RemoveContextChildrenRequest], | | 792 | + Awaitable[metadata_service.RemoveContextChildrenResponse], | | 793 | + ]: | | 794 | + r"""Return a callable for the remove context children method over gRPC. | | 795 | +
| | 796 | + Remove a set of children contexts from a parent | | 797 | + Context. If any of the child Contexts were NOT added to | | 798 | + the parent Context, they are simply skipped. | | 799 | +
| | 800 | + Returns: | | 801 | + Callable[[~.RemoveContextChildrenRequest], | | 802 | + Awaitable[~.RemoveContextChildrenResponse]]: | | 803 | + A function that, when called, will call the underlying RPC | | 804 | + on the server. | | 805 | + """ | | 806 | + # Generate a "stub function" on-the-fly which will actually make | | 807 | + # the request. | | 808 | + # gRPC handles serialization and deserialization, so we just need | | 809 | + # to pass in the functions for each. | | 810 | + if "remove_context_children" not in self._stubs: | | 811 | + self._stubs["remove_context_children"] = self.grpc_channel.unary_unary( | | 812 | + "/google.cloud.aiplatform.v1.MetadataService/RemoveContextChildren", | | 813 | + request_serializer=metadata_service.RemoveContextChildrenRequest.serialize, | | 814 | + response_deserializer=metadata_service.RemoveContextChildrenResponse.deserialize, | | 815 | + ) | | 816 | + return self._stubs["remove_context_children"] | | 817 | + | 787 | 818 | @property | 788 | 819 | def query_context_lineage_subgraph( | 789 | 820 | self, | |
|