apache-airflow-providers-google 14.0.0__py3-none-any.whl → 19.1.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/3rd-party-licenses/LICENSES.txt +14 -0
- airflow/providers/google/3rd-party-licenses/NOTICE +5 -0
- airflow/providers/google/__init__.py +3 -3
- airflow/providers/google/_vendor/__init__.py +0 -0
- airflow/providers/google/_vendor/json_merge_patch.py +91 -0
- airflow/providers/google/ads/hooks/ads.py +52 -43
- airflow/providers/google/ads/operators/ads.py +2 -2
- airflow/providers/google/ads/transfers/ads_to_gcs.py +3 -19
- airflow/providers/google/assets/gcs.py +1 -11
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +3 -2
- airflow/providers/google/cloud/bundles/gcs.py +161 -0
- airflow/providers/google/cloud/hooks/alloy_db.py +2 -3
- airflow/providers/google/cloud/hooks/bigquery.py +195 -318
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +3 -2
- airflow/providers/google/cloud/hooks/cloud_batch.py +8 -9
- airflow/providers/google/cloud/hooks/cloud_build.py +6 -65
- airflow/providers/google/cloud/hooks/cloud_composer.py +292 -24
- airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_run.py +20 -11
- airflow/providers/google/cloud/hooks/cloud_sql.py +136 -64
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +35 -15
- airflow/providers/google/cloud/hooks/compute.py +7 -6
- airflow/providers/google/cloud/hooks/compute_ssh.py +7 -4
- airflow/providers/google/cloud/hooks/datacatalog.py +12 -3
- airflow/providers/google/cloud/hooks/dataflow.py +87 -242
- airflow/providers/google/cloud/hooks/dataform.py +9 -14
- airflow/providers/google/cloud/hooks/datafusion.py +7 -9
- airflow/providers/google/cloud/hooks/dataplex.py +13 -12
- airflow/providers/google/cloud/hooks/dataprep.py +2 -2
- airflow/providers/google/cloud/hooks/dataproc.py +76 -74
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/hooks/dlp.py +5 -4
- airflow/providers/google/cloud/hooks/gcs.py +144 -33
- airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
- airflow/providers/google/cloud/hooks/kms.py +3 -2
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +22 -17
- airflow/providers/google/cloud/hooks/looker.py +6 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +227 -3
- airflow/providers/google/cloud/hooks/mlengine.py +7 -8
- airflow/providers/google/cloud/hooks/natural_language.py +3 -2
- airflow/providers/google/cloud/hooks/os_login.py +3 -2
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +105 -12
- airflow/providers/google/cloud/hooks/spanner.py +75 -10
- airflow/providers/google/cloud/hooks/speech_to_text.py +3 -2
- airflow/providers/google/cloud/hooks/stackdriver.py +18 -18
- airflow/providers/google/cloud/hooks/tasks.py +4 -3
- airflow/providers/google/cloud/hooks/text_to_speech.py +3 -2
- airflow/providers/google/cloud/hooks/translate.py +8 -17
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +8 -222
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +9 -15
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +33 -283
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +5 -12
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +311 -10
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +7 -13
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +8 -12
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +3 -2
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
- airflow/providers/google/cloud/hooks/video_intelligence.py +3 -2
- airflow/providers/google/cloud/hooks/vision.py +7 -7
- airflow/providers/google/cloud/hooks/workflows.py +4 -3
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +77 -7
- airflow/providers/google/cloud/links/bigquery.py +0 -47
- airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
- airflow/providers/google/cloud/links/bigtable.py +0 -48
- airflow/providers/google/cloud/links/cloud_build.py +0 -73
- airflow/providers/google/cloud/links/cloud_functions.py +0 -33
- airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
- airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -46
- airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
- airflow/providers/google/cloud/links/compute.py +0 -58
- airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
- airflow/providers/google/cloud/links/datacatalog.py +23 -54
- airflow/providers/google/cloud/links/dataflow.py +0 -34
- airflow/providers/google/cloud/links/dataform.py +0 -64
- airflow/providers/google/cloud/links/datafusion.py +1 -90
- airflow/providers/google/cloud/links/dataplex.py +0 -154
- airflow/providers/google/cloud/links/dataprep.py +0 -24
- airflow/providers/google/cloud/links/dataproc.py +11 -89
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +11 -61
- airflow/providers/google/cloud/links/managed_kafka.py +11 -51
- airflow/providers/google/cloud/links/mlengine.py +0 -70
- airflow/providers/google/cloud/links/pubsub.py +0 -32
- airflow/providers/google/cloud/links/spanner.py +0 -33
- airflow/providers/google/cloud/links/stackdriver.py +0 -30
- airflow/providers/google/cloud/links/translate.py +17 -187
- airflow/providers/google/cloud/links/vertex_ai.py +28 -195
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/log/gcs_task_handler.py +166 -118
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +14 -9
- airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
- airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
- airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
- airflow/providers/google/cloud/openlineage/facets.py +141 -40
- airflow/providers/google/cloud/openlineage/mixins.py +14 -13
- airflow/providers/google/cloud/openlineage/utils.py +19 -3
- airflow/providers/google/cloud/operators/alloy_db.py +76 -61
- airflow/providers/google/cloud/operators/bigquery.py +104 -667
- airflow/providers/google/cloud/operators/bigquery_dts.py +12 -12
- airflow/providers/google/cloud/operators/bigtable.py +38 -7
- airflow/providers/google/cloud/operators/cloud_base.py +22 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +18 -18
- airflow/providers/google/cloud/operators/cloud_build.py +80 -36
- airflow/providers/google/cloud/operators/cloud_composer.py +157 -71
- airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
- airflow/providers/google/cloud/operators/cloud_memorystore.py +74 -46
- airflow/providers/google/cloud/operators/cloud_run.py +39 -20
- airflow/providers/google/cloud/operators/cloud_sql.py +46 -61
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +92 -14
- airflow/providers/google/cloud/operators/compute.py +18 -50
- airflow/providers/google/cloud/operators/datacatalog.py +167 -29
- airflow/providers/google/cloud/operators/dataflow.py +38 -15
- airflow/providers/google/cloud/operators/dataform.py +19 -7
- airflow/providers/google/cloud/operators/datafusion.py +43 -43
- airflow/providers/google/cloud/operators/dataplex.py +212 -126
- airflow/providers/google/cloud/operators/dataprep.py +1 -5
- airflow/providers/google/cloud/operators/dataproc.py +134 -207
- airflow/providers/google/cloud/operators/dataproc_metastore.py +102 -84
- airflow/providers/google/cloud/operators/datastore.py +22 -6
- airflow/providers/google/cloud/operators/dlp.py +24 -45
- airflow/providers/google/cloud/operators/functions.py +21 -14
- airflow/providers/google/cloud/operators/gcs.py +15 -12
- airflow/providers/google/cloud/operators/gen_ai.py +389 -0
- airflow/providers/google/cloud/operators/kubernetes_engine.py +115 -106
- airflow/providers/google/cloud/operators/looker.py +1 -1
- airflow/providers/google/cloud/operators/managed_kafka.py +362 -40
- airflow/providers/google/cloud/operators/natural_language.py +5 -3
- airflow/providers/google/cloud/operators/pubsub.py +69 -21
- airflow/providers/google/cloud/operators/spanner.py +53 -45
- airflow/providers/google/cloud/operators/speech_to_text.py +5 -4
- airflow/providers/google/cloud/operators/stackdriver.py +5 -11
- airflow/providers/google/cloud/operators/tasks.py +6 -15
- airflow/providers/google/cloud/operators/text_to_speech.py +4 -3
- airflow/providers/google/cloud/operators/translate.py +46 -20
- airflow/providers/google/cloud/operators/translate_speech.py +4 -3
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +44 -34
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +34 -12
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +62 -53
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +75 -11
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +48 -12
- airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -116
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +16 -12
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +62 -14
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +35 -10
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
- airflow/providers/google/cloud/operators/video_intelligence.py +5 -3
- airflow/providers/google/cloud/operators/vision.py +7 -5
- airflow/providers/google/cloud/operators/workflows.py +24 -19
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -1
- airflow/providers/google/cloud/sensors/bigquery.py +2 -2
- airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -4
- airflow/providers/google/cloud/sensors/bigtable.py +14 -6
- airflow/providers/google/cloud/sensors/cloud_composer.py +535 -33
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -5
- airflow/providers/google/cloud/sensors/dataflow.py +27 -10
- airflow/providers/google/cloud/sensors/dataform.py +2 -2
- airflow/providers/google/cloud/sensors/datafusion.py +4 -4
- airflow/providers/google/cloud/sensors/dataplex.py +7 -5
- airflow/providers/google/cloud/sensors/dataprep.py +2 -2
- airflow/providers/google/cloud/sensors/dataproc.py +10 -9
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/sensors/gcs.py +22 -21
- airflow/providers/google/cloud/sensors/looker.py +5 -5
- airflow/providers/google/cloud/sensors/pubsub.py +20 -20
- airflow/providers/google/cloud/sensors/tasks.py +2 -2
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -2
- airflow/providers/google/cloud/sensors/workflows.py +6 -4
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +14 -13
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
- airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
- airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +18 -22
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +4 -5
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +45 -38
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/gcs_to_local.py +5 -3
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +10 -4
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +44 -12
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +12 -6
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +36 -14
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
- airflow/providers/google/cloud/triggers/bigquery.py +75 -34
- airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_build.py +3 -2
- airflow/providers/google/cloud/triggers/cloud_composer.py +303 -47
- airflow/providers/google/cloud/triggers/cloud_run.py +2 -2
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +96 -5
- airflow/providers/google/cloud/triggers/dataflow.py +125 -2
- airflow/providers/google/cloud/triggers/datafusion.py +1 -1
- airflow/providers/google/cloud/triggers/dataplex.py +16 -3
- airflow/providers/google/cloud/triggers/dataproc.py +124 -53
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +46 -28
- airflow/providers/google/cloud/triggers/mlengine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +17 -20
- airflow/providers/google/cloud/triggers/vertex_ai.py +8 -7
- airflow/providers/google/cloud/utils/bigquery.py +5 -7
- airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
- airflow/providers/google/cloud/utils/credentials_provider.py +4 -3
- airflow/providers/google/cloud/utils/dataform.py +1 -1
- airflow/providers/google/cloud/utils/external_token_supplier.py +0 -1
- airflow/providers/google/cloud/utils/field_validator.py +1 -2
- airflow/providers/google/cloud/utils/validators.py +43 -0
- airflow/providers/google/common/auth_backend/google_openid.py +26 -9
- airflow/providers/google/common/consts.py +2 -1
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +40 -43
- airflow/providers/google/common/hooks/operation_helpers.py +78 -0
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/common/utils/get_secret.py +31 -0
- airflow/providers/google/common/utils/id_token_credentials.py +4 -5
- airflow/providers/google/firebase/operators/firestore.py +2 -2
- airflow/providers/google/get_provider_info.py +61 -216
- airflow/providers/google/go_module_utils.py +35 -3
- airflow/providers/google/leveldb/hooks/leveldb.py +30 -6
- airflow/providers/google/leveldb/operators/leveldb.py +2 -2
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +3 -2
- airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +4 -5
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +7 -6
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +5 -5
- airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
- airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
- airflow/providers/google/marketing_platform/sensors/display_video.py +4 -64
- airflow/providers/google/suite/hooks/calendar.py +1 -1
- airflow/providers/google/suite/hooks/drive.py +2 -2
- airflow/providers/google/suite/hooks/sheets.py +15 -1
- airflow/providers/google/suite/operators/sheets.py +8 -3
- airflow/providers/google/suite/sensors/drive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
- airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
- airflow/providers/google/version_compat.py +15 -1
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/METADATA +117 -72
- apache_airflow_providers_google-19.1.0rc1.dist-info/RECORD +331 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/WHEEL +1 -1
- apache_airflow_providers_google-19.1.0rc1.dist-info/licenses/NOTICE +5 -0
- airflow/providers/google/cloud/example_dags/example_cloud_task.py +0 -54
- airflow/providers/google/cloud/hooks/automl.py +0 -679
- airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
- airflow/providers/google/cloud/links/automl.py +0 -193
- airflow/providers/google/cloud/operators/automl.py +0 -1360
- airflow/providers/google/cloud/operators/life_sciences.py +0 -119
- airflow/providers/google/cloud/operators/mlengine.py +0 -1515
- airflow/providers/google/cloud/utils/mlengine_operator_utils.py +0 -273
- apache_airflow_providers_google-14.0.0.dist-info/RECORD +0 -318
- /airflow/providers/google/cloud/{example_dags → bundles}/__init__.py +0 -0
- {apache_airflow_providers_google-14.0.0.dist-info → apache_airflow_providers_google-19.1.0rc1.dist-info}/entry_points.txt +0 -0
- {airflow/providers/google → apache_airflow_providers_google-19.1.0rc1.dist-info/licenses}/LICENSE +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
|
3
|
+
# distributed with this work for additional information
|
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
|
6
|
+
# "License"); you may not use this file except in compliance
|
|
7
|
+
# with the License. You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
|
12
|
+
# software distributed under the License is distributed on an
|
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
# KIND, either express or implied. See the License for the
|
|
15
|
+
# specific language governing permissions and limitations
|
|
16
|
+
# under the License.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from google.cloud import aiplatform
|
|
21
|
+
from google.cloud.aiplatform.compat.types import execution_v1 as gca_execution
|
|
22
|
+
|
|
23
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class ExperimentHook(GoogleBaseHook):
|
|
27
|
+
"""Use the Vertex AI SDK for Python to manage your experiments."""
|
|
28
|
+
|
|
29
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
30
|
+
def create_experiment(
|
|
31
|
+
self,
|
|
32
|
+
experiment_name: str,
|
|
33
|
+
location: str,
|
|
34
|
+
experiment_description: str = "",
|
|
35
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
36
|
+
experiment_tensorboard: str | None = None,
|
|
37
|
+
):
|
|
38
|
+
"""
|
|
39
|
+
Create an experiment and, optionally, associate a Vertex AI TensorBoard instance using the Vertex AI SDK for Python.
|
|
40
|
+
|
|
41
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
42
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
43
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
44
|
+
:param experiment_description: Optional. Description of the evaluation experiment.
|
|
45
|
+
:param experiment_tensorboard: Optional. The Vertex TensorBoard instance to use as a backing
|
|
46
|
+
TensorBoard for the provided experiment. If no TensorBoard is provided, a default Tensorboard
|
|
47
|
+
instance is created and used by this experiment.
|
|
48
|
+
"""
|
|
49
|
+
aiplatform.init(
|
|
50
|
+
experiment=experiment_name,
|
|
51
|
+
experiment_description=experiment_description,
|
|
52
|
+
experiment_tensorboard=experiment_tensorboard if experiment_tensorboard else False,
|
|
53
|
+
project=project_id,
|
|
54
|
+
location=location,
|
|
55
|
+
)
|
|
56
|
+
self.log.info("Created experiment with name: %s", experiment_name)
|
|
57
|
+
|
|
58
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
59
|
+
def delete_experiment(
|
|
60
|
+
self,
|
|
61
|
+
experiment_name: str,
|
|
62
|
+
location: str,
|
|
63
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
64
|
+
delete_backing_tensorboard_runs: bool = False,
|
|
65
|
+
) -> None:
|
|
66
|
+
"""
|
|
67
|
+
Delete an experiment.
|
|
68
|
+
|
|
69
|
+
Deleting an experiment deletes that experiment and all experiment runs associated with the experiment.
|
|
70
|
+
The Vertex AI TensorBoard experiment associated with the experiment is not deleted.
|
|
71
|
+
|
|
72
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
73
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
74
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
75
|
+
:param delete_backing_tensorboard_runs: Optional. If True will also delete the Vertex AI TensorBoard
|
|
76
|
+
runs associated with the experiment runs under this experiment that we used to store time series
|
|
77
|
+
metrics.
|
|
78
|
+
"""
|
|
79
|
+
experiment = aiplatform.Experiment(
|
|
80
|
+
experiment_name=experiment_name, project=project_id, location=location
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
experiment.delete(delete_backing_tensorboard_runs=delete_backing_tensorboard_runs)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class ExperimentRunHook(GoogleBaseHook):
|
|
87
|
+
"""Use the Vertex AI SDK for Python to create and manage your experiment runs."""
|
|
88
|
+
|
|
89
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
90
|
+
def create_experiment_run(
|
|
91
|
+
self,
|
|
92
|
+
experiment_run_name: str,
|
|
93
|
+
experiment_name: str,
|
|
94
|
+
location: str,
|
|
95
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
96
|
+
experiment_run_tensorboard: str | None = None,
|
|
97
|
+
run_after_creation: bool = False,
|
|
98
|
+
) -> None:
|
|
99
|
+
"""
|
|
100
|
+
Create experiment run for the experiment.
|
|
101
|
+
|
|
102
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
103
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
104
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
105
|
+
:param experiment_run_name: Required. The specific run name or ID for this experiment.
|
|
106
|
+
:param experiment_run_tensorboard: Optional. A backing TensorBoard resource to enable and store time
|
|
107
|
+
series metrics logged to this experiment run.
|
|
108
|
+
:param run_after_creation: Optional. Responsible for state after creation of experiment run.
|
|
109
|
+
If true experiment run will be created with state RUNNING.
|
|
110
|
+
"""
|
|
111
|
+
experiment_run_state = (
|
|
112
|
+
gca_execution.Execution.State.NEW
|
|
113
|
+
if not run_after_creation
|
|
114
|
+
else gca_execution.Execution.State.RUNNING
|
|
115
|
+
)
|
|
116
|
+
experiment_run = aiplatform.ExperimentRun.create(
|
|
117
|
+
run_name=experiment_run_name,
|
|
118
|
+
experiment=experiment_name,
|
|
119
|
+
project=project_id,
|
|
120
|
+
location=location,
|
|
121
|
+
state=experiment_run_state,
|
|
122
|
+
tensorboard=experiment_run_tensorboard,
|
|
123
|
+
)
|
|
124
|
+
self.log.info(
|
|
125
|
+
"Created experiment run with name: %s and status: %s",
|
|
126
|
+
experiment_run.name,
|
|
127
|
+
experiment_run.state,
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
131
|
+
def list_experiment_runs(
|
|
132
|
+
self,
|
|
133
|
+
experiment_name: str,
|
|
134
|
+
location: str,
|
|
135
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
136
|
+
) -> list[aiplatform.ExperimentRun]:
|
|
137
|
+
"""
|
|
138
|
+
List experiment run for the experiment.
|
|
139
|
+
|
|
140
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
141
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
142
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
143
|
+
"""
|
|
144
|
+
experiment_runs = aiplatform.ExperimentRun.list(
|
|
145
|
+
experiment=experiment_name,
|
|
146
|
+
project=project_id,
|
|
147
|
+
location=location,
|
|
148
|
+
)
|
|
149
|
+
return experiment_runs
|
|
150
|
+
|
|
151
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
152
|
+
def update_experiment_run_state(
|
|
153
|
+
self,
|
|
154
|
+
experiment_run_name: str,
|
|
155
|
+
experiment_name: str,
|
|
156
|
+
location: str,
|
|
157
|
+
new_state: gca_execution.Execution.State,
|
|
158
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
159
|
+
) -> None:
|
|
160
|
+
"""
|
|
161
|
+
Update state of the experiment run.
|
|
162
|
+
|
|
163
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
164
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
165
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
166
|
+
:param experiment_run_name: Required. The specific run name or ID for this experiment.
|
|
167
|
+
:param new_state: Required. New state of the experiment run.
|
|
168
|
+
"""
|
|
169
|
+
experiment_run = aiplatform.ExperimentRun(
|
|
170
|
+
run_name=experiment_run_name,
|
|
171
|
+
experiment=experiment_name,
|
|
172
|
+
project=project_id,
|
|
173
|
+
location=location,
|
|
174
|
+
)
|
|
175
|
+
self.log.info("State of the %s before update is: %s", experiment_run.name, experiment_run.state)
|
|
176
|
+
|
|
177
|
+
experiment_run.update_state(new_state)
|
|
178
|
+
|
|
179
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
180
|
+
def delete_experiment_run(
|
|
181
|
+
self,
|
|
182
|
+
experiment_run_name: str,
|
|
183
|
+
experiment_name: str,
|
|
184
|
+
location: str,
|
|
185
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
186
|
+
delete_backing_tensorboard_run: bool = False,
|
|
187
|
+
) -> None:
|
|
188
|
+
"""
|
|
189
|
+
Delete experiment run from the experiment.
|
|
190
|
+
|
|
191
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
|
192
|
+
:param location: Required. The ID of the Google Cloud location that the service belongs to.
|
|
193
|
+
:param experiment_name: Required. The name of the evaluation experiment.
|
|
194
|
+
:param experiment_run_name: Required. The specific run name or ID for this experiment.
|
|
195
|
+
:param delete_backing_tensorboard_run: Whether to delete the backing Vertex AI TensorBoard run
|
|
196
|
+
that stores time series metrics for this run.
|
|
197
|
+
"""
|
|
198
|
+
self.log.info("Next experiment run will be deleted: %s", experiment_run_name)
|
|
199
|
+
experiment_run = aiplatform.ExperimentRun(
|
|
200
|
+
run_name=experiment_run_name, experiment=experiment_name, project=project_id, location=location
|
|
201
|
+
)
|
|
202
|
+
experiment_run.delete(delete_backing_tensorboard_run=delete_backing_tensorboard_run)
|
|
@@ -18,14 +18,32 @@
|
|
|
18
18
|
|
|
19
19
|
from __future__ import annotations
|
|
20
20
|
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
|
|
21
|
+
from collections.abc import Sequence
|
|
22
|
+
from typing import (
|
|
23
|
+
TYPE_CHECKING,
|
|
24
|
+
)
|
|
25
|
+
|
|
24
26
|
from google.api_core.client_options import ClientOptions
|
|
27
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
25
28
|
from google.cloud.aiplatform_v1beta1 import (
|
|
26
29
|
FeatureOnlineStoreAdminServiceClient,
|
|
30
|
+
FeatureOnlineStoreServiceClient,
|
|
27
31
|
)
|
|
28
32
|
|
|
33
|
+
from airflow.exceptions import AirflowException
|
|
34
|
+
from airflow.providers.google.common.consts import CLIENT_INFO
|
|
35
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID, GoogleBaseHook
|
|
36
|
+
|
|
37
|
+
if TYPE_CHECKING:
|
|
38
|
+
from google.api_core.operation import Operation
|
|
39
|
+
from google.api_core.retry import Retry
|
|
40
|
+
from google.cloud.aiplatform_v1beta1.types import (
|
|
41
|
+
FeatureOnlineStore,
|
|
42
|
+
FeatureView,
|
|
43
|
+
FeatureViewDataKey,
|
|
44
|
+
FetchFeatureValuesResponse,
|
|
45
|
+
)
|
|
46
|
+
|
|
29
47
|
|
|
30
48
|
class FeatureStoreHook(GoogleBaseHook):
|
|
31
49
|
"""
|
|
@@ -47,6 +65,19 @@ class FeatureStoreHook(GoogleBaseHook):
|
|
|
47
65
|
originating account.
|
|
48
66
|
"""
|
|
49
67
|
|
|
68
|
+
@staticmethod
|
|
69
|
+
def _get_client_options(
|
|
70
|
+
location: str | None = None,
|
|
71
|
+
custom_endpoint: str | None = None,
|
|
72
|
+
) -> ClientOptions:
|
|
73
|
+
if custom_endpoint:
|
|
74
|
+
client_options = ClientOptions(api_endpoint=custom_endpoint)
|
|
75
|
+
elif location and location != "global":
|
|
76
|
+
client_options = ClientOptions(api_endpoint=f"{location}-aiplatform.googleapis.com:443")
|
|
77
|
+
else:
|
|
78
|
+
client_options = ClientOptions()
|
|
79
|
+
return client_options
|
|
80
|
+
|
|
50
81
|
def get_feature_online_store_admin_service_client(
|
|
51
82
|
self,
|
|
52
83
|
location: str | None = None,
|
|
@@ -61,12 +92,153 @@ class FeatureStoreHook(GoogleBaseHook):
|
|
|
61
92
|
If provided and not 'global', the client will be configured to use the
|
|
62
93
|
region-specific API endpoint.
|
|
63
94
|
"""
|
|
64
|
-
if location and location != "global":
|
|
65
|
-
client_options = ClientOptions(api_endpoint=f"{location}-aiplatform.googleapis.com:443")
|
|
66
|
-
else:
|
|
67
|
-
client_options = ClientOptions()
|
|
68
95
|
return FeatureOnlineStoreAdminServiceClient(
|
|
69
|
-
credentials=self.get_credentials(),
|
|
96
|
+
credentials=self.get_credentials(),
|
|
97
|
+
client_info=CLIENT_INFO,
|
|
98
|
+
client_options=self._get_client_options(location),
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
def get_feature_online_store_service_client(
|
|
102
|
+
self,
|
|
103
|
+
location: str | None = None,
|
|
104
|
+
custom_endpoint: str | None = None,
|
|
105
|
+
) -> FeatureOnlineStoreServiceClient:
|
|
106
|
+
return FeatureOnlineStoreServiceClient(
|
|
107
|
+
credentials=self.get_credentials(),
|
|
108
|
+
client_info=CLIENT_INFO,
|
|
109
|
+
client_options=self._get_client_options(location, custom_endpoint),
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
113
|
+
def create_feature_online_store(
|
|
114
|
+
self,
|
|
115
|
+
feature_online_store_id: str,
|
|
116
|
+
feature_online_store: FeatureOnlineStore,
|
|
117
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
118
|
+
location: str | None = None,
|
|
119
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
120
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
121
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
122
|
+
) -> Operation:
|
|
123
|
+
"""
|
|
124
|
+
Create and sends request for Feature Online store.
|
|
125
|
+
|
|
126
|
+
This method initiates VertexAI Feature Online Store creation request.
|
|
127
|
+
Feature Online Store aims to serve and manage features data as a part of VertexAI MLOps.
|
|
128
|
+
|
|
129
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
130
|
+
:param feature_online_store: The configuration of the online repository.
|
|
131
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
132
|
+
feature store. If not provided, will attempt to determine from the environment.
|
|
133
|
+
:param location: The Google Cloud region where the feature store is located
|
|
134
|
+
(e.g., 'us-central1', 'us-east1').
|
|
135
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
136
|
+
:param timeout: The timeout for this request.
|
|
137
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
138
|
+
"""
|
|
139
|
+
client = self.get_feature_online_store_admin_service_client(location)
|
|
140
|
+
return client.create_feature_online_store(
|
|
141
|
+
request={
|
|
142
|
+
"parent": f"projects/{project_id}/locations/{location}",
|
|
143
|
+
"feature_online_store_id": feature_online_store_id,
|
|
144
|
+
"feature_online_store": feature_online_store,
|
|
145
|
+
},
|
|
146
|
+
timeout=timeout,
|
|
147
|
+
retry=retry,
|
|
148
|
+
metadata=metadata,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
152
|
+
def get_feature_online_store(
|
|
153
|
+
self,
|
|
154
|
+
feature_online_store_id: str,
|
|
155
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
156
|
+
location: str | None = None,
|
|
157
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
158
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
159
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
160
|
+
) -> FeatureOnlineStore:
|
|
161
|
+
"""
|
|
162
|
+
Get Feature Online store data.
|
|
163
|
+
|
|
164
|
+
Get the FeatureOnlineStore details.
|
|
165
|
+
Vertex AI Feature Online Store provides a centralized repository for serving ML features
|
|
166
|
+
and embedding indexes at low latency.
|
|
167
|
+
|
|
168
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
169
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
170
|
+
feature store. If not provided, will attempt to determine from the environment.
|
|
171
|
+
:param location: The Google Cloud region where the feature store is located
|
|
172
|
+
(e.g., 'us-central1', 'us-east1').
|
|
173
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
174
|
+
:param timeout: The timeout for this request.
|
|
175
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
176
|
+
"""
|
|
177
|
+
client = self.get_feature_online_store_admin_service_client(location)
|
|
178
|
+
return client.get_feature_online_store(
|
|
179
|
+
name=f"projects/{project_id}/locations/{location}/featureOnlineStores/{feature_online_store_id}",
|
|
180
|
+
timeout=timeout,
|
|
181
|
+
retry=retry,
|
|
182
|
+
metadata=metadata,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
@staticmethod
|
|
186
|
+
def _get_featurestore_public_endpoint(feature_online_store: FeatureOnlineStore):
|
|
187
|
+
public_endpoint = None
|
|
188
|
+
featurestore_data = type(feature_online_store).to_dict(feature_online_store)
|
|
189
|
+
if "dedicated_serving_endpoint" in featurestore_data:
|
|
190
|
+
public_endpoint = featurestore_data["dedicated_serving_endpoint"].get(
|
|
191
|
+
"public_endpoint_domain_name"
|
|
192
|
+
)
|
|
193
|
+
return public_endpoint
|
|
194
|
+
|
|
195
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
196
|
+
def create_feature_view(
|
|
197
|
+
self,
|
|
198
|
+
feature_view_id: str,
|
|
199
|
+
feature_view: FeatureView,
|
|
200
|
+
feature_online_store_id: str,
|
|
201
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
202
|
+
run_sync_immediately: bool = False,
|
|
203
|
+
location: str | None = None,
|
|
204
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
205
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
206
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
207
|
+
) -> Operation:
|
|
208
|
+
"""
|
|
209
|
+
Create request for Feature View creation.
|
|
210
|
+
|
|
211
|
+
This method initiates VertexAI Feature View request for the existing Feature Online Store.
|
|
212
|
+
Feature View represents features and data according to the source provided.
|
|
213
|
+
|
|
214
|
+
:param feature_view_id: The ID to use for the FeatureView, which will
|
|
215
|
+
become the final component of the FeatureView's resource name.
|
|
216
|
+
This value may be up to 60 characters, and valid characters are ``[a-z0-9_]``.
|
|
217
|
+
The first character cannot be a number. The value must be unique within a FeatureOnlineStore.
|
|
218
|
+
:param feature_view: The configuration of the FeatureView to create.
|
|
219
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
220
|
+
:param run_sync_immediately: If set to true, one on demand sync will be run
|
|
221
|
+
immediately, regardless the FeatureView.sync_config.
|
|
222
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
223
|
+
feature store. If not provided, will attempt to determine from the environment.
|
|
224
|
+
:param location: The Google Cloud region where the feature store is located
|
|
225
|
+
(e.g., 'us-central1', 'us-east1').
|
|
226
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
227
|
+
:param timeout: The timeout for this request.
|
|
228
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
229
|
+
"""
|
|
230
|
+
client = self.get_feature_online_store_admin_service_client(location)
|
|
231
|
+
return client.create_feature_view(
|
|
232
|
+
request={
|
|
233
|
+
"parent": f"projects/{project_id}/locations/"
|
|
234
|
+
f"{location}/featureOnlineStores/{feature_online_store_id}",
|
|
235
|
+
"feature_view_id": feature_view_id,
|
|
236
|
+
"feature_view": feature_view,
|
|
237
|
+
"run_sync_immediately": run_sync_immediately,
|
|
238
|
+
},
|
|
239
|
+
timeout=timeout,
|
|
240
|
+
retry=retry,
|
|
241
|
+
metadata=metadata,
|
|
70
242
|
)
|
|
71
243
|
|
|
72
244
|
def get_feature_view_sync(
|
|
@@ -134,13 +306,142 @@ class FeatureStoreHook(GoogleBaseHook):
|
|
|
134
306
|
environment.
|
|
135
307
|
"""
|
|
136
308
|
client = self.get_feature_online_store_admin_service_client(location)
|
|
137
|
-
feature_view =
|
|
309
|
+
feature_view = (
|
|
310
|
+
f"projects/{project_id}/locations/{location}/featureOnlineStores/"
|
|
311
|
+
f"{feature_online_store_id}/featureViews/{feature_view_id}"
|
|
312
|
+
)
|
|
138
313
|
|
|
139
314
|
try:
|
|
140
315
|
response = client.sync_feature_view(feature_view=feature_view)
|
|
141
|
-
|
|
142
316
|
return str(response.feature_view_sync)
|
|
143
317
|
|
|
144
318
|
except Exception as e:
|
|
145
319
|
self.log.error("Failed to sync feature view: %s", str(e))
|
|
146
320
|
raise AirflowException(str(e))
|
|
321
|
+
|
|
322
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
323
|
+
def fetch_feature_values(
|
|
324
|
+
self,
|
|
325
|
+
feature_view_id: str,
|
|
326
|
+
feature_online_store_id: str,
|
|
327
|
+
entity_id: str | None = None,
|
|
328
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
329
|
+
endpoint_domain_name: str | None = None,
|
|
330
|
+
data_key: FeatureViewDataKey | None = None,
|
|
331
|
+
data_format: int | None = None,
|
|
332
|
+
location: str | None = None,
|
|
333
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
334
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
335
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
336
|
+
) -> FetchFeatureValuesResponse:
|
|
337
|
+
"""
|
|
338
|
+
Fetch data from the Feature View provided.
|
|
339
|
+
|
|
340
|
+
This method fetches data from existing Feature view, filtered by provided (or default) data_key.
|
|
341
|
+
Helps to retrieve actual features data hosted in the VertexAI Feature Store.
|
|
342
|
+
|
|
343
|
+
:param entity_id: Simple ID to identify Entity to fetch feature values for.
|
|
344
|
+
:param endpoint_domain_name: Optional. Public domain name, hosting the content of Optimized
|
|
345
|
+
Feature Online store. Should be omitted, if bigtable configuration provided for the FeatureStore,
|
|
346
|
+
and default feature store endpoint will be used, based on location provided.
|
|
347
|
+
:param feature_view_id: The FeatureView ID to fetch data from.
|
|
348
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
349
|
+
:param data_key: Optional. The request key to fetch feature values for.
|
|
350
|
+
:param data_format: Optional. Response data format. If not set, FeatureViewDataFormat.KEY_VALUE
|
|
351
|
+
will be used.
|
|
352
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
353
|
+
feature store. If not provided, will attempt to determine from the
|
|
354
|
+
environment.
|
|
355
|
+
:param location: The Google Cloud region where the feature store is located
|
|
356
|
+
(e.g., 'us-central1', 'us-east1').
|
|
357
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
358
|
+
:param timeout: The timeout for this request.
|
|
359
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
360
|
+
"""
|
|
361
|
+
data_client = self.get_feature_online_store_service_client(location, endpoint_domain_name)
|
|
362
|
+
return data_client.fetch_feature_values(
|
|
363
|
+
request={
|
|
364
|
+
"id": entity_id,
|
|
365
|
+
"feature_view": f"projects/{project_id}/locations/{location}/featureOnlineStores/"
|
|
366
|
+
f"{feature_online_store_id}/featureViews/{feature_view_id}",
|
|
367
|
+
"data_key": data_key,
|
|
368
|
+
"data_format": data_format,
|
|
369
|
+
},
|
|
370
|
+
timeout=timeout,
|
|
371
|
+
retry=retry,
|
|
372
|
+
metadata=metadata,
|
|
373
|
+
)
|
|
374
|
+
|
|
375
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
376
|
+
def delete_feature_view(
|
|
377
|
+
self,
|
|
378
|
+
feature_view_id: str,
|
|
379
|
+
feature_online_store_id: str,
|
|
380
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
381
|
+
location: str | None = None,
|
|
382
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
383
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
384
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
385
|
+
) -> Operation:
|
|
386
|
+
"""
|
|
387
|
+
Delete the Feature View.
|
|
388
|
+
|
|
389
|
+
This method deletes the Feature View from the Feature Online Store.
|
|
390
|
+
|
|
391
|
+
:param feature_view_id: The ID to use for the FeatureView, to be deleted.
|
|
392
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
393
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
394
|
+
feature store. If not provided, will attempt to determine from the
|
|
395
|
+
environment.
|
|
396
|
+
:param location: The Google Cloud region where the feature store is located
|
|
397
|
+
(e.g., 'us-central1', 'us-east1').
|
|
398
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
399
|
+
:param timeout: The timeout for this request.
|
|
400
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
401
|
+
"""
|
|
402
|
+
client = self.get_feature_online_store_admin_service_client(location)
|
|
403
|
+
return client.delete_feature_view(
|
|
404
|
+
name=f"projects/{project_id}/locations/{location}/featureOnlineStores/{feature_online_store_id}"
|
|
405
|
+
f"/featureViews/{feature_view_id}",
|
|
406
|
+
timeout=timeout,
|
|
407
|
+
retry=retry,
|
|
408
|
+
metadata=metadata,
|
|
409
|
+
)
|
|
410
|
+
|
|
411
|
+
@GoogleBaseHook.fallback_to_default_project_id
|
|
412
|
+
def delete_feature_online_store(
|
|
413
|
+
self,
|
|
414
|
+
feature_online_store_id: str,
|
|
415
|
+
force: bool = False,
|
|
416
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
|
417
|
+
location: str | None = None,
|
|
418
|
+
timeout: float | _MethodDefault = DEFAULT,
|
|
419
|
+
retry: Retry | _MethodDefault | None = DEFAULT,
|
|
420
|
+
metadata: Sequence[tuple[str, str]] = (),
|
|
421
|
+
) -> Operation:
|
|
422
|
+
"""
|
|
423
|
+
Delete the FeatureOnlineStore.
|
|
424
|
+
|
|
425
|
+
This method deletes the Feature Online Store and all features data.
|
|
426
|
+
The FeatureOnlineStore must not contain any FeatureViews.
|
|
427
|
+
|
|
428
|
+
:param feature_online_store_id: The ID of the online feature store.
|
|
429
|
+
:param force: If set to true, any FeatureViews and Features for this FeatureOnlineStore
|
|
430
|
+
will also be deleted.
|
|
431
|
+
:param project_id: The ID of the Google Cloud project that contains the
|
|
432
|
+
feature store. If not provided, will attempt to determine from the
|
|
433
|
+
environment.
|
|
434
|
+
:param location: The Google Cloud region where the feature store is located
|
|
435
|
+
(e.g., 'us-central1', 'us-east1').
|
|
436
|
+
:param retry: Designation of what errors, if any, should be retried.
|
|
437
|
+
:param timeout: The timeout for this request.
|
|
438
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
|
439
|
+
"""
|
|
440
|
+
client = self.get_feature_online_store_admin_service_client(location)
|
|
441
|
+
return client.delete_feature_online_store(
|
|
442
|
+
name=f"projects/{project_id}/locations/{location}/featureOnlineStores/{feature_online_store_id}",
|
|
443
|
+
force=force,
|
|
444
|
+
timeout=timeout,
|
|
445
|
+
retry=retry,
|
|
446
|
+
metadata=metadata,
|
|
447
|
+
)
|