apache-airflow-providers-google 16.0.0a1__py3-none-any.whl → 16.1.0__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/__init__.py +1 -1
- airflow/providers/google/ads/hooks/ads.py +43 -5
- airflow/providers/google/ads/operators/ads.py +1 -1
- airflow/providers/google/ads/transfers/ads_to_gcs.py +1 -1
- airflow/providers/google/cloud/hooks/bigquery.py +63 -77
- airflow/providers/google/cloud/hooks/cloud_sql.py +8 -4
- airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
- airflow/providers/google/cloud/hooks/dataflow.py +2 -2
- airflow/providers/google/cloud/hooks/dataplex.py +1 -1
- airflow/providers/google/cloud/hooks/dataprep.py +4 -1
- airflow/providers/google/cloud/hooks/gcs.py +5 -5
- airflow/providers/google/cloud/hooks/looker.py +10 -1
- airflow/providers/google/cloud/hooks/mlengine.py +2 -1
- airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
- airflow/providers/google/cloud/hooks/spanner.py +2 -2
- airflow/providers/google/cloud/hooks/translate.py +1 -1
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +0 -36
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +44 -80
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
- airflow/providers/google/cloud/hooks/vision.py +2 -2
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +75 -11
- 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/cloud_run.py +27 -0
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
- airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
- 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 -96
- 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 +14 -90
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
- airflow/providers/google/cloud/links/life_sciences.py +0 -19
- airflow/providers/google/cloud/links/managed_kafka.py +0 -70
- 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 +16 -186
- airflow/providers/google/cloud/links/vertex_ai.py +8 -224
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/log/gcs_task_handler.py +4 -4
- airflow/providers/google/cloud/operators/alloy_db.py +69 -54
- airflow/providers/google/cloud/operators/automl.py +16 -14
- airflow/providers/google/cloud/operators/bigquery.py +49 -25
- airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
- airflow/providers/google/cloud/operators/bigtable.py +35 -6
- airflow/providers/google/cloud/operators/cloud_base.py +21 -1
- airflow/providers/google/cloud/operators/cloud_build.py +74 -31
- airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
- airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
- airflow/providers/google/cloud/operators/cloud_run.py +9 -1
- airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
- airflow/providers/google/cloud/operators/compute.py +7 -39
- airflow/providers/google/cloud/operators/datacatalog.py +156 -20
- airflow/providers/google/cloud/operators/dataflow.py +37 -14
- airflow/providers/google/cloud/operators/dataform.py +14 -4
- airflow/providers/google/cloud/operators/datafusion.py +4 -12
- airflow/providers/google/cloud/operators/dataplex.py +180 -96
- airflow/providers/google/cloud/operators/dataprep.py +0 -4
- airflow/providers/google/cloud/operators/dataproc.py +10 -16
- airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
- airflow/providers/google/cloud/operators/datastore.py +21 -5
- airflow/providers/google/cloud/operators/dlp.py +3 -26
- airflow/providers/google/cloud/operators/functions.py +15 -6
- airflow/providers/google/cloud/operators/gcs.py +1 -7
- airflow/providers/google/cloud/operators/kubernetes_engine.py +53 -92
- airflow/providers/google/cloud/operators/life_sciences.py +0 -1
- airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
- airflow/providers/google/cloud/operators/mlengine.py +0 -1
- airflow/providers/google/cloud/operators/pubsub.py +4 -5
- airflow/providers/google/cloud/operators/spanner.py +0 -4
- airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
- airflow/providers/google/cloud/operators/stackdriver.py +0 -8
- airflow/providers/google/cloud/operators/tasks.py +0 -11
- airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
- airflow/providers/google/cloud/operators/translate.py +37 -13
- airflow/providers/google/cloud/operators/translate_speech.py +0 -1
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -117
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +29 -6
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
- airflow/providers/google/cloud/operators/workflows.py +1 -9
- airflow/providers/google/cloud/sensors/bigquery.py +1 -1
- airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
- airflow/providers/google/cloud/sensors/bigtable.py +15 -3
- airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
- airflow/providers/google/cloud/sensors/dataflow.py +3 -3
- airflow/providers/google/cloud/sensors/dataform.py +6 -1
- airflow/providers/google/cloud/sensors/datafusion.py +6 -1
- airflow/providers/google/cloud/sensors/dataplex.py +6 -1
- airflow/providers/google/cloud/sensors/dataprep.py +6 -1
- airflow/providers/google/cloud/sensors/dataproc.py +6 -1
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
- airflow/providers/google/cloud/sensors/gcs.py +9 -3
- airflow/providers/google/cloud/sensors/looker.py +6 -1
- airflow/providers/google/cloud/sensors/pubsub.py +8 -3
- airflow/providers/google/cloud/sensors/tasks.py +6 -1
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
- airflow/providers/google/cloud/sensors/workflows.py +6 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +10 -7
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +11 -5
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
- airflow/providers/google/cloud/triggers/bigquery.py +32 -5
- airflow/providers/google/cloud/triggers/dataproc.py +62 -10
- airflow/providers/google/cloud/utils/field_validator.py +1 -2
- airflow/providers/google/common/auth_backend/google_openid.py +2 -1
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +7 -3
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/firebase/operators/firestore.py +1 -1
- airflow/providers/google/get_provider_info.py +14 -16
- airflow/providers/google/leveldb/hooks/leveldb.py +30 -1
- airflow/providers/google/leveldb/operators/leveldb.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
- airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
- airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
- airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
- airflow/providers/google/suite/operators/sheets.py +3 -3
- airflow/providers/google/suite/sensors/drive.py +6 -1
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
- airflow/providers/google/version_compat.py +28 -0
- {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/METADATA +35 -35
- {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/RECORD +171 -170
- airflow/providers/google/cloud/links/automl.py +0 -193
- {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-16.0.0a1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/entry_points.txt +0 -0
@@ -16,13 +16,8 @@
|
|
16
16
|
# under the License.
|
17
17
|
from __future__ import annotations
|
18
18
|
|
19
|
-
from typing import TYPE_CHECKING
|
20
|
-
|
21
19
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
22
20
|
|
23
|
-
if TYPE_CHECKING:
|
24
|
-
from airflow.utils.context import Context
|
25
|
-
|
26
21
|
MANAGED_KAFKA_BASE_LINK = "/managedkafka"
|
27
22
|
MANAGED_KAFKA_CLUSTER_LINK = (
|
28
23
|
MANAGED_KAFKA_BASE_LINK + "/{location}/clusters/{cluster_id}?project={project_id}"
|
@@ -44,22 +39,6 @@ class ApacheKafkaClusterLink(BaseGoogleLink):
|
|
44
39
|
key = "cluster_conf"
|
45
40
|
format_str = MANAGED_KAFKA_CLUSTER_LINK
|
46
41
|
|
47
|
-
@staticmethod
|
48
|
-
def persist(
|
49
|
-
context: Context,
|
50
|
-
task_instance,
|
51
|
-
cluster_id: str,
|
52
|
-
):
|
53
|
-
task_instance.xcom_push(
|
54
|
-
context=context,
|
55
|
-
key=ApacheKafkaClusterLink.key,
|
56
|
-
value={
|
57
|
-
"location": task_instance.location,
|
58
|
-
"cluster_id": cluster_id,
|
59
|
-
"project_id": task_instance.project_id,
|
60
|
-
},
|
61
|
-
)
|
62
|
-
|
63
42
|
|
64
43
|
class ApacheKafkaClusterListLink(BaseGoogleLink):
|
65
44
|
"""Helper class for constructing Apache Kafka Clusters link."""
|
@@ -68,19 +47,6 @@ class ApacheKafkaClusterListLink(BaseGoogleLink):
|
|
68
47
|
key = "cluster_list_conf"
|
69
48
|
format_str = MANAGED_KAFKA_CLUSTER_LIST_LINK
|
70
49
|
|
71
|
-
@staticmethod
|
72
|
-
def persist(
|
73
|
-
context: Context,
|
74
|
-
task_instance,
|
75
|
-
):
|
76
|
-
task_instance.xcom_push(
|
77
|
-
context=context,
|
78
|
-
key=ApacheKafkaClusterListLink.key,
|
79
|
-
value={
|
80
|
-
"project_id": task_instance.project_id,
|
81
|
-
},
|
82
|
-
)
|
83
|
-
|
84
50
|
|
85
51
|
class ApacheKafkaTopicLink(BaseGoogleLink):
|
86
52
|
"""Helper class for constructing Apache Kafka Topic link."""
|
@@ -89,24 +55,6 @@ class ApacheKafkaTopicLink(BaseGoogleLink):
|
|
89
55
|
key = "topic_conf"
|
90
56
|
format_str = MANAGED_KAFKA_TOPIC_LINK
|
91
57
|
|
92
|
-
@staticmethod
|
93
|
-
def persist(
|
94
|
-
context: Context,
|
95
|
-
task_instance,
|
96
|
-
cluster_id: str,
|
97
|
-
topic_id: str,
|
98
|
-
):
|
99
|
-
task_instance.xcom_push(
|
100
|
-
context=context,
|
101
|
-
key=ApacheKafkaTopicLink.key,
|
102
|
-
value={
|
103
|
-
"location": task_instance.location,
|
104
|
-
"cluster_id": cluster_id,
|
105
|
-
"topic_id": topic_id,
|
106
|
-
"project_id": task_instance.project_id,
|
107
|
-
},
|
108
|
-
)
|
109
|
-
|
110
58
|
|
111
59
|
class ApacheKafkaConsumerGroupLink(BaseGoogleLink):
|
112
60
|
"""Helper class for constructing Apache Kafka Consumer Group link."""
|
@@ -114,21 +62,3 @@ class ApacheKafkaConsumerGroupLink(BaseGoogleLink):
|
|
114
62
|
name = "Apache Kafka Consumer Group"
|
115
63
|
key = "consumer_group_conf"
|
116
64
|
format_str = MANAGED_KAFKA_CONSUMER_GROUP_LINK
|
117
|
-
|
118
|
-
@staticmethod
|
119
|
-
def persist(
|
120
|
-
context: Context,
|
121
|
-
task_instance,
|
122
|
-
cluster_id: str,
|
123
|
-
consumer_group_id: str,
|
124
|
-
):
|
125
|
-
task_instance.xcom_push(
|
126
|
-
context=context,
|
127
|
-
key=ApacheKafkaConsumerGroupLink.key,
|
128
|
-
value={
|
129
|
-
"location": task_instance.location,
|
130
|
-
"cluster_id": cluster_id,
|
131
|
-
"consumer_group_id": consumer_group_id,
|
132
|
-
"project_id": task_instance.project_id,
|
133
|
-
},
|
134
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.utils.context import Context
|
28
|
-
|
29
|
-
|
30
24
|
MLENGINE_BASE_LINK = "https://console.cloud.google.com/ai-platform"
|
31
25
|
MLENGINE_MODEL_DETAILS_LINK = MLENGINE_BASE_LINK + "/models/{model_id}/versions?project={project_id}"
|
32
26
|
MLENGINE_MODEL_VERSION_DETAILS_LINK = (
|
@@ -44,19 +38,6 @@ class MLEngineModelLink(BaseGoogleLink):
|
|
44
38
|
key = "ml_engine_model"
|
45
39
|
format_str = MLENGINE_MODEL_DETAILS_LINK
|
46
40
|
|
47
|
-
@staticmethod
|
48
|
-
def persist(
|
49
|
-
context: Context,
|
50
|
-
task_instance,
|
51
|
-
model_id: str,
|
52
|
-
project_id: str,
|
53
|
-
):
|
54
|
-
task_instance.xcom_push(
|
55
|
-
context,
|
56
|
-
key=MLEngineModelLink.key,
|
57
|
-
value={"model_id": model_id, "project_id": project_id},
|
58
|
-
)
|
59
|
-
|
60
41
|
|
61
42
|
class MLEngineModelsListLink(BaseGoogleLink):
|
62
43
|
"""Helper class for constructing ML Engine link."""
|
@@ -65,18 +46,6 @@ class MLEngineModelsListLink(BaseGoogleLink):
|
|
65
46
|
key = "ml_engine_models_list"
|
66
47
|
format_str = MLENGINE_MODELS_LIST_LINK
|
67
48
|
|
68
|
-
@staticmethod
|
69
|
-
def persist(
|
70
|
-
context: Context,
|
71
|
-
task_instance,
|
72
|
-
project_id: str,
|
73
|
-
):
|
74
|
-
task_instance.xcom_push(
|
75
|
-
context,
|
76
|
-
key=MLEngineModelsListLink.key,
|
77
|
-
value={"project_id": project_id},
|
78
|
-
)
|
79
|
-
|
80
49
|
|
81
50
|
class MLEngineJobDetailsLink(BaseGoogleLink):
|
82
51
|
"""Helper class for constructing ML Engine link."""
|
@@ -85,19 +54,6 @@ class MLEngineJobDetailsLink(BaseGoogleLink):
|
|
85
54
|
key = "ml_engine_job_details"
|
86
55
|
format_str = MLENGINE_JOB_DETAILS_LINK
|
87
56
|
|
88
|
-
@staticmethod
|
89
|
-
def persist(
|
90
|
-
context: Context,
|
91
|
-
task_instance,
|
92
|
-
job_id: str,
|
93
|
-
project_id: str,
|
94
|
-
):
|
95
|
-
task_instance.xcom_push(
|
96
|
-
context,
|
97
|
-
key=MLEngineJobDetailsLink.key,
|
98
|
-
value={"job_id": job_id, "project_id": project_id},
|
99
|
-
)
|
100
|
-
|
101
57
|
|
102
58
|
class MLEngineModelVersionDetailsLink(BaseGoogleLink):
|
103
59
|
"""Helper class for constructing ML Engine link."""
|
@@ -106,20 +62,6 @@ class MLEngineModelVersionDetailsLink(BaseGoogleLink):
|
|
106
62
|
key = "ml_engine_version_details"
|
107
63
|
format_str = MLENGINE_MODEL_VERSION_DETAILS_LINK
|
108
64
|
|
109
|
-
@staticmethod
|
110
|
-
def persist(
|
111
|
-
context: Context,
|
112
|
-
task_instance,
|
113
|
-
model_id: str,
|
114
|
-
project_id: str,
|
115
|
-
version_id: str,
|
116
|
-
):
|
117
|
-
task_instance.xcom_push(
|
118
|
-
context,
|
119
|
-
key=MLEngineModelVersionDetailsLink.key,
|
120
|
-
value={"model_id": model_id, "project_id": project_id, "version_id": version_id},
|
121
|
-
)
|
122
|
-
|
123
65
|
|
124
66
|
class MLEngineJobSListLink(BaseGoogleLink):
|
125
67
|
"""Helper class for constructing ML Engine link."""
|
@@ -127,15 +69,3 @@ class MLEngineJobSListLink(BaseGoogleLink):
|
|
127
69
|
name = "MLEngine Jobs List"
|
128
70
|
key = "ml_engine_jobs_list"
|
129
71
|
format_str = MLENGINE_JOBS_LIST_LINK
|
130
|
-
|
131
|
-
@staticmethod
|
132
|
-
def persist(
|
133
|
-
context: Context,
|
134
|
-
task_instance,
|
135
|
-
project_id: str,
|
136
|
-
):
|
137
|
-
task_instance.xcom_push(
|
138
|
-
context,
|
139
|
-
key=MLEngineJobSListLink.key,
|
140
|
-
value={"project_id": project_id},
|
141
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
PUBSUB_BASE_LINK = "/cloudpubsub"
|
31
25
|
PUBSUB_TOPIC_LINK = PUBSUB_BASE_LINK + "/topic/detail/{topic_id}?project={project_id}"
|
32
26
|
PUBSUB_SUBSCRIPTION_LINK = PUBSUB_BASE_LINK + "/subscription/detail/{subscription_id}?project={project_id}"
|
@@ -39,19 +33,6 @@ class PubSubTopicLink(BaseGoogleLink):
|
|
39
33
|
key = "pubsub_topic"
|
40
34
|
format_str = PUBSUB_TOPIC_LINK
|
41
35
|
|
42
|
-
@staticmethod
|
43
|
-
def persist(
|
44
|
-
context: Context,
|
45
|
-
task_instance: BaseOperator,
|
46
|
-
topic_id: str,
|
47
|
-
project_id: str | None,
|
48
|
-
):
|
49
|
-
task_instance.xcom_push(
|
50
|
-
context,
|
51
|
-
key=PubSubTopicLink.key,
|
52
|
-
value={"topic_id": topic_id, "project_id": project_id},
|
53
|
-
)
|
54
|
-
|
55
36
|
|
56
37
|
class PubSubSubscriptionLink(BaseGoogleLink):
|
57
38
|
"""Helper class for constructing Pub/Sub Subscription Link."""
|
@@ -59,16 +40,3 @@ class PubSubSubscriptionLink(BaseGoogleLink):
|
|
59
40
|
name = "Pub/Sub Subscription"
|
60
41
|
key = "pubsub_subscription"
|
61
42
|
format_str = PUBSUB_SUBSCRIPTION_LINK
|
62
|
-
|
63
|
-
@staticmethod
|
64
|
-
def persist(
|
65
|
-
context: Context,
|
66
|
-
task_instance: BaseOperator,
|
67
|
-
subscription_id: str | None,
|
68
|
-
project_id: str | None,
|
69
|
-
):
|
70
|
-
task_instance.xcom_push(
|
71
|
-
context,
|
72
|
-
key=PubSubSubscriptionLink.key,
|
73
|
-
value={"subscription_id": subscription_id, "project_id": project_id},
|
74
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
SPANNER_BASE_LINK = "/spanner/instances"
|
31
25
|
SPANNER_INSTANCE_LINK = SPANNER_BASE_LINK + "/{instance_id}/details/databases?project={project_id}"
|
32
26
|
SPANNER_DATABASE_LINK = (
|
@@ -41,19 +35,6 @@ class SpannerInstanceLink(BaseGoogleLink):
|
|
41
35
|
key = "spanner_instance"
|
42
36
|
format_str = SPANNER_INSTANCE_LINK
|
43
37
|
|
44
|
-
@staticmethod
|
45
|
-
def persist(
|
46
|
-
context: Context,
|
47
|
-
task_instance: BaseOperator,
|
48
|
-
instance_id: str,
|
49
|
-
project_id: str | None,
|
50
|
-
):
|
51
|
-
task_instance.xcom_push(
|
52
|
-
context,
|
53
|
-
key=SpannerInstanceLink.key,
|
54
|
-
value={"instance_id": instance_id, "project_id": project_id},
|
55
|
-
)
|
56
|
-
|
57
38
|
|
58
39
|
class SpannerDatabaseLink(BaseGoogleLink):
|
59
40
|
"""Helper class for constructing Spanner Database Link."""
|
@@ -61,17 +42,3 @@ class SpannerDatabaseLink(BaseGoogleLink):
|
|
61
42
|
name = "Spanner Database"
|
62
43
|
key = "spanner_database"
|
63
44
|
format_str = SPANNER_DATABASE_LINK
|
64
|
-
|
65
|
-
@staticmethod
|
66
|
-
def persist(
|
67
|
-
context: Context,
|
68
|
-
task_instance: BaseOperator,
|
69
|
-
instance_id: str,
|
70
|
-
database_id: str,
|
71
|
-
project_id: str | None,
|
72
|
-
):
|
73
|
-
task_instance.xcom_push(
|
74
|
-
context,
|
75
|
-
key=SpannerDatabaseLink.key,
|
76
|
-
value={"instance_id": instance_id, "database_id": database_id, "project_id": project_id},
|
77
|
-
)
|
@@ -19,14 +19,8 @@
|
|
19
19
|
|
20
20
|
from __future__ import annotations
|
21
21
|
|
22
|
-
from typing import TYPE_CHECKING
|
23
|
-
|
24
22
|
from airflow.providers.google.cloud.links.base import BaseGoogleLink
|
25
23
|
|
26
|
-
if TYPE_CHECKING:
|
27
|
-
from airflow.models import BaseOperator
|
28
|
-
from airflow.utils.context import Context
|
29
|
-
|
30
24
|
STACKDRIVER_BASE_LINK = "/monitoring/alerting"
|
31
25
|
STACKDRIVER_NOTIFICATIONS_LINK = STACKDRIVER_BASE_LINK + "/notifications?project={project_id}"
|
32
26
|
STACKDRIVER_POLICIES_LINK = STACKDRIVER_BASE_LINK + "/policies?project={project_id}"
|
@@ -39,18 +33,6 @@ class StackdriverNotificationsLink(BaseGoogleLink):
|
|
39
33
|
key = "stackdriver_notifications"
|
40
34
|
format_str = STACKDRIVER_NOTIFICATIONS_LINK
|
41
35
|
|
42
|
-
@staticmethod
|
43
|
-
def persist(
|
44
|
-
operator_instance: BaseOperator,
|
45
|
-
context: Context,
|
46
|
-
project_id: str | None,
|
47
|
-
):
|
48
|
-
operator_instance.xcom_push(
|
49
|
-
context,
|
50
|
-
key=StackdriverNotificationsLink.key,
|
51
|
-
value={"project_id": project_id},
|
52
|
-
)
|
53
|
-
|
54
36
|
|
55
37
|
class StackdriverPoliciesLink(BaseGoogleLink):
|
56
38
|
"""Helper class for constructing Stackdriver Policies Link."""
|
@@ -58,15 +40,3 @@ class StackdriverPoliciesLink(BaseGoogleLink):
|
|
58
40
|
name = "Cloud Monitoring Policies"
|
59
41
|
key = "stackdriver_policies"
|
60
42
|
format_str = STACKDRIVER_POLICIES_LINK
|
61
|
-
|
62
|
-
@staticmethod
|
63
|
-
def persist(
|
64
|
-
operator_instance: BaseOperator,
|
65
|
-
context: Context,
|
66
|
-
project_id: str | None,
|
67
|
-
):
|
68
|
-
operator_instance.xcom_push(
|
69
|
-
context,
|
70
|
-
key=StackdriverPoliciesLink.key,
|
71
|
-
value={"project_id": project_id},
|
72
|
-
)
|
@@ -70,19 +70,6 @@ class TranslationLegacyDatasetLink(BaseGoogleLink):
|
|
70
70
|
key = "translation_legacy_dataset"
|
71
71
|
format_str = TRANSLATION_LEGACY_DATASET_LINK
|
72
72
|
|
73
|
-
@staticmethod
|
74
|
-
def persist(
|
75
|
-
context: Context,
|
76
|
-
task_instance,
|
77
|
-
dataset_id: str,
|
78
|
-
project_id: str,
|
79
|
-
):
|
80
|
-
task_instance.xcom_push(
|
81
|
-
context,
|
82
|
-
key=TranslationLegacyDatasetLink.key,
|
83
|
-
value={"location": task_instance.location, "dataset_id": dataset_id, "project_id": project_id},
|
84
|
-
)
|
85
|
-
|
86
73
|
|
87
74
|
class TranslationDatasetListLink(BaseGoogleLink):
|
88
75
|
"""Helper class for constructing Translation Dataset List link."""
|
@@ -91,20 +78,6 @@ class TranslationDatasetListLink(BaseGoogleLink):
|
|
91
78
|
key = "translation_dataset_list"
|
92
79
|
format_str = TRANSLATION_DATASET_LIST_LINK
|
93
80
|
|
94
|
-
@staticmethod
|
95
|
-
def persist(
|
96
|
-
context: Context,
|
97
|
-
task_instance,
|
98
|
-
project_id: str,
|
99
|
-
):
|
100
|
-
task_instance.xcom_push(
|
101
|
-
context,
|
102
|
-
key=TranslationDatasetListLink.key,
|
103
|
-
value={
|
104
|
-
"project_id": project_id,
|
105
|
-
},
|
106
|
-
)
|
107
|
-
|
108
81
|
|
109
82
|
class TranslationLegacyModelLink(BaseGoogleLink):
|
110
83
|
"""
|
@@ -117,25 +90,6 @@ class TranslationLegacyModelLink(BaseGoogleLink):
|
|
117
90
|
key = "translation_legacy_model"
|
118
91
|
format_str = TRANSLATION_LEGACY_MODEL_LINK
|
119
92
|
|
120
|
-
@staticmethod
|
121
|
-
def persist(
|
122
|
-
context: Context,
|
123
|
-
task_instance,
|
124
|
-
dataset_id: str,
|
125
|
-
model_id: str,
|
126
|
-
project_id: str,
|
127
|
-
):
|
128
|
-
task_instance.xcom_push(
|
129
|
-
context,
|
130
|
-
key=TranslationLegacyModelLink.key,
|
131
|
-
value={
|
132
|
-
"location": task_instance.location,
|
133
|
-
"dataset_id": dataset_id,
|
134
|
-
"model_id": model_id,
|
135
|
-
"project_id": project_id,
|
136
|
-
},
|
137
|
-
)
|
138
|
-
|
139
93
|
|
140
94
|
class TranslationLegacyModelTrainLink(BaseGoogleLink):
|
141
95
|
"""
|
@@ -148,22 +102,6 @@ class TranslationLegacyModelTrainLink(BaseGoogleLink):
|
|
148
102
|
key = "translation_legacy_model_train"
|
149
103
|
format_str = TRANSLATION_LEGACY_MODEL_TRAIN_LINK
|
150
104
|
|
151
|
-
@staticmethod
|
152
|
-
def persist(
|
153
|
-
context: Context,
|
154
|
-
task_instance,
|
155
|
-
project_id: str,
|
156
|
-
):
|
157
|
-
task_instance.xcom_push(
|
158
|
-
context,
|
159
|
-
key=TranslationLegacyModelTrainLink.key,
|
160
|
-
value={
|
161
|
-
"location": task_instance.location,
|
162
|
-
"dataset_id": task_instance.model["dataset_id"],
|
163
|
-
"project_id": project_id,
|
164
|
-
},
|
165
|
-
)
|
166
|
-
|
167
105
|
|
168
106
|
class TranslationLegacyModelPredictLink(BaseGoogleLink):
|
169
107
|
"""
|
@@ -176,25 +114,6 @@ class TranslationLegacyModelPredictLink(BaseGoogleLink):
|
|
176
114
|
key = "translation_legacy_model_predict"
|
177
115
|
format_str = TRANSLATION_LEGACY_MODEL_PREDICT_LINK
|
178
116
|
|
179
|
-
@staticmethod
|
180
|
-
def persist(
|
181
|
-
context: Context,
|
182
|
-
task_instance,
|
183
|
-
model_id: str,
|
184
|
-
project_id: str,
|
185
|
-
dataset_id: str,
|
186
|
-
):
|
187
|
-
task_instance.xcom_push(
|
188
|
-
context,
|
189
|
-
key=TranslationLegacyModelPredictLink.key,
|
190
|
-
value={
|
191
|
-
"location": task_instance.location,
|
192
|
-
"dataset_id": dataset_id,
|
193
|
-
"model_id": model_id,
|
194
|
-
"project_id": project_id,
|
195
|
-
},
|
196
|
-
)
|
197
|
-
|
198
117
|
|
199
118
|
class TranslateTextBatchLink(BaseGoogleLink):
|
200
119
|
"""
|
@@ -212,20 +131,13 @@ class TranslateTextBatchLink(BaseGoogleLink):
|
|
212
131
|
def extract_output_uri_prefix(output_config):
|
213
132
|
return output_config["gcs_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
|
214
133
|
|
215
|
-
@
|
216
|
-
def persist(
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
task_instance.xcom_push(
|
223
|
-
context,
|
224
|
-
key=TranslateTextBatchLink.key,
|
225
|
-
value={
|
226
|
-
"project_id": project_id,
|
227
|
-
"output_uri_prefix": TranslateTextBatchLink.extract_output_uri_prefix(output_config),
|
228
|
-
},
|
134
|
+
@classmethod
|
135
|
+
def persist(cls, context: Context, **value):
|
136
|
+
output_config = value.get("output_config")
|
137
|
+
super().persist(
|
138
|
+
context=context,
|
139
|
+
project_id=value.get("project_id"),
|
140
|
+
output_uri_prefix=cls.extract_output_uri_prefix(output_config),
|
229
141
|
)
|
230
142
|
|
231
143
|
|
@@ -237,22 +149,9 @@ class TranslationNativeDatasetLink(BaseGoogleLink):
|
|
237
149
|
"""
|
238
150
|
|
239
151
|
name = "Translation Native Dataset"
|
240
|
-
key = "
|
152
|
+
key = "translation_native_dataset"
|
241
153
|
format_str = TRANSLATION_NATIVE_DATASET_LINK
|
242
154
|
|
243
|
-
@staticmethod
|
244
|
-
def persist(
|
245
|
-
context: Context,
|
246
|
-
task_instance,
|
247
|
-
dataset_id: str,
|
248
|
-
project_id: str,
|
249
|
-
):
|
250
|
-
task_instance.xcom_push(
|
251
|
-
context,
|
252
|
-
key=TranslationNativeDatasetLink.key,
|
253
|
-
value={"location": task_instance.location, "dataset_id": dataset_id, "project_id": project_id},
|
254
|
-
)
|
255
|
-
|
256
155
|
|
257
156
|
class TranslationDatasetsListLink(BaseGoogleLink):
|
258
157
|
"""
|
@@ -265,20 +164,6 @@ class TranslationDatasetsListLink(BaseGoogleLink):
|
|
265
164
|
key = "translation_dataset_list"
|
266
165
|
format_str = TRANSLATION_DATASET_LIST_LINK
|
267
166
|
|
268
|
-
@staticmethod
|
269
|
-
def persist(
|
270
|
-
context: Context,
|
271
|
-
task_instance,
|
272
|
-
project_id: str,
|
273
|
-
):
|
274
|
-
task_instance.xcom_push(
|
275
|
-
context,
|
276
|
-
key=TranslationDatasetsListLink.key,
|
277
|
-
value={
|
278
|
-
"project_id": project_id,
|
279
|
-
},
|
280
|
-
)
|
281
|
-
|
282
167
|
|
283
168
|
class TranslationModelLink(BaseGoogleLink):
|
284
169
|
"""
|
@@ -291,25 +176,6 @@ class TranslationModelLink(BaseGoogleLink):
|
|
291
176
|
key = "translation_model"
|
292
177
|
format_str = TRANSLATION_NATIVE_MODEL_LINK
|
293
178
|
|
294
|
-
@staticmethod
|
295
|
-
def persist(
|
296
|
-
context: Context,
|
297
|
-
task_instance,
|
298
|
-
dataset_id: str,
|
299
|
-
model_id: str,
|
300
|
-
project_id: str,
|
301
|
-
):
|
302
|
-
task_instance.xcom_push(
|
303
|
-
context,
|
304
|
-
key=TranslationLegacyModelLink.key,
|
305
|
-
value={
|
306
|
-
"location": task_instance.location,
|
307
|
-
"dataset_id": dataset_id,
|
308
|
-
"model_id": model_id,
|
309
|
-
"project_id": project_id,
|
310
|
-
},
|
311
|
-
)
|
312
|
-
|
313
179
|
|
314
180
|
class TranslationModelsListLink(BaseGoogleLink):
|
315
181
|
"""
|
@@ -322,20 +188,6 @@ class TranslationModelsListLink(BaseGoogleLink):
|
|
322
188
|
key = "translation_models_list"
|
323
189
|
format_str = TRANSLATION_MODELS_LIST_LINK
|
324
190
|
|
325
|
-
@staticmethod
|
326
|
-
def persist(
|
327
|
-
context: Context,
|
328
|
-
task_instance,
|
329
|
-
project_id: str,
|
330
|
-
):
|
331
|
-
task_instance.xcom_push(
|
332
|
-
context,
|
333
|
-
key=TranslationModelsListLink.key,
|
334
|
-
value={
|
335
|
-
"project_id": project_id,
|
336
|
-
},
|
337
|
-
)
|
338
|
-
|
339
191
|
|
340
192
|
class TranslateResultByOutputConfigLink(BaseGoogleLink):
|
341
193
|
"""
|
@@ -353,22 +205,14 @@ class TranslateResultByOutputConfigLink(BaseGoogleLink):
|
|
353
205
|
def extract_output_uri_prefix(output_config):
|
354
206
|
return output_config["gcs_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
|
355
207
|
|
356
|
-
@
|
357
|
-
def persist(
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
context,
|
365
|
-
key=TranslateResultByOutputConfigLink.key,
|
366
|
-
value={
|
367
|
-
"project_id": project_id,
|
368
|
-
"output_uri_prefix": TranslateResultByOutputConfigLink.extract_output_uri_prefix(
|
369
|
-
output_config
|
370
|
-
),
|
371
|
-
},
|
208
|
+
@classmethod
|
209
|
+
def persist(cls, context: Context, **value):
|
210
|
+
output_config = value.get("output_config")
|
211
|
+
output_uri_prefix = cls.extract_output_uri_prefix(output_config)
|
212
|
+
super().persist(
|
213
|
+
context=context,
|
214
|
+
project_id=value.get("project_id"),
|
215
|
+
output_uri_prefix=output_uri_prefix,
|
372
216
|
)
|
373
217
|
|
374
218
|
|
@@ -382,17 +226,3 @@ class TranslationGlossariesListLink(BaseGoogleLink):
|
|
382
226
|
name = "Translation Glossaries List"
|
383
227
|
key = "translation_glossaries_list"
|
384
228
|
format_str = TRANSLATION_HUB_RESOURCES_LIST_LINK
|
385
|
-
|
386
|
-
@staticmethod
|
387
|
-
def persist(
|
388
|
-
context: Context,
|
389
|
-
task_instance,
|
390
|
-
project_id: str,
|
391
|
-
):
|
392
|
-
task_instance.xcom_push(
|
393
|
-
context,
|
394
|
-
key=TranslationGlossariesListLink.key,
|
395
|
-
value={
|
396
|
-
"project_id": project_id,
|
397
|
-
},
|
398
|
-
)
|