apache-airflow-providers-google 15.1.0rc1__py3-none-any.whl → 19.3.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 (257) hide show
  1. airflow/providers/google/3rd-party-licenses/NOTICE +2 -12
  2. airflow/providers/google/__init__.py +3 -3
  3. airflow/providers/google/ads/hooks/ads.py +39 -6
  4. airflow/providers/google/ads/operators/ads.py +2 -2
  5. airflow/providers/google/ads/transfers/ads_to_gcs.py +2 -2
  6. airflow/providers/google/assets/gcs.py +1 -11
  7. airflow/providers/google/cloud/bundles/__init__.py +16 -0
  8. airflow/providers/google/cloud/bundles/gcs.py +161 -0
  9. airflow/providers/google/cloud/hooks/alloy_db.py +1 -1
  10. airflow/providers/google/cloud/hooks/bigquery.py +176 -293
  11. airflow/providers/google/cloud/hooks/cloud_batch.py +1 -1
  12. airflow/providers/google/cloud/hooks/cloud_build.py +1 -1
  13. airflow/providers/google/cloud/hooks/cloud_composer.py +288 -15
  14. airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
  15. airflow/providers/google/cloud/hooks/cloud_memorystore.py +1 -1
  16. airflow/providers/google/cloud/hooks/cloud_run.py +18 -10
  17. airflow/providers/google/cloud/hooks/cloud_sql.py +102 -23
  18. airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +29 -7
  19. airflow/providers/google/cloud/hooks/compute.py +1 -1
  20. airflow/providers/google/cloud/hooks/compute_ssh.py +6 -2
  21. airflow/providers/google/cloud/hooks/datacatalog.py +10 -1
  22. airflow/providers/google/cloud/hooks/dataflow.py +72 -95
  23. airflow/providers/google/cloud/hooks/dataform.py +1 -1
  24. airflow/providers/google/cloud/hooks/datafusion.py +21 -19
  25. airflow/providers/google/cloud/hooks/dataplex.py +2 -2
  26. airflow/providers/google/cloud/hooks/dataprep.py +1 -1
  27. airflow/providers/google/cloud/hooks/dataproc.py +73 -72
  28. airflow/providers/google/cloud/hooks/dataproc_metastore.py +1 -1
  29. airflow/providers/google/cloud/hooks/dlp.py +1 -1
  30. airflow/providers/google/cloud/hooks/functions.py +1 -1
  31. airflow/providers/google/cloud/hooks/gcs.py +112 -15
  32. airflow/providers/google/cloud/hooks/gdm.py +1 -1
  33. airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
  34. airflow/providers/google/cloud/hooks/kubernetes_engine.py +3 -3
  35. airflow/providers/google/cloud/hooks/looker.py +6 -2
  36. airflow/providers/google/cloud/hooks/managed_kafka.py +1 -1
  37. airflow/providers/google/cloud/hooks/mlengine.py +4 -3
  38. airflow/providers/google/cloud/hooks/pubsub.py +3 -0
  39. airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
  40. airflow/providers/google/cloud/hooks/spanner.py +74 -9
  41. airflow/providers/google/cloud/hooks/stackdriver.py +11 -9
  42. airflow/providers/google/cloud/hooks/tasks.py +1 -1
  43. airflow/providers/google/cloud/hooks/translate.py +2 -2
  44. airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +2 -210
  45. airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -3
  46. airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +28 -2
  47. airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
  48. airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +308 -8
  49. airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
  50. airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +1 -1
  51. airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +1 -1
  52. airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +1 -1
  53. airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
  54. airflow/providers/google/cloud/hooks/vision.py +3 -3
  55. airflow/providers/google/cloud/hooks/workflows.py +1 -1
  56. airflow/providers/google/cloud/links/alloy_db.py +0 -46
  57. airflow/providers/google/cloud/links/base.py +77 -13
  58. airflow/providers/google/cloud/links/bigquery.py +0 -47
  59. airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
  60. airflow/providers/google/cloud/links/bigtable.py +0 -48
  61. airflow/providers/google/cloud/links/cloud_build.py +0 -73
  62. airflow/providers/google/cloud/links/cloud_functions.py +0 -33
  63. airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
  64. airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
  65. airflow/providers/google/cloud/links/cloud_sql.py +0 -33
  66. airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -44
  67. airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
  68. airflow/providers/google/cloud/links/compute.py +0 -58
  69. airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
  70. airflow/providers/google/cloud/links/datacatalog.py +23 -54
  71. airflow/providers/google/cloud/links/dataflow.py +0 -34
  72. airflow/providers/google/cloud/links/dataform.py +0 -64
  73. airflow/providers/google/cloud/links/datafusion.py +1 -96
  74. airflow/providers/google/cloud/links/dataplex.py +0 -154
  75. airflow/providers/google/cloud/links/dataprep.py +0 -24
  76. airflow/providers/google/cloud/links/dataproc.py +11 -95
  77. airflow/providers/google/cloud/links/datastore.py +0 -31
  78. airflow/providers/google/cloud/links/kubernetes_engine.py +9 -60
  79. airflow/providers/google/cloud/links/managed_kafka.py +0 -70
  80. airflow/providers/google/cloud/links/mlengine.py +0 -70
  81. airflow/providers/google/cloud/links/pubsub.py +0 -32
  82. airflow/providers/google/cloud/links/spanner.py +0 -33
  83. airflow/providers/google/cloud/links/stackdriver.py +0 -30
  84. airflow/providers/google/cloud/links/translate.py +17 -187
  85. airflow/providers/google/cloud/links/vertex_ai.py +28 -195
  86. airflow/providers/google/cloud/links/workflows.py +0 -52
  87. airflow/providers/google/cloud/log/gcs_task_handler.py +58 -22
  88. airflow/providers/google/cloud/log/stackdriver_task_handler.py +9 -6
  89. airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
  90. airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
  91. airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
  92. airflow/providers/google/cloud/openlineage/facets.py +102 -1
  93. airflow/providers/google/cloud/openlineage/mixins.py +10 -8
  94. airflow/providers/google/cloud/openlineage/utils.py +15 -1
  95. airflow/providers/google/cloud/operators/alloy_db.py +71 -56
  96. airflow/providers/google/cloud/operators/bigquery.py +73 -636
  97. airflow/providers/google/cloud/operators/bigquery_dts.py +4 -6
  98. airflow/providers/google/cloud/operators/bigtable.py +37 -8
  99. airflow/providers/google/cloud/operators/cloud_base.py +21 -1
  100. airflow/providers/google/cloud/operators/cloud_batch.py +3 -3
  101. airflow/providers/google/cloud/operators/cloud_build.py +76 -33
  102. airflow/providers/google/cloud/operators/cloud_composer.py +129 -41
  103. airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
  104. airflow/providers/google/cloud/operators/cloud_memorystore.py +69 -43
  105. airflow/providers/google/cloud/operators/cloud_run.py +24 -6
  106. airflow/providers/google/cloud/operators/cloud_sql.py +8 -17
  107. airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +93 -12
  108. airflow/providers/google/cloud/operators/compute.py +9 -41
  109. airflow/providers/google/cloud/operators/datacatalog.py +157 -21
  110. airflow/providers/google/cloud/operators/dataflow.py +40 -16
  111. airflow/providers/google/cloud/operators/dataform.py +15 -5
  112. airflow/providers/google/cloud/operators/datafusion.py +42 -21
  113. airflow/providers/google/cloud/operators/dataplex.py +194 -110
  114. airflow/providers/google/cloud/operators/dataprep.py +1 -5
  115. airflow/providers/google/cloud/operators/dataproc.py +80 -36
  116. airflow/providers/google/cloud/operators/dataproc_metastore.py +97 -89
  117. airflow/providers/google/cloud/operators/datastore.py +23 -7
  118. airflow/providers/google/cloud/operators/dlp.py +6 -29
  119. airflow/providers/google/cloud/operators/functions.py +17 -8
  120. airflow/providers/google/cloud/operators/gcs.py +12 -9
  121. airflow/providers/google/cloud/operators/gen_ai.py +389 -0
  122. airflow/providers/google/cloud/operators/kubernetes_engine.py +62 -100
  123. airflow/providers/google/cloud/operators/looker.py +2 -2
  124. airflow/providers/google/cloud/operators/managed_kafka.py +108 -53
  125. airflow/providers/google/cloud/operators/natural_language.py +1 -1
  126. airflow/providers/google/cloud/operators/pubsub.py +68 -15
  127. airflow/providers/google/cloud/operators/spanner.py +26 -13
  128. airflow/providers/google/cloud/operators/speech_to_text.py +2 -3
  129. airflow/providers/google/cloud/operators/stackdriver.py +1 -9
  130. airflow/providers/google/cloud/operators/tasks.py +1 -12
  131. airflow/providers/google/cloud/operators/text_to_speech.py +2 -3
  132. airflow/providers/google/cloud/operators/translate.py +41 -17
  133. airflow/providers/google/cloud/operators/translate_speech.py +2 -3
  134. airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +39 -19
  135. airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +30 -10
  136. airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +55 -27
  137. airflow/providers/google/cloud/operators/vertex_ai/dataset.py +70 -8
  138. airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +43 -9
  139. airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
  140. airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
  141. airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -115
  142. airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +12 -10
  143. airflow/providers/google/cloud/operators/vertex_ai/model_service.py +57 -11
  144. airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +31 -8
  145. airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
  146. airflow/providers/google/cloud/operators/video_intelligence.py +1 -1
  147. airflow/providers/google/cloud/operators/vision.py +2 -2
  148. airflow/providers/google/cloud/operators/workflows.py +18 -15
  149. airflow/providers/google/cloud/secrets/secret_manager.py +3 -2
  150. airflow/providers/google/cloud/sensors/bigquery.py +3 -3
  151. airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -3
  152. airflow/providers/google/cloud/sensors/bigtable.py +11 -4
  153. airflow/providers/google/cloud/sensors/cloud_composer.py +533 -30
  154. airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -3
  155. airflow/providers/google/cloud/sensors/dataflow.py +26 -10
  156. airflow/providers/google/cloud/sensors/dataform.py +2 -3
  157. airflow/providers/google/cloud/sensors/datafusion.py +4 -5
  158. airflow/providers/google/cloud/sensors/dataplex.py +2 -3
  159. airflow/providers/google/cloud/sensors/dataprep.py +2 -2
  160. airflow/providers/google/cloud/sensors/dataproc.py +2 -3
  161. airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -3
  162. airflow/providers/google/cloud/sensors/gcs.py +4 -5
  163. airflow/providers/google/cloud/sensors/looker.py +2 -3
  164. airflow/providers/google/cloud/sensors/pubsub.py +4 -5
  165. airflow/providers/google/cloud/sensors/tasks.py +2 -2
  166. airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -3
  167. airflow/providers/google/cloud/sensors/workflows.py +2 -3
  168. airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
  169. airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
  170. airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +4 -3
  171. airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
  172. airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +10 -5
  173. airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
  174. airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
  175. airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
  176. airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
  177. airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
  178. airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +3 -3
  179. airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +4 -4
  180. airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +21 -13
  181. airflow/providers/google/cloud/transfers/gcs_to_gcs.py +4 -3
  182. airflow/providers/google/cloud/transfers/gcs_to_local.py +6 -4
  183. airflow/providers/google/cloud/transfers/gcs_to_sftp.py +11 -5
  184. airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
  185. airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
  186. airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
  187. airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
  188. airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
  189. airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
  190. airflow/providers/google/cloud/transfers/postgres_to_gcs.py +42 -9
  191. airflow/providers/google/cloud/transfers/s3_to_gcs.py +13 -7
  192. airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
  193. airflow/providers/google/cloud/transfers/sftp_to_gcs.py +14 -5
  194. airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
  195. airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
  196. airflow/providers/google/cloud/triggers/bigquery.py +76 -35
  197. airflow/providers/google/cloud/triggers/cloud_build.py +1 -1
  198. airflow/providers/google/cloud/triggers/cloud_composer.py +303 -47
  199. airflow/providers/google/cloud/triggers/cloud_run.py +3 -3
  200. airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +92 -2
  201. airflow/providers/google/cloud/triggers/dataflow.py +122 -0
  202. airflow/providers/google/cloud/triggers/datafusion.py +1 -1
  203. airflow/providers/google/cloud/triggers/dataplex.py +14 -2
  204. airflow/providers/google/cloud/triggers/dataproc.py +123 -53
  205. airflow/providers/google/cloud/triggers/kubernetes_engine.py +47 -28
  206. airflow/providers/google/cloud/triggers/mlengine.py +1 -1
  207. airflow/providers/google/cloud/triggers/pubsub.py +15 -19
  208. airflow/providers/google/cloud/triggers/vertex_ai.py +1 -1
  209. airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
  210. airflow/providers/google/cloud/utils/credentials_provider.py +2 -2
  211. airflow/providers/google/cloud/utils/field_sanitizer.py +1 -1
  212. airflow/providers/google/cloud/utils/field_validator.py +2 -3
  213. airflow/providers/google/common/auth_backend/google_openid.py +4 -4
  214. airflow/providers/google/common/deprecated.py +2 -1
  215. airflow/providers/google/common/hooks/base_google.py +27 -9
  216. airflow/providers/google/common/hooks/operation_helpers.py +1 -1
  217. airflow/providers/google/common/links/storage.py +0 -22
  218. airflow/providers/google/common/utils/get_secret.py +31 -0
  219. airflow/providers/google/common/utils/id_token_credentials.py +3 -4
  220. airflow/providers/google/firebase/hooks/firestore.py +1 -1
  221. airflow/providers/google/firebase/operators/firestore.py +3 -3
  222. airflow/providers/google/get_provider_info.py +56 -52
  223. airflow/providers/google/go_module_utils.py +35 -3
  224. airflow/providers/google/leveldb/hooks/leveldb.py +27 -2
  225. airflow/providers/google/leveldb/operators/leveldb.py +2 -2
  226. airflow/providers/google/marketing_platform/hooks/campaign_manager.py +1 -1
  227. airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
  228. airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
  229. airflow/providers/google/marketing_platform/links/analytics_admin.py +5 -14
  230. airflow/providers/google/marketing_platform/operators/analytics_admin.py +2 -3
  231. airflow/providers/google/marketing_platform/operators/campaign_manager.py +6 -6
  232. airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
  233. airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
  234. airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
  235. airflow/providers/google/marketing_platform/sensors/display_video.py +3 -64
  236. airflow/providers/google/suite/hooks/calendar.py +2 -2
  237. airflow/providers/google/suite/hooks/sheets.py +16 -2
  238. airflow/providers/google/suite/operators/sheets.py +8 -3
  239. airflow/providers/google/suite/sensors/drive.py +2 -2
  240. airflow/providers/google/suite/transfers/gcs_to_gdrive.py +3 -3
  241. airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
  242. airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
  243. airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
  244. airflow/providers/google/version_compat.py +15 -1
  245. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/METADATA +90 -46
  246. apache_airflow_providers_google-19.3.0.dist-info/RECORD +331 -0
  247. apache_airflow_providers_google-19.3.0.dist-info/licenses/NOTICE +5 -0
  248. airflow/providers/google/cloud/hooks/automl.py +0 -673
  249. airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
  250. airflow/providers/google/cloud/links/automl.py +0 -193
  251. airflow/providers/google/cloud/operators/automl.py +0 -1362
  252. airflow/providers/google/cloud/operators/life_sciences.py +0 -119
  253. airflow/providers/google/cloud/operators/mlengine.py +0 -112
  254. apache_airflow_providers_google-15.1.0rc1.dist-info/RECORD +0 -321
  255. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/WHEEL +0 -0
  256. {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/entry_points.txt +0 -0
  257. {airflow/providers/google → apache_airflow_providers_google-19.3.0.dist-info/licenses}/LICENSE +0 -0
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING
23
23
  from airflow.providers.google.cloud.links.base import BASE_LINK, BaseGoogleLink
24
24
 
25
25
  if TYPE_CHECKING:
26
- from airflow.utils.context import Context
26
+ from airflow.providers.common.compat.sdk import Context
27
27
 
28
28
 
29
29
  TRANSLATION_BASE_LINK = BASE_LINK + "/translation"
@@ -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
- )
@@ -21,7 +21,7 @@ from typing import TYPE_CHECKING
21
21
  from airflow.providers.google.cloud.links.base import BaseGoogleLink
22
22
 
23
23
  if TYPE_CHECKING:
24
- from airflow.utils.context import Context
24
+ from airflow.providers.common.compat.sdk import Context
25
25
 
26
26
  VERTEX_AI_BASE_LINK = "/vertex-ai"
27
27
  VERTEX_AI_MODEL_LINK = (
@@ -54,6 +54,10 @@ VERTEX_AI_PIPELINE_JOB_LINK = (
54
54
  VERTEX_AI_BASE_LINK + "/locations/{region}/pipelines/runs/{pipeline_id}?project={project_id}"
55
55
  )
56
56
  VERTEX_AI_PIPELINE_JOB_LIST_LINK = VERTEX_AI_BASE_LINK + "/pipelines/runs?project={project_id}"
57
+ VERTEX_AI_RAY_CLUSTER_LINK = (
58
+ VERTEX_AI_BASE_LINK + "/locations/{location}/ray-clusters/{cluster_id}?project={project_id}"
59
+ )
60
+ VERTEX_AI_RAY_CLUSTER_LIST_LINK = VERTEX_AI_BASE_LINK + "/ray?project={project_id}"
57
61
 
58
62
 
59
63
  class VertexAIModelLink(BaseGoogleLink):
@@ -63,22 +67,6 @@ class VertexAIModelLink(BaseGoogleLink):
63
67
  key = "model_conf"
64
68
  format_str = VERTEX_AI_MODEL_LINK
65
69
 
66
- @staticmethod
67
- def persist(
68
- context: Context,
69
- task_instance,
70
- model_id: str,
71
- ):
72
- task_instance.xcom_push(
73
- context=context,
74
- key=VertexAIModelLink.key,
75
- value={
76
- "model_id": model_id,
77
- "region": task_instance.region,
78
- "project_id": task_instance.project_id,
79
- },
80
- )
81
-
82
70
 
83
71
  class VertexAIModelListLink(BaseGoogleLink):
84
72
  """Helper class for constructing Vertex AI Models Link."""
@@ -87,19 +75,6 @@ class VertexAIModelListLink(BaseGoogleLink):
87
75
  key = "models_conf"
88
76
  format_str = VERTEX_AI_MODEL_LIST_LINK
89
77
 
90
- @staticmethod
91
- def persist(
92
- context: Context,
93
- task_instance,
94
- ):
95
- task_instance.xcom_push(
96
- context=context,
97
- key=VertexAIModelListLink.key,
98
- value={
99
- "project_id": task_instance.project_id,
100
- },
101
- )
102
-
103
78
 
104
79
  class VertexAIModelExportLink(BaseGoogleLink):
105
80
  """Helper class for constructing Vertex AI Model Export Link."""
@@ -113,19 +88,15 @@ class VertexAIModelExportLink(BaseGoogleLink):
113
88
  """Return bucket name from output configuration."""
114
89
  return config["artifact_destination"]["output_uri_prefix"].rpartition("gs://")[-1]
115
90
 
116
- @staticmethod
117
- def persist(
118
- context: Context,
119
- task_instance,
120
- ):
121
- 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(
122
96
  context=context,
123
- key=VertexAIModelExportLink.key,
124
- value={
125
- "project_id": task_instance.project_id,
126
- "model_id": task_instance.model_id,
127
- "bucket_name": VertexAIModelExportLink.extract_bucket_name(task_instance.output_config),
128
- },
97
+ project_id=value.get("project_id"),
98
+ model_id=value.get("model_id"),
99
+ bucket_name=bucket_name,
129
100
  )
130
101
 
131
102
 
@@ -136,22 +107,6 @@ class VertexAITrainingLink(BaseGoogleLink):
136
107
  key = "training_conf"
137
108
  format_str = VERTEX_AI_TRAINING_LINK
138
109
 
139
- @staticmethod
140
- def persist(
141
- context: Context,
142
- task_instance,
143
- training_id: str,
144
- ):
145
- task_instance.xcom_push(
146
- context=context,
147
- key=VertexAITrainingLink.key,
148
- value={
149
- "training_id": training_id,
150
- "region": task_instance.region,
151
- "project_id": task_instance.project_id,
152
- },
153
- )
154
-
155
110
 
156
111
  class VertexAITrainingPipelinesLink(BaseGoogleLink):
157
112
  """Helper class for constructing Vertex AI Training Pipelines link."""
@@ -160,19 +115,6 @@ class VertexAITrainingPipelinesLink(BaseGoogleLink):
160
115
  key = "pipelines_conf"
161
116
  format_str = VERTEX_AI_TRAINING_PIPELINES_LINK
162
117
 
163
- @staticmethod
164
- def persist(
165
- context: Context,
166
- task_instance,
167
- ):
168
- task_instance.xcom_push(
169
- context=context,
170
- key=VertexAITrainingPipelinesLink.key,
171
- value={
172
- "project_id": task_instance.project_id,
173
- },
174
- )
175
-
176
118
 
177
119
  class VertexAIDatasetLink(BaseGoogleLink):
178
120
  """Helper class for constructing Vertex AI Dataset link."""
@@ -181,18 +123,6 @@ class VertexAIDatasetLink(BaseGoogleLink):
181
123
  key = "dataset_conf"
182
124
  format_str = VERTEX_AI_DATASET_LINK
183
125
 
184
- @staticmethod
185
- def persist(context: Context, task_instance, dataset_id: str):
186
- task_instance.xcom_push(
187
- context=context,
188
- key=VertexAIDatasetLink.key,
189
- value={
190
- "dataset_id": dataset_id,
191
- "region": task_instance.region,
192
- "project_id": task_instance.project_id,
193
- },
194
- )
195
-
196
126
 
197
127
  class VertexAIDatasetListLink(BaseGoogleLink):
198
128
  """Helper class for constructing Vertex AI Datasets Link."""
@@ -201,19 +131,6 @@ class VertexAIDatasetListLink(BaseGoogleLink):
201
131
  key = "datasets_conf"
202
132
  format_str = VERTEX_AI_DATASET_LIST_LINK
203
133
 
204
- @staticmethod
205
- def persist(
206
- context: Context,
207
- task_instance,
208
- ):
209
- task_instance.xcom_push(
210
- context=context,
211
- key=VertexAIDatasetListLink.key,
212
- value={
213
- "project_id": task_instance.project_id,
214
- },
215
- )
216
-
217
134
 
218
135
  class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
219
136
  """Helper class for constructing Vertex AI HyperparameterTuningJobs Link."""
@@ -222,19 +139,6 @@ class VertexAIHyperparameterTuningJobListLink(BaseGoogleLink):
222
139
  key = "hyperparameter_tuning_jobs_conf"
223
140
  format_str = VERTEX_AI_HYPERPARAMETER_TUNING_JOB_LIST_LINK
224
141
 
225
- @staticmethod
226
- def persist(
227
- context: Context,
228
- task_instance,
229
- ):
230
- task_instance.xcom_push(
231
- context=context,
232
- key=VertexAIHyperparameterTuningJobListLink.key,
233
- value={
234
- "project_id": task_instance.project_id,
235
- },
236
- )
237
-
238
142
 
239
143
  class VertexAIBatchPredictionJobLink(BaseGoogleLink):
240
144
  """Helper class for constructing Vertex AI BatchPredictionJob link."""
@@ -243,22 +147,6 @@ class VertexAIBatchPredictionJobLink(BaseGoogleLink):
243
147
  key = "batch_prediction_job_conf"
244
148
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LINK
245
149
 
246
- @staticmethod
247
- def persist(
248
- context: Context,
249
- task_instance,
250
- batch_prediction_job_id: str,
251
- ):
252
- task_instance.xcom_push(
253
- context=context,
254
- key=VertexAIBatchPredictionJobLink.key,
255
- value={
256
- "batch_prediction_job_id": batch_prediction_job_id,
257
- "region": task_instance.region,
258
- "project_id": task_instance.project_id,
259
- },
260
- )
261
-
262
150
 
263
151
  class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
264
152
  """Helper class for constructing Vertex AI BatchPredictionJobList link."""
@@ -267,19 +155,6 @@ class VertexAIBatchPredictionJobListLink(BaseGoogleLink):
267
155
  key = "batch_prediction_jobs_conf"
268
156
  format_str = VERTEX_AI_BATCH_PREDICTION_JOB_LIST_LINK
269
157
 
270
- @staticmethod
271
- def persist(
272
- context: Context,
273
- task_instance,
274
- ):
275
- task_instance.xcom_push(
276
- context=context,
277
- key=VertexAIBatchPredictionJobListLink.key,
278
- value={
279
- "project_id": task_instance.project_id,
280
- },
281
- )
282
-
283
158
 
284
159
  class VertexAIEndpointLink(BaseGoogleLink):
285
160
  """Helper class for constructing Vertex AI Endpoint link."""
@@ -288,22 +163,6 @@ class VertexAIEndpointLink(BaseGoogleLink):
288
163
  key = "endpoint_conf"
289
164
  format_str = VERTEX_AI_ENDPOINT_LINK
290
165
 
291
- @staticmethod
292
- def persist(
293
- context: Context,
294
- task_instance,
295
- endpoint_id: str,
296
- ):
297
- task_instance.xcom_push(
298
- context=context,
299
- key=VertexAIEndpointLink.key,
300
- value={
301
- "endpoint_id": endpoint_id,
302
- "region": task_instance.region,
303
- "project_id": task_instance.project_id,
304
- },
305
- )
306
-
307
166
 
308
167
  class VertexAIEndpointListLink(BaseGoogleLink):
309
168
  """Helper class for constructing Vertex AI EndpointList link."""
@@ -312,19 +171,6 @@ class VertexAIEndpointListLink(BaseGoogleLink):
312
171
  key = "endpoints_conf"
313
172
  format_str = VERTEX_AI_ENDPOINT_LIST_LINK
314
173
 
315
- @staticmethod
316
- def persist(
317
- context: Context,
318
- task_instance,
319
- ):
320
- task_instance.xcom_push(
321
- context=context,
322
- key=VertexAIEndpointListLink.key,
323
- value={
324
- "project_id": task_instance.project_id,
325
- },
326
- )
327
-
328
174
 
329
175
  class VertexAIPipelineJobLink(BaseGoogleLink):
330
176
  """Helper class for constructing Vertex AI PipelineJob link."""
@@ -333,22 +179,6 @@ class VertexAIPipelineJobLink(BaseGoogleLink):
333
179
  key = "pipeline_job_conf"
334
180
  format_str = VERTEX_AI_PIPELINE_JOB_LINK
335
181
 
336
- @staticmethod
337
- def persist(
338
- context: Context,
339
- task_instance,
340
- pipeline_id: str,
341
- ):
342
- task_instance.xcom_push(
343
- context=context,
344
- key=VertexAIPipelineJobLink.key,
345
- value={
346
- "pipeline_id": pipeline_id,
347
- "region": task_instance.region,
348
- "project_id": task_instance.project_id,
349
- },
350
- )
351
-
352
182
 
353
183
  class VertexAIPipelineJobListLink(BaseGoogleLink):
354
184
  """Helper class for constructing Vertex AI PipelineJobList link."""
@@ -357,15 +187,18 @@ class VertexAIPipelineJobListLink(BaseGoogleLink):
357
187
  key = "pipeline_job_list_conf"
358
188
  format_str = VERTEX_AI_PIPELINE_JOB_LIST_LINK
359
189
 
360
- @staticmethod
361
- def persist(
362
- context: Context,
363
- task_instance,
364
- ):
365
- task_instance.xcom_push(
366
- context=context,
367
- key=VertexAIPipelineJobListLink.key,
368
- value={
369
- "project_id": task_instance.project_id,
370
- },
371
- )
190
+
191
+ class VertexAIRayClusterLink(BaseGoogleLink):
192
+ """Helper class for constructing Vertex AI Ray Cluster link."""
193
+
194
+ name = "Ray Cluster"
195
+ key = "ray_cluster_conf"
196
+ format_str = VERTEX_AI_RAY_CLUSTER_LINK
197
+
198
+
199
+ class VertexAIRayClusterListLink(BaseGoogleLink):
200
+ """Helper class for constructing Vertex AI Ray Cluster List link."""
201
+
202
+ name = "Ray Cluster List"
203
+ key = "ray_cluster_list_conf"
204
+ format_str = VERTEX_AI_RAY_CLUSTER_LIST_LINK
@@ -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
- )