airflow.providers.google.cloud.hooks.vertex_ai.endpoint_service
¶
This module contains a Google Cloud Vertex AI hook.
Module Contents¶
Classes¶
Hook for Google Cloud Vertex AI Endpoint Service APIs. |
- class airflow.providers.google.cloud.hooks.vertex_ai.endpoint_service.EndpointServiceHook(**kwargs)[source]¶
Bases:
airflow.providers.google.common.hooks.base_google.GoogleBaseHook
Hook for Google Cloud Vertex AI Endpoint Service APIs.
- create_endpoint(project_id, region, endpoint, endpoint_id=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
Creates an Endpoint.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (google.cloud.aiplatform_v1.types.Endpoint | dict) – Required. The Endpoint to create.
endpoint_id (str | None) – The ID of Endpoint. This value should be 1-10 characters, and valid characters are /[0-9]/. If not provided, Vertex AI will generate a value for this ID.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- delete_endpoint(project_id, region, endpoint, retry=DEFAULT, timeout=None, metadata=())[source]¶
Deletes an Endpoint.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (str) – Required. The Endpoint to delete.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- deploy_model(project_id, region, endpoint, deployed_model, traffic_split=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
Deploys a Model into this Endpoint, creating a DeployedModel within it.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (str) – Required. The name of the Endpoint resource into which to deploy a Model. Format:
projects/{project}/locations/{location}/endpoints/{endpoint}
deployed_model (google.cloud.aiplatform_v1.types.DeployedModel | dict) – Required. The DeployedModel to be created within the Endpoint. Note that [Endpoint.traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] must be updated for the DeployedModel to start receiving traffic, either as part of this call, or via [EndpointService.UpdateEndpoint][google.cloud.aiplatform.v1.EndpointService.UpdateEndpoint].
traffic_split (Sequence | dict | None) –
A map from a DeployedModel’s ID to the percentage of this Endpoint’s traffic that should be forwarded to that DeployedModel.
If this field is non-empty, then the Endpoint’s [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with it. To refer to the ID of the just being deployed Model, a “0” should be used, and the actual ID of the new DeployedModel will be filled in its place by this method. The traffic percentage values must add up to 100.
If this field is empty, then the Endpoint’s [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] is not updated.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- get_endpoint(project_id, region, endpoint, retry=DEFAULT, timeout=None, metadata=())[source]¶
Gets an Endpoint.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (str) – Required. The Endpoint to get.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- list_endpoints(project_id, region, filter=None, page_size=None, page_token=None, read_mask=None, order_by=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
Lists Endpoints in a Location.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
filter (str | None) – The standard list filter. Supported fields: -
display_name
supports = and !=. -state
supports = and !=. -model_display_name
supports = and != Some examples of using the filter are: -state="JOB_STATE_SUCCEEDED" AND display_name="my_job"
-state="JOB_STATE_RUNNING" OR display_name="my_job"
-NOT display_name="my_job"
-state="JOB_STATE_FAILED"
page_size (int | None) – The standard list page size.
page_token (str | None) – The standard list page token.
read_mask (str | None) – Mask specifying which fields to read.
order_by (str | None) –
A comma-separated list of fields to order by, sorted in ascending order. Use “desc” after a field name for descending. Supported fields:
display_name
create_time
update_time
Example:
display_name, create_time desc
.retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- undeploy_model(project_id, region, endpoint, deployed_model_id, traffic_split=None, retry=DEFAULT, timeout=None, metadata=())[source]¶
Undeploys a Model from an Endpoint, removing a DeployedModel from it, and freeing all used resources.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (str) – Required. The name of the Endpoint resource from which to undeploy a Model.
deployed_model_id (str) – Required. The ID of the DeployedModel to be undeployed from the Endpoint.
traffic_split (Sequence | dict | None) – If this field is provided, then the Endpoint’s [traffic_split][google.cloud.aiplatform.v1.Endpoint.traffic_split] will be overwritten with it. If last DeployedModel is being undeployed from the Endpoint, the [Endpoint.traffic_split] will always end up empty when this call returns. A DeployedModel will be successfully undeployed only if it doesn’t have any traffic assigned to it when this method executes, or if this field unassigns any traffic to it.
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.
- update_endpoint(project_id, region, endpoint_id, endpoint, update_mask, retry=DEFAULT, timeout=None, metadata=())[source]¶
Updates an Endpoint.
- Parameters
project_id (str) – Required. The ID of the Google Cloud project that the service belongs to.
region (str) – Required. The ID of the Google Cloud region that the service belongs to.
endpoint (google.cloud.aiplatform_v1.types.Endpoint | dict) – Required. The Endpoint which replaces the resource on the server.
update_mask (google.protobuf.field_mask_pb2.FieldMask | dict) – Required. The update mask applies to the resource. See [google.protobuf.FieldMask][google.protobuf.FieldMask].
retry (google.api_core.retry.Retry | google.api_core.gapic_v1.method._MethodDefault) – Designation of what errors, if any, should be retried.
timeout (float | None) – The timeout for this request.
metadata (Sequence[tuple[str, str]]) – Strings which should be sent along with the request as metadata.