apache-airflow-providers-google 16.0.0rc1__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.
Files changed (166) hide show
  1. airflow/providers/google/__init__.py +1 -1
  2. airflow/providers/google/ads/hooks/ads.py +9 -5
  3. airflow/providers/google/ads/operators/ads.py +1 -1
  4. airflow/providers/google/ads/transfers/ads_to_gcs.py +1 -1
  5. airflow/providers/google/cloud/hooks/bigquery.py +2 -3
  6. airflow/providers/google/cloud/hooks/cloud_sql.py +8 -4
  7. airflow/providers/google/cloud/hooks/datacatalog.py +9 -1
  8. airflow/providers/google/cloud/hooks/dataflow.py +2 -2
  9. airflow/providers/google/cloud/hooks/dataplex.py +1 -1
  10. airflow/providers/google/cloud/hooks/dataprep.py +4 -1
  11. airflow/providers/google/cloud/hooks/gcs.py +2 -2
  12. airflow/providers/google/cloud/hooks/looker.py +5 -1
  13. airflow/providers/google/cloud/hooks/mlengine.py +2 -1
  14. airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
  15. airflow/providers/google/cloud/hooks/spanner.py +2 -2
  16. airflow/providers/google/cloud/hooks/translate.py +1 -1
  17. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +307 -7
  18. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +43 -14
  19. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +11 -2
  20. airflow/providers/google/cloud/hooks/vision.py +2 -2
  21. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  22. airflow/providers/google/cloud/links/base.py +75 -11
  23. airflow/providers/google/cloud/links/bigquery.py +0 -47
  24. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  25. airflow/providers/google/cloud/links/bigtable.py +0 -48
  26. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  27. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  28. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  29. airflow/providers/google/cloud/links/cloud_run.py +1 -33
  30. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  31. airflow/providers/google/cloud/links/cloud_storage_transfer.py +16 -43
  32. airflow/providers/google/cloud/links/cloud_tasks.py +6 -25
  33. airflow/providers/google/cloud/links/compute.py +0 -58
  34. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  35. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  36. airflow/providers/google/cloud/links/dataflow.py +0 -34
  37. airflow/providers/google/cloud/links/dataform.py +0 -64
  38. airflow/providers/google/cloud/links/datafusion.py +1 -96
  39. airflow/providers/google/cloud/links/dataplex.py +0 -154
  40. airflow/providers/google/cloud/links/dataprep.py +0 -24
  41. airflow/providers/google/cloud/links/dataproc.py +14 -90
  42. airflow/providers/google/cloud/links/datastore.py +0 -31
  43. airflow/providers/google/cloud/links/kubernetes_engine.py +5 -59
  44. airflow/providers/google/cloud/links/life_sciences.py +0 -19
  45. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  46. airflow/providers/google/cloud/links/mlengine.py +0 -70
  47. airflow/providers/google/cloud/links/pubsub.py +0 -32
  48. airflow/providers/google/cloud/links/spanner.py +0 -33
  49. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  50. airflow/providers/google/cloud/links/translate.py +16 -186
  51. airflow/providers/google/cloud/links/vertex_ai.py +8 -224
  52. airflow/providers/google/cloud/links/workflows.py +0 -52
  53. airflow/providers/google/cloud/operators/alloy_db.py +69 -54
  54. airflow/providers/google/cloud/operators/automl.py +16 -14
  55. airflow/providers/google/cloud/operators/bigquery.py +0 -15
  56. airflow/providers/google/cloud/operators/bigquery_dts.py +2 -4
  57. airflow/providers/google/cloud/operators/bigtable.py +35 -6
  58. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  59. airflow/providers/google/cloud/operators/cloud_build.py +74 -31
  60. airflow/providers/google/cloud/operators/cloud_composer.py +34 -35
  61. airflow/providers/google/cloud/operators/cloud_memorystore.py +68 -42
  62. airflow/providers/google/cloud/operators/cloud_run.py +0 -1
  63. airflow/providers/google/cloud/operators/cloud_sql.py +11 -15
  64. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +0 -2
  65. airflow/providers/google/cloud/operators/compute.py +7 -39
  66. airflow/providers/google/cloud/operators/datacatalog.py +156 -20
  67. airflow/providers/google/cloud/operators/dataflow.py +37 -14
  68. airflow/providers/google/cloud/operators/dataform.py +14 -4
  69. airflow/providers/google/cloud/operators/datafusion.py +4 -12
  70. airflow/providers/google/cloud/operators/dataplex.py +180 -96
  71. airflow/providers/google/cloud/operators/dataprep.py +0 -4
  72. airflow/providers/google/cloud/operators/dataproc.py +10 -16
  73. airflow/providers/google/cloud/operators/dataproc_metastore.py +95 -87
  74. airflow/providers/google/cloud/operators/datastore.py +21 -5
  75. airflow/providers/google/cloud/operators/dlp.py +3 -26
  76. airflow/providers/google/cloud/operators/functions.py +15 -6
  77. airflow/providers/google/cloud/operators/gcs.py +0 -7
  78. airflow/providers/google/cloud/operators/kubernetes_engine.py +50 -7
  79. airflow/providers/google/cloud/operators/life_sciences.py +0 -1
  80. airflow/providers/google/cloud/operators/managed_kafka.py +106 -51
  81. airflow/providers/google/cloud/operators/mlengine.py +0 -1
  82. airflow/providers/google/cloud/operators/pubsub.py +2 -4
  83. airflow/providers/google/cloud/operators/spanner.py +0 -4
  84. airflow/providers/google/cloud/operators/speech_to_text.py +0 -1
  85. airflow/providers/google/cloud/operators/stackdriver.py +0 -8
  86. airflow/providers/google/cloud/operators/tasks.py +0 -11
  87. airflow/providers/google/cloud/operators/text_to_speech.py +0 -1
  88. airflow/providers/google/cloud/operators/translate.py +37 -13
  89. airflow/providers/google/cloud/operators/translate_speech.py +0 -1
  90. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +31 -18
  91. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +28 -8
  92. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +38 -25
  93. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +69 -7
  94. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +42 -8
  95. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +531 -0
  96. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +93 -25
  97. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +10 -8
  98. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +56 -10
  99. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +25 -6
  100. airflow/providers/google/cloud/operators/vertex_ai/ray.py +9 -6
  101. airflow/providers/google/cloud/operators/workflows.py +1 -9
  102. airflow/providers/google/cloud/sensors/bigquery.py +1 -1
  103. airflow/providers/google/cloud/sensors/bigquery_dts.py +6 -1
  104. airflow/providers/google/cloud/sensors/bigtable.py +15 -3
  105. airflow/providers/google/cloud/sensors/cloud_composer.py +6 -1
  106. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +6 -1
  107. airflow/providers/google/cloud/sensors/dataflow.py +3 -3
  108. airflow/providers/google/cloud/sensors/dataform.py +6 -1
  109. airflow/providers/google/cloud/sensors/datafusion.py +6 -1
  110. airflow/providers/google/cloud/sensors/dataplex.py +6 -1
  111. airflow/providers/google/cloud/sensors/dataprep.py +6 -1
  112. airflow/providers/google/cloud/sensors/dataproc.py +6 -1
  113. airflow/providers/google/cloud/sensors/dataproc_metastore.py +6 -1
  114. airflow/providers/google/cloud/sensors/gcs.py +9 -3
  115. airflow/providers/google/cloud/sensors/looker.py +6 -1
  116. airflow/providers/google/cloud/sensors/pubsub.py +8 -3
  117. airflow/providers/google/cloud/sensors/tasks.py +6 -1
  118. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +6 -1
  119. airflow/providers/google/cloud/sensors/workflows.py +6 -1
  120. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +1 -1
  121. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +1 -1
  122. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +1 -2
  123. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +1 -2
  124. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +0 -1
  125. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -1
  126. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  127. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +1 -1
  128. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
  129. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +1 -2
  130. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +1 -1
  131. airflow/providers/google/cloud/transfers/gcs_to_local.py +1 -1
  132. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +1 -1
  133. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +5 -1
  134. airflow/providers/google/cloud/transfers/gdrive_to_local.py +1 -1
  135. airflow/providers/google/cloud/transfers/http_to_gcs.py +1 -1
  136. airflow/providers/google/cloud/transfers/local_to_gcs.py +1 -1
  137. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +1 -1
  138. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +1 -1
  139. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +2 -2
  140. airflow/providers/google/cloud/transfers/sql_to_gcs.py +1 -1
  141. airflow/providers/google/cloud/utils/field_validator.py +1 -2
  142. airflow/providers/google/common/auth_backend/google_openid.py +2 -1
  143. airflow/providers/google/common/deprecated.py +2 -1
  144. airflow/providers/google/common/hooks/base_google.py +7 -3
  145. airflow/providers/google/common/links/storage.py +0 -22
  146. airflow/providers/google/firebase/operators/firestore.py +1 -1
  147. airflow/providers/google/get_provider_info.py +0 -11
  148. airflow/providers/google/leveldb/hooks/leveldb.py +5 -1
  149. airflow/providers/google/leveldb/operators/leveldb.py +1 -1
  150. airflow/providers/google/marketing_platform/links/analytics_admin.py +3 -6
  151. airflow/providers/google/marketing_platform/operators/analytics_admin.py +0 -1
  152. airflow/providers/google/marketing_platform/operators/campaign_manager.py +4 -4
  153. airflow/providers/google/marketing_platform/operators/display_video.py +6 -6
  154. airflow/providers/google/marketing_platform/operators/search_ads.py +1 -1
  155. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +6 -1
  156. airflow/providers/google/marketing_platform/sensors/display_video.py +6 -1
  157. airflow/providers/google/suite/operators/sheets.py +3 -3
  158. airflow/providers/google/suite/sensors/drive.py +6 -1
  159. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +1 -1
  160. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  161. airflow/providers/google/suite/transfers/local_to_drive.py +1 -1
  162. airflow/providers/google/version_compat.py +28 -0
  163. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/METADATA +27 -28
  164. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/RECORD +166 -166
  165. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/WHEEL +0 -0
  166. {apache_airflow_providers_google-16.0.0rc1.dist-info → apache_airflow_providers_google-16.1.0.dist-info}/entry_points.txt +0 -0
@@ -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
- @staticmethod
216
- def persist(
217
- context: Context,
218
- task_instance,
219
- project_id: str,
220
- output_config: dict,
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 = "translation_naive_dataset"
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
- @staticmethod
357
- def persist(
358
- context: Context,
359
- task_instance,
360
- project_id: str,
361
- output_config: dict,
362
- ):
363
- task_instance.xcom_push(
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
- )
@@ -67,22 +67,6 @@ class VertexAIModelLink(BaseGoogleLink):
67
67
  key = "model_conf"
68
68
  format_str = VERTEX_AI_MODEL_LINK
69
69
 
70
- @staticmethod
71
- def persist(
72
- context: Context,
73
- task_instance,
74
- model_id: str,
75
- ):
76
- task_instance.xcom_push(
77
- context=context,
78
- key=VertexAIModelLink.key,
79
- value={
80
- "model_id": model_id,
81
- "region": task_instance.region,
82
- "project_id": task_instance.project_id,
83
- },
84
- )
85
-
86
70
 
87
71
  class VertexAIModelListLink(BaseGoogleLink):
88
72
  """Helper class for constructing Vertex AI Models Link."""
@@ -91,19 +75,6 @@ class VertexAIModelListLink(BaseGoogleLink):
91
75
  key = "models_conf"
92
76
  format_str = VERTEX_AI_MODEL_LIST_LINK
93
77
 
94
- @staticmethod
95
- def persist(
96
- context: Context,
97
- task_instance,
98
- ):
99
- task_instance.xcom_push(
100
- context=context,
101
- key=VertexAIModelListLink.key,
102
- value={
103
- "project_id": task_instance.project_id,
104
- },
105
- )
106
-
107
78
 
108
79
  class VertexAIModelExportLink(BaseGoogleLink):
109
80
  """Helper class for constructing Vertex AI Model Export Link."""
@@ -117,19 +88,15 @@ class VertexAIModelExportLink(BaseGoogleLink):
117
88
  """Return bucket name from output configuration."""
118
89
  return config["artifact_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
119
90
 
120
- @staticmethod
121
- def persist(
122
- context: Context,
123
- task_instance,
124
- ):
125
- task_instance.xcom_push(
91
+ @classmethod
92
+ def persist(cls, context: Context, **value):
93
+ output_config = value.get("output_config")
94
+ bucket_name = cls.extract_bucket_name(output_config)
95
+ super().persist(
126
96
  context=context,
127
- key=VertexAIModelExportLink.key,
128
- value={
129
- "project_id": task_instance.project_id,
130
- "model_id": task_instance.model_id,
131
- "bucket_name": VertexAIModelExportLink.extract_bucket_name(task_instance.output_config),
132
- },
97
+ project_id=value.get("project_id"),
98
+ model_id=value.get("model_id"),
99
+ bucket_name=bucket_name,
133
100
  )
134
101
 
135
102
 
@@ -140,22 +107,6 @@ class VertexAITrainingLink(BaseGoogleLink):
140
107
  key = "training_conf"
141
108
  format_str = VERTEX_AI_TRAINING_LINK
142
109
 
143
- @staticmethod
144
- def persist(
145
- context: Context,
146
- task_instance,
147
- training_id: str,
148
- ):
149
- task_instance.xcom_push(
150
- context=context,
151
- key=VertexAITrainingLink.key,
152
- value={
153
- "training_id": training_id,
154
- "region": task_instance.region,
155
- "project_id": task_instance.project_id,
156
- },
157
- )
158
-
159
110
 
160
111
  class VertexAITrainingPipelinesLink(BaseGoogleLink):
161
112
  """Helper class for constructing Vertex AI Training Pipelines link."""
@@ -164,19 +115,6 @@ class VertexAITrainingPipelinesLink(BaseGoogleLink):
164
115
  key = "pipelines_conf"
165
116
  format_str = VERTEX_AI_TRAINING_PIPELINES_LINK
166
117
 
167
- @staticmethod
168
- def persist(
169
- context: Context,
170
- task_instance,
171
- ):
172
- task_instance.xcom_push(
173
- context=context,
174
- key=VertexAITrainingPipelinesLink.key,
175
- value={
176
- "project_id": task_instance.project_id,
177
- },
178
- )
179
-
180
118
 
181
119
  class VertexAIDatasetLink(BaseGoogleLink):
182
120
  """Helper class for constructing Vertex AI Dataset link."""
@@ -185,18 +123,6 @@ class VertexAIDatasetLink(BaseGoogleLink):
185
123
  key = "dataset_conf"
186
124
  format_str = VERTEX_AI_DATASET_LINK
187
125
 
188
- @staticmethod
189
- def persist(context: Context, task_instance, dataset_id: str):
190
- task_instance.xcom_push(
191
- context=context,
192
- key=VertexAIDatasetLink.key,
193
- value={
194
- "dataset_id": dataset_id,
195
- "region": task_instance.region,
196
- "project_id": task_instance.project_id,
197
- },
198
- )
199
-
200
126
 
201
127
  class VertexAIDatasetListLink(BaseGoogleLink):
202
128
  """Helper class for constructing Vertex AI Datasets Link."""
@@ -205,19 +131,6 @@ class VertexAIDatasetListLink(BaseGoogleLink):
205
131
  key = "datasets_conf"
206
132
  format_str = VERTEX_AI_DATASET_LIST_LINK
207
133
 
208
- @staticmethod
209
- def persist(
210
- context: Context,
211
- task_instance,
212
- ):
213
- task_instance.xcom_push(
214
- context=context,
215
- key=VertexAIDatasetListLink.key,
216
- value={
217
- "project_id": task_instance.project_id,
218
- },
219
- )
220
-
221
134
 
222
135
  class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
223
136
  """Helper class for constructing Vertex AI HyperparameterTuningJobs Link."""
@@ -226,19 +139,6 @@ class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
226
139
  key = "hyperparameter_tuning_jobs_conf"
227
140
  format_str = VERTEX_AI_HYPERPARAMETER_TUNING_JOB_LIST_LINK
228
141
 
229
- @staticmethod
230
- def persist(
231
- context: Context,
232
- task_instance,
233
- ):
234
- task_instance.xcom_push(
235
- context=context,
236
- key=VertexAIHyperparameterTuningJobListLink.key,
237
- value={
238
- "project_id": task_instance.project_id,
239
- },
240
- )
241
-
242
142
 
243
143
  class VertexAIBatchPredictionJobLink(BaseGoogleLink):
244
144
  """Helper class for constructing Vertex AI BatchPredictionJob link."""
@@ -247,22 +147,6 @@ class VertexAIBatchPredictionJobLink(BaseGoogleLink):
247
147
  key = "batch_prediction_job_conf"
248
148
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LINK
249
149
 
250
- @staticmethod
251
- def persist(
252
- context: Context,
253
- task_instance,
254
- batch_prediction_job_id: str,
255
- ):
256
- task_instance.xcom_push(
257
- context=context,
258
- key=VertexAIBatchPredictionJobLink.key,
259
- value={
260
- "batch_prediction_job_id": batch_prediction_job_id,
261
- "region": task_instance.region,
262
- "project_id": task_instance.project_id,
263
- },
264
- )
265
-
266
150
 
267
151
  class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
268
152
  """Helper class for constructing Vertex AI BatchPredictionJobList link."""
@@ -271,19 +155,6 @@ class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
271
155
  key = "batch_prediction_jobs_conf"
272
156
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LIST_LINK
273
157
 
274
- @staticmethod
275
- def persist(
276
- context: Context,
277
- task_instance,
278
- ):
279
- task_instance.xcom_push(
280
- context=context,
281
- key=VertexAIBatchPredictionJobListLink.key,
282
- value={
283
- "project_id": task_instance.project_id,
284
- },
285
- )
286
-
287
158
 
288
159
  class VertexAIEndpointLink(BaseGoogleLink):
289
160
  """Helper class for constructing Vertex AI Endpoint link."""
@@ -292,22 +163,6 @@ class VertexAIEndpointLink(BaseGoogleLink):
292
163
  key = "endpoint_conf"
293
164
  format_str = VERTEX_AI_ENDPOINT_LINK
294
165
 
295
- @staticmethod
296
- def persist(
297
- context: Context,
298
- task_instance,
299
- endpoint_id: str,
300
- ):
301
- task_instance.xcom_push(
302
- context=context,
303
- key=VertexAIEndpointLink.key,
304
- value={
305
- "endpoint_id": endpoint_id,
306
- "region": task_instance.region,
307
- "project_id": task_instance.project_id,
308
- },
309
- )
310
-
311
166
 
312
167
  class VertexAIEndpointListLink(BaseGoogleLink):
313
168
  """Helper class for constructing Vertex AI EndpointList link."""
@@ -316,19 +171,6 @@ class VertexAIEndpointListLink(BaseGoogleLink):
316
171
  key = "endpoints_conf"
317
172
  format_str = VERTEX_AI_ENDPOINT_LIST_LINK
318
173
 
319
- @staticmethod
320
- def persist(
321
- context: Context,
322
- task_instance,
323
- ):
324
- task_instance.xcom_push(
325
- context=context,
326
- key=VertexAIEndpointListLink.key,
327
- value={
328
- "project_id": task_instance.project_id,
329
- },
330
- )
331
-
332
174
 
333
175
  class VertexAIPipelineJobLink(BaseGoogleLink):
334
176
  """Helper class for constructing Vertex AI PipelineJob link."""
@@ -337,22 +179,6 @@ class VertexAIPipelineJobLink(BaseGoogleLink):
337
179
  key = "pipeline_job_conf"
338
180
  format_str = VERTEX_AI_PIPELINE_JOB_LINK
339
181
 
340
- @staticmethod
341
- def persist(
342
- context: Context,
343
- task_instance,
344
- pipeline_id: str,
345
- ):
346
- task_instance.xcom_push(
347
- context=context,
348
- key=VertexAIPipelineJobLink.key,
349
- value={
350
- "pipeline_id": pipeline_id,
351
- "region": task_instance.region,
352
- "project_id": task_instance.project_id,
353
- },
354
- )
355
-
356
182
 
357
183
  class VertexAIPipelineJobListLink(BaseGoogleLink):
358
184
  """Helper class for constructing Vertex AI PipelineJobList link."""
@@ -361,19 +187,6 @@ class VertexAIPipelineJobListLink(BaseGoogleLink):
361
187
  key = "pipeline_job_list_conf"
362
188
  format_str = VERTEX_AI_PIPELINE_JOB_LIST_LINK
363
189
 
364
- @staticmethod
365
- def persist(
366
- context: Context,
367
- task_instance,
368
- ):
369
- task_instance.xcom_push(
370
- context=context,
371
- key=VertexAIPipelineJobListLink.key,
372
- value={
373
- "project_id": task_instance.project_id,
374
- },
375
- )
376
-
377
190
 
378
191
  class VertexAIRayClusterLink(BaseGoogleLink):
379
192
  """Helper class for constructing Vertex AI Ray Cluster link."""
@@ -382,22 +195,6 @@ class VertexAIRayClusterLink(BaseGoogleLink):
382
195
  key = "ray_cluster_conf"
383
196
  format_str = VERTEX_AI_RAY_CLUSTER_LINK
384
197
 
385
- @staticmethod
386
- def persist(
387
- context: Context,
388
- task_instance,
389
- cluster_id: str,
390
- ):
391
- task_instance.xcom_push(
392
- context=context,
393
- key=VertexAIRayClusterLink.key,
394
- value={
395
- "location": task_instance.location,
396
- "cluster_id": cluster_id,
397
- "project_id": task_instance.project_id,
398
- },
399
- )
400
-
401
198
 
402
199
  class VertexAIRayClusterListLink(BaseGoogleLink):
403
200
  """Helper class for constructing Vertex AI Ray Cluster List link."""
@@ -405,16 +202,3 @@ class VertexAIRayClusterListLink(BaseGoogleLink):
405
202
  name = "Ray Cluster List"
406
203
  key = "ray_cluster_list_conf"
407
204
  format_str = VERTEX_AI_RAY_CLUSTER_LIST_LINK
408
-
409
- @staticmethod
410
- def persist(
411
- context: Context,
412
- task_instance,
413
- ):
414
- task_instance.xcom_push(
415
- context=context,
416
- key=VertexAIRayClusterListLink.key,
417
- value={
418
- "project_id": task_instance.project_id,
419
- },
420
- )
@@ -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
  WORKFLOWS_BASE_LINK = "/workflows"
31
25
  WORKFLOW_LINK = WORKFLOWS_BASE_LINK + "/workflow/{location_id}/{workflow_id}/executions?project={project_id}"
32
26
  WORKFLOWS_LINK = WORKFLOWS_BASE_LINK + "?project={project_id}"
@@ -43,20 +37,6 @@ class WorkflowsWorkflowDetailsLink(BaseGoogleLink):
43
37
  key = "workflow_details"
44
38
  format_str = WORKFLOW_LINK
45
39
 
46
- @staticmethod
47
- def persist(
48
- context: Context,
49
- task_instance: BaseOperator,
50
- location_id: str,
51
- workflow_id: str,
52
- project_id: str | None,
53
- ):
54
- task_instance.xcom_push(
55
- context,
56
- key=WorkflowsWorkflowDetailsLink.key,
57
- value={"location_id": location_id, "workflow_id": workflow_id, "project_id": project_id},
58
- )
59
-
60
40
 
61
41
  class WorkflowsListOfWorkflowsLink(BaseGoogleLink):
62
42
  """Helper class for constructing list of Workflows Link."""
@@ -65,18 +45,6 @@ class WorkflowsListOfWorkflowsLink(BaseGoogleLink):
65
45
  key = "list_of_workflows"
66
46
  format_str = WORKFLOWS_LINK
67
47
 
68
- @staticmethod
69
- def persist(
70
- context: Context,
71
- task_instance: BaseOperator,
72
- project_id: str | None,
73
- ):
74
- task_instance.xcom_push(
75
- context,
76
- key=WorkflowsListOfWorkflowsLink.key,
77
- value={"project_id": project_id},
78
- )
79
-
80
48
 
81
49
  class WorkflowsExecutionLink(BaseGoogleLink):
82
50
  """Helper class for constructing Workflows Execution Link."""
@@ -84,23 +52,3 @@ class WorkflowsExecutionLink(BaseGoogleLink):
84
52
  name = "Workflow Execution"
85
53
  key = "workflow_execution"
86
54
  format_str = EXECUTION_LINK
87
-
88
- @staticmethod
89
- def persist(
90
- context: Context,
91
- task_instance: BaseOperator,
92
- location_id: str,
93
- workflow_id: str,
94
- execution_id: str,
95
- project_id: str | None,
96
- ):
97
- task_instance.xcom_push(
98
- context,
99
- key=WorkflowsExecutionLink.key,
100
- value={
101
- "location_id": location_id,
102
- "workflow_id": workflow_id,
103
- "execution_id": execution_id,
104
- "project_id": project_id,
105
- },
106
- )