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.
- airflow/providers/google/3rd-party-licenses/NOTICE +2 -12
- airflow/providers/google/__init__.py +3 -3
- airflow/providers/google/ads/hooks/ads.py +39 -6
- airflow/providers/google/ads/operators/ads.py +2 -2
- airflow/providers/google/ads/transfers/ads_to_gcs.py +2 -2
- airflow/providers/google/assets/gcs.py +1 -11
- airflow/providers/google/cloud/bundles/__init__.py +16 -0
- airflow/providers/google/cloud/bundles/gcs.py +161 -0
- airflow/providers/google/cloud/hooks/alloy_db.py +1 -1
- airflow/providers/google/cloud/hooks/bigquery.py +176 -293
- airflow/providers/google/cloud/hooks/cloud_batch.py +1 -1
- airflow/providers/google/cloud/hooks/cloud_build.py +1 -1
- airflow/providers/google/cloud/hooks/cloud_composer.py +288 -15
- airflow/providers/google/cloud/hooks/cloud_logging.py +109 -0
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +1 -1
- airflow/providers/google/cloud/hooks/cloud_run.py +18 -10
- airflow/providers/google/cloud/hooks/cloud_sql.py +102 -23
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +29 -7
- airflow/providers/google/cloud/hooks/compute.py +1 -1
- airflow/providers/google/cloud/hooks/compute_ssh.py +6 -2
- airflow/providers/google/cloud/hooks/datacatalog.py +10 -1
- airflow/providers/google/cloud/hooks/dataflow.py +72 -95
- airflow/providers/google/cloud/hooks/dataform.py +1 -1
- airflow/providers/google/cloud/hooks/datafusion.py +21 -19
- airflow/providers/google/cloud/hooks/dataplex.py +2 -2
- airflow/providers/google/cloud/hooks/dataprep.py +1 -1
- airflow/providers/google/cloud/hooks/dataproc.py +73 -72
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +1 -1
- airflow/providers/google/cloud/hooks/dlp.py +1 -1
- airflow/providers/google/cloud/hooks/functions.py +1 -1
- airflow/providers/google/cloud/hooks/gcs.py +112 -15
- airflow/providers/google/cloud/hooks/gdm.py +1 -1
- airflow/providers/google/cloud/hooks/gen_ai.py +196 -0
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +3 -3
- airflow/providers/google/cloud/hooks/looker.py +6 -2
- airflow/providers/google/cloud/hooks/managed_kafka.py +1 -1
- airflow/providers/google/cloud/hooks/mlengine.py +4 -3
- airflow/providers/google/cloud/hooks/pubsub.py +3 -0
- airflow/providers/google/cloud/hooks/secret_manager.py +102 -10
- airflow/providers/google/cloud/hooks/spanner.py +74 -9
- airflow/providers/google/cloud/hooks/stackdriver.py +11 -9
- airflow/providers/google/cloud/hooks/tasks.py +1 -1
- airflow/providers/google/cloud/hooks/translate.py +2 -2
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +2 -210
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +3 -3
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +28 -2
- airflow/providers/google/cloud/hooks/vertex_ai/experiment_service.py +202 -0
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +308 -8
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +79 -75
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +1 -1
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +1 -1
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +1 -1
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
- airflow/providers/google/cloud/hooks/vision.py +3 -3
- airflow/providers/google/cloud/hooks/workflows.py +1 -1
- airflow/providers/google/cloud/links/alloy_db.py +0 -46
- airflow/providers/google/cloud/links/base.py +77 -13
- airflow/providers/google/cloud/links/bigquery.py +0 -47
- airflow/providers/google/cloud/links/bigquery_dts.py +0 -20
- airflow/providers/google/cloud/links/bigtable.py +0 -48
- airflow/providers/google/cloud/links/cloud_build.py +0 -73
- airflow/providers/google/cloud/links/cloud_functions.py +0 -33
- airflow/providers/google/cloud/links/cloud_memorystore.py +0 -58
- airflow/providers/google/cloud/links/{life_sciences.py → cloud_run.py} +5 -27
- airflow/providers/google/cloud/links/cloud_sql.py +0 -33
- airflow/providers/google/cloud/links/cloud_storage_transfer.py +17 -44
- airflow/providers/google/cloud/links/cloud_tasks.py +7 -26
- airflow/providers/google/cloud/links/compute.py +0 -58
- airflow/providers/google/cloud/links/data_loss_prevention.py +0 -169
- airflow/providers/google/cloud/links/datacatalog.py +23 -54
- airflow/providers/google/cloud/links/dataflow.py +0 -34
- airflow/providers/google/cloud/links/dataform.py +0 -64
- airflow/providers/google/cloud/links/datafusion.py +1 -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 +11 -95
- airflow/providers/google/cloud/links/datastore.py +0 -31
- airflow/providers/google/cloud/links/kubernetes_engine.py +9 -60
- 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 +17 -187
- airflow/providers/google/cloud/links/vertex_ai.py +28 -195
- airflow/providers/google/cloud/links/workflows.py +0 -52
- airflow/providers/google/cloud/log/gcs_task_handler.py +58 -22
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +9 -6
- airflow/providers/google/cloud/openlineage/CloudStorageTransferJobFacet.json +68 -0
- airflow/providers/google/cloud/openlineage/CloudStorageTransferRunFacet.json +60 -0
- airflow/providers/google/cloud/openlineage/DataFusionRunFacet.json +32 -0
- airflow/providers/google/cloud/openlineage/facets.py +102 -1
- airflow/providers/google/cloud/openlineage/mixins.py +10 -8
- airflow/providers/google/cloud/openlineage/utils.py +15 -1
- airflow/providers/google/cloud/operators/alloy_db.py +71 -56
- airflow/providers/google/cloud/operators/bigquery.py +73 -636
- airflow/providers/google/cloud/operators/bigquery_dts.py +4 -6
- airflow/providers/google/cloud/operators/bigtable.py +37 -8
- airflow/providers/google/cloud/operators/cloud_base.py +21 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +3 -3
- airflow/providers/google/cloud/operators/cloud_build.py +76 -33
- airflow/providers/google/cloud/operators/cloud_composer.py +129 -41
- airflow/providers/google/cloud/operators/cloud_logging_sink.py +341 -0
- airflow/providers/google/cloud/operators/cloud_memorystore.py +69 -43
- airflow/providers/google/cloud/operators/cloud_run.py +24 -6
- airflow/providers/google/cloud/operators/cloud_sql.py +8 -17
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +93 -12
- airflow/providers/google/cloud/operators/compute.py +9 -41
- airflow/providers/google/cloud/operators/datacatalog.py +157 -21
- airflow/providers/google/cloud/operators/dataflow.py +40 -16
- airflow/providers/google/cloud/operators/dataform.py +15 -5
- airflow/providers/google/cloud/operators/datafusion.py +42 -21
- airflow/providers/google/cloud/operators/dataplex.py +194 -110
- airflow/providers/google/cloud/operators/dataprep.py +1 -5
- airflow/providers/google/cloud/operators/dataproc.py +80 -36
- airflow/providers/google/cloud/operators/dataproc_metastore.py +97 -89
- airflow/providers/google/cloud/operators/datastore.py +23 -7
- airflow/providers/google/cloud/operators/dlp.py +6 -29
- airflow/providers/google/cloud/operators/functions.py +17 -8
- airflow/providers/google/cloud/operators/gcs.py +12 -9
- airflow/providers/google/cloud/operators/gen_ai.py +389 -0
- airflow/providers/google/cloud/operators/kubernetes_engine.py +62 -100
- airflow/providers/google/cloud/operators/looker.py +2 -2
- airflow/providers/google/cloud/operators/managed_kafka.py +108 -53
- airflow/providers/google/cloud/operators/natural_language.py +1 -1
- airflow/providers/google/cloud/operators/pubsub.py +68 -15
- airflow/providers/google/cloud/operators/spanner.py +26 -13
- airflow/providers/google/cloud/operators/speech_to_text.py +2 -3
- airflow/providers/google/cloud/operators/stackdriver.py +1 -9
- airflow/providers/google/cloud/operators/tasks.py +1 -12
- airflow/providers/google/cloud/operators/text_to_speech.py +2 -3
- airflow/providers/google/cloud/operators/translate.py +41 -17
- airflow/providers/google/cloud/operators/translate_speech.py +2 -3
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +39 -19
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +30 -10
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +55 -27
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +70 -8
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +43 -9
- airflow/providers/google/cloud/operators/vertex_ai/experiment_service.py +435 -0
- airflow/providers/google/cloud/operators/vertex_ai/feature_store.py +532 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +135 -115
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +12 -10
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +57 -11
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +31 -8
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +393 -0
- airflow/providers/google/cloud/operators/video_intelligence.py +1 -1
- airflow/providers/google/cloud/operators/vision.py +2 -2
- airflow/providers/google/cloud/operators/workflows.py +18 -15
- airflow/providers/google/cloud/secrets/secret_manager.py +3 -2
- airflow/providers/google/cloud/sensors/bigquery.py +3 -3
- airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -3
- airflow/providers/google/cloud/sensors/bigtable.py +11 -4
- airflow/providers/google/cloud/sensors/cloud_composer.py +533 -30
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -3
- airflow/providers/google/cloud/sensors/dataflow.py +26 -10
- airflow/providers/google/cloud/sensors/dataform.py +2 -3
- airflow/providers/google/cloud/sensors/datafusion.py +4 -5
- airflow/providers/google/cloud/sensors/dataplex.py +2 -3
- airflow/providers/google/cloud/sensors/dataprep.py +2 -2
- airflow/providers/google/cloud/sensors/dataproc.py +2 -3
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -3
- airflow/providers/google/cloud/sensors/gcs.py +4 -5
- airflow/providers/google/cloud/sensors/looker.py +2 -3
- airflow/providers/google/cloud/sensors/pubsub.py +4 -5
- airflow/providers/google/cloud/sensors/tasks.py +2 -2
- airflow/providers/google/cloud/sensors/vertex_ai/feature_store.py +2 -3
- airflow/providers/google/cloud/sensors/workflows.py +2 -3
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +4 -3
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +11 -8
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +10 -5
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +7 -3
- airflow/providers/google/cloud/transfers/bigquery_to_mysql.py +12 -1
- airflow/providers/google/cloud/transfers/bigquery_to_postgres.py +24 -10
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +104 -5
- airflow/providers/google/cloud/transfers/calendar_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/cassandra_to_gcs.py +3 -3
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +4 -4
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +21 -13
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +4 -3
- airflow/providers/google/cloud/transfers/gcs_to_local.py +6 -4
- airflow/providers/google/cloud/transfers/gcs_to_sftp.py +11 -5
- airflow/providers/google/cloud/transfers/gdrive_to_gcs.py +6 -2
- airflow/providers/google/cloud/transfers/gdrive_to_local.py +2 -2
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/local_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/mssql_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/oracle_to_gcs.py +36 -11
- airflow/providers/google/cloud/transfers/postgres_to_gcs.py +42 -9
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +13 -7
- airflow/providers/google/cloud/transfers/salesforce_to_gcs.py +2 -2
- airflow/providers/google/cloud/transfers/sftp_to_gcs.py +14 -5
- airflow/providers/google/cloud/transfers/sheets_to_gcs.py +3 -3
- airflow/providers/google/cloud/transfers/sql_to_gcs.py +10 -10
- airflow/providers/google/cloud/triggers/bigquery.py +76 -35
- airflow/providers/google/cloud/triggers/cloud_build.py +1 -1
- airflow/providers/google/cloud/triggers/cloud_composer.py +303 -47
- airflow/providers/google/cloud/triggers/cloud_run.py +3 -3
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +92 -2
- airflow/providers/google/cloud/triggers/dataflow.py +122 -0
- airflow/providers/google/cloud/triggers/datafusion.py +1 -1
- airflow/providers/google/cloud/triggers/dataplex.py +14 -2
- airflow/providers/google/cloud/triggers/dataproc.py +123 -53
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +47 -28
- airflow/providers/google/cloud/triggers/mlengine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +15 -19
- airflow/providers/google/cloud/triggers/vertex_ai.py +1 -1
- airflow/providers/google/cloud/utils/bigquery_get_data.py +1 -1
- airflow/providers/google/cloud/utils/credentials_provider.py +2 -2
- airflow/providers/google/cloud/utils/field_sanitizer.py +1 -1
- airflow/providers/google/cloud/utils/field_validator.py +2 -3
- airflow/providers/google/common/auth_backend/google_openid.py +4 -4
- airflow/providers/google/common/deprecated.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +27 -9
- airflow/providers/google/common/hooks/operation_helpers.py +1 -1
- airflow/providers/google/common/links/storage.py +0 -22
- airflow/providers/google/common/utils/get_secret.py +31 -0
- airflow/providers/google/common/utils/id_token_credentials.py +3 -4
- airflow/providers/google/firebase/hooks/firestore.py +1 -1
- airflow/providers/google/firebase/operators/firestore.py +3 -3
- airflow/providers/google/get_provider_info.py +56 -52
- airflow/providers/google/go_module_utils.py +35 -3
- airflow/providers/google/leveldb/hooks/leveldb.py +27 -2
- airflow/providers/google/leveldb/operators/leveldb.py +2 -2
- airflow/providers/google/marketing_platform/hooks/campaign_manager.py +1 -1
- airflow/providers/google/marketing_platform/hooks/display_video.py +3 -109
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +5 -14
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +2 -3
- airflow/providers/google/marketing_platform/operators/campaign_manager.py +6 -6
- airflow/providers/google/marketing_platform/operators/display_video.py +28 -489
- airflow/providers/google/marketing_platform/operators/search_ads.py +2 -2
- airflow/providers/google/marketing_platform/sensors/campaign_manager.py +2 -2
- airflow/providers/google/marketing_platform/sensors/display_video.py +3 -64
- airflow/providers/google/suite/hooks/calendar.py +2 -2
- airflow/providers/google/suite/hooks/sheets.py +16 -2
- airflow/providers/google/suite/operators/sheets.py +8 -3
- airflow/providers/google/suite/sensors/drive.py +2 -2
- airflow/providers/google/suite/transfers/gcs_to_gdrive.py +3 -3
- airflow/providers/google/suite/transfers/gcs_to_sheets.py +1 -1
- airflow/providers/google/suite/transfers/local_to_drive.py +3 -3
- airflow/providers/google/suite/transfers/sql_to_sheets.py +5 -4
- airflow/providers/google/version_compat.py +15 -1
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/METADATA +90 -46
- apache_airflow_providers_google-19.3.0.dist-info/RECORD +331 -0
- apache_airflow_providers_google-19.3.0.dist-info/licenses/NOTICE +5 -0
- airflow/providers/google/cloud/hooks/automl.py +0 -673
- airflow/providers/google/cloud/hooks/life_sciences.py +0 -159
- airflow/providers/google/cloud/links/automl.py +0 -193
- airflow/providers/google/cloud/operators/automl.py +0 -1362
- airflow/providers/google/cloud/operators/life_sciences.py +0 -119
- airflow/providers/google/cloud/operators/mlengine.py +0 -112
- apache_airflow_providers_google-15.1.0rc1.dist-info/RECORD +0 -321
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-19.3.0.dist-info}/entry_points.txt +0 -0
- {airflow/providers/google → apache_airflow_providers_google-19.3.0.dist-info/licenses}/LICENSE +0 -0
|
@@ -33,7 +33,7 @@ from google.cloud.bigquery_datatransfer_v1 import (
|
|
|
33
33
|
)
|
|
34
34
|
|
|
35
35
|
from airflow.configuration import conf
|
|
36
|
-
from airflow.
|
|
36
|
+
from airflow.providers.common.compat.sdk import AirflowException
|
|
37
37
|
from airflow.providers.google.cloud.hooks.bigquery_dts import BiqQueryDataTransferServiceHook, get_object_id
|
|
38
38
|
from airflow.providers.google.cloud.links.bigquery_dts import BigQueryDataTransferConfigLink
|
|
39
39
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
|
@@ -43,7 +43,7 @@ from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
|
|
43
43
|
if TYPE_CHECKING:
|
|
44
44
|
from google.api_core.retry import Retry
|
|
45
45
|
|
|
46
|
-
from airflow.
|
|
46
|
+
from airflow.providers.common.compat.sdk import Context
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def _get_transfer_config_details(config_transfer_name: str):
|
|
@@ -134,7 +134,6 @@ class BigQueryCreateDataTransferOperator(GoogleCloudBaseOperator):
|
|
|
134
134
|
transfer_config = _get_transfer_config_details(response.name)
|
|
135
135
|
BigQueryDataTransferConfigLink.persist(
|
|
136
136
|
context=context,
|
|
137
|
-
task_instance=self,
|
|
138
137
|
region=transfer_config["region"],
|
|
139
138
|
config_id=transfer_config["config_id"],
|
|
140
139
|
project_id=transfer_config["project_id"],
|
|
@@ -142,7 +141,7 @@ class BigQueryCreateDataTransferOperator(GoogleCloudBaseOperator):
|
|
|
142
141
|
|
|
143
142
|
result = TransferConfig.to_dict(response)
|
|
144
143
|
self.log.info("Created DTS transfer config %s", get_object_id(result))
|
|
145
|
-
|
|
144
|
+
context["ti"].xcom_push(key="transfer_config_id", value=get_object_id(result))
|
|
146
145
|
# don't push AWS secret in XCOM
|
|
147
146
|
result.get("params", {}).pop("secret_access_key", None)
|
|
148
147
|
result.get("params", {}).pop("access_key_id", None)
|
|
@@ -329,7 +328,6 @@ class BigQueryDataTransferServiceStartTransferRunsOperator(GoogleCloudBaseOperat
|
|
|
329
328
|
transfer_config = _get_transfer_config_details(response.runs[0].name)
|
|
330
329
|
BigQueryDataTransferConfigLink.persist(
|
|
331
330
|
context=context,
|
|
332
|
-
task_instance=self,
|
|
333
331
|
region=transfer_config["region"],
|
|
334
332
|
config_id=transfer_config["config_id"],
|
|
335
333
|
project_id=transfer_config["project_id"],
|
|
@@ -337,7 +335,7 @@ class BigQueryDataTransferServiceStartTransferRunsOperator(GoogleCloudBaseOperat
|
|
|
337
335
|
|
|
338
336
|
result = StartManualTransferRunsResponse.to_dict(response)
|
|
339
337
|
run_id = get_object_id(result["runs"][0])
|
|
340
|
-
|
|
338
|
+
context["ti"].xcom_push(key="run_id", value=run_id)
|
|
341
339
|
|
|
342
340
|
if not self.deferrable:
|
|
343
341
|
# Save as attribute for further use by OpenLineage
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
22
|
from collections.abc import Iterable, Sequence
|
|
23
|
-
from typing import TYPE_CHECKING
|
|
23
|
+
from typing import TYPE_CHECKING, Any
|
|
24
24
|
|
|
25
25
|
import google.api_core.exceptions
|
|
26
26
|
|
|
27
|
-
from airflow.
|
|
27
|
+
from airflow.providers.common.compat.sdk import AirflowException
|
|
28
28
|
from airflow.providers.google.cloud.hooks.bigtable import BigtableHook
|
|
29
29
|
from airflow.providers.google.cloud.links.bigtable import (
|
|
30
30
|
BigtableClusterLink,
|
|
@@ -40,7 +40,7 @@ if TYPE_CHECKING:
|
|
|
40
40
|
from google.cloud.bigtable import enums
|
|
41
41
|
from google.cloud.bigtable.column_family import GarbageCollectionRule
|
|
42
42
|
|
|
43
|
-
from airflow.
|
|
43
|
+
from airflow.providers.common.compat.sdk import Context
|
|
44
44
|
|
|
45
45
|
|
|
46
46
|
class BigtableValidationMixin:
|
|
@@ -142,6 +142,13 @@ class BigtableCreateInstanceOperator(GoogleCloudBaseOperator, BigtableValidation
|
|
|
142
142
|
self.impersonation_chain = impersonation_chain
|
|
143
143
|
super().__init__(**kwargs)
|
|
144
144
|
|
|
145
|
+
@property
|
|
146
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
147
|
+
return {
|
|
148
|
+
"instance_id": self.instance_id,
|
|
149
|
+
"project_id": self.project_id,
|
|
150
|
+
}
|
|
151
|
+
|
|
145
152
|
def execute(self, context: Context) -> None:
|
|
146
153
|
hook = BigtableHook(
|
|
147
154
|
gcp_conn_id=self.gcp_conn_id,
|
|
@@ -155,7 +162,7 @@ class BigtableCreateInstanceOperator(GoogleCloudBaseOperator, BigtableValidation
|
|
|
155
162
|
"The instance '%s' already exists in this project. Consider it as created",
|
|
156
163
|
self.instance_id,
|
|
157
164
|
)
|
|
158
|
-
BigtableInstanceLink.persist(context=context
|
|
165
|
+
BigtableInstanceLink.persist(context=context)
|
|
159
166
|
return
|
|
160
167
|
try:
|
|
161
168
|
hook.create_instance(
|
|
@@ -171,7 +178,7 @@ class BigtableCreateInstanceOperator(GoogleCloudBaseOperator, BigtableValidation
|
|
|
171
178
|
cluster_storage_type=self.cluster_storage_type,
|
|
172
179
|
timeout=self.timeout,
|
|
173
180
|
)
|
|
174
|
-
BigtableInstanceLink.persist(context=context
|
|
181
|
+
BigtableInstanceLink.persist(context=context)
|
|
175
182
|
except google.api_core.exceptions.GoogleAPICallError as e:
|
|
176
183
|
self.log.error("An error occurred. Exiting.")
|
|
177
184
|
raise e
|
|
@@ -240,6 +247,13 @@ class BigtableUpdateInstanceOperator(GoogleCloudBaseOperator, BigtableValidation
|
|
|
240
247
|
self.impersonation_chain = impersonation_chain
|
|
241
248
|
super().__init__(**kwargs)
|
|
242
249
|
|
|
250
|
+
@property
|
|
251
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
252
|
+
return {
|
|
253
|
+
"instance_id": self.instance_id,
|
|
254
|
+
"project_id": self.project_id,
|
|
255
|
+
}
|
|
256
|
+
|
|
243
257
|
def execute(self, context: Context) -> None:
|
|
244
258
|
hook = BigtableHook(
|
|
245
259
|
gcp_conn_id=self.gcp_conn_id,
|
|
@@ -258,7 +272,7 @@ class BigtableUpdateInstanceOperator(GoogleCloudBaseOperator, BigtableValidation
|
|
|
258
272
|
instance_labels=self.instance_labels,
|
|
259
273
|
timeout=self.timeout,
|
|
260
274
|
)
|
|
261
|
-
BigtableInstanceLink.persist(context=context
|
|
275
|
+
BigtableInstanceLink.persist(context=context)
|
|
262
276
|
except google.api_core.exceptions.GoogleAPICallError as e:
|
|
263
277
|
self.log.error("An error occurred. Exiting.")
|
|
264
278
|
raise e
|
|
@@ -414,6 +428,13 @@ class BigtableCreateTableOperator(GoogleCloudBaseOperator, BigtableValidationMix
|
|
|
414
428
|
return False
|
|
415
429
|
return True
|
|
416
430
|
|
|
431
|
+
@property
|
|
432
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
433
|
+
return {
|
|
434
|
+
"instance_id": self.instance_id,
|
|
435
|
+
"project_id": self.project_id,
|
|
436
|
+
}
|
|
437
|
+
|
|
417
438
|
def execute(self, context: Context) -> None:
|
|
418
439
|
hook = BigtableHook(
|
|
419
440
|
gcp_conn_id=self.gcp_conn_id,
|
|
@@ -431,7 +452,7 @@ class BigtableCreateTableOperator(GoogleCloudBaseOperator, BigtableValidationMix
|
|
|
431
452
|
initial_split_keys=self.initial_split_keys,
|
|
432
453
|
column_families=self.column_families,
|
|
433
454
|
)
|
|
434
|
-
BigtableTablesLink.persist(context=context
|
|
455
|
+
BigtableTablesLink.persist(context=context)
|
|
435
456
|
except google.api_core.exceptions.AlreadyExists:
|
|
436
457
|
if not self._compare_column_families(hook, instance):
|
|
437
458
|
raise AirflowException(
|
|
@@ -575,6 +596,14 @@ class BigtableUpdateClusterOperator(GoogleCloudBaseOperator, BigtableValidationM
|
|
|
575
596
|
self.impersonation_chain = impersonation_chain
|
|
576
597
|
super().__init__(**kwargs)
|
|
577
598
|
|
|
599
|
+
@property
|
|
600
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
601
|
+
return {
|
|
602
|
+
"instance_id": self.instance_id,
|
|
603
|
+
"cluster_id": self.cluster_id,
|
|
604
|
+
"project_id": self.project_id,
|
|
605
|
+
}
|
|
606
|
+
|
|
578
607
|
def execute(self, context: Context) -> None:
|
|
579
608
|
hook = BigtableHook(
|
|
580
609
|
gcp_conn_id=self.gcp_conn_id,
|
|
@@ -586,7 +615,7 @@ class BigtableUpdateClusterOperator(GoogleCloudBaseOperator, BigtableValidationM
|
|
|
586
615
|
|
|
587
616
|
try:
|
|
588
617
|
hook.update_cluster(instance=instance, cluster_id=self.cluster_id, nodes=self.nodes)
|
|
589
|
-
BigtableClusterLink.persist(context=context
|
|
618
|
+
BigtableClusterLink.persist(context=context)
|
|
590
619
|
except google.api_core.exceptions.NotFound:
|
|
591
620
|
raise AirflowException(
|
|
592
621
|
f"Dependency: cluster '{self.cluster_id}' does not exist for instance '{self.instance_id}'."
|
|
@@ -19,9 +19,11 @@
|
|
|
19
19
|
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
22
|
+
from typing import Any
|
|
23
|
+
|
|
22
24
|
from google.api_core.gapic_v1.method import DEFAULT
|
|
23
25
|
|
|
24
|
-
from airflow.
|
|
26
|
+
from airflow.providers.google.version_compat import BaseOperator
|
|
25
27
|
|
|
26
28
|
|
|
27
29
|
class GoogleCloudBaseOperator(BaseOperator):
|
|
@@ -36,3 +38,21 @@ class GoogleCloudBaseOperator(BaseOperator):
|
|
|
36
38
|
"""
|
|
37
39
|
memo[id(DEFAULT)] = DEFAULT
|
|
38
40
|
return super().__deepcopy__(memo)
|
|
41
|
+
|
|
42
|
+
@property
|
|
43
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
44
|
+
"""
|
|
45
|
+
Override this method to include parameters for link formatting in extra links.
|
|
46
|
+
|
|
47
|
+
For example; most of the links on the Google provider require `project_id` and `location` in the Link.
|
|
48
|
+
To be not repeat; you can override this function and return something like the following:
|
|
49
|
+
|
|
50
|
+
.. code-block:: python
|
|
51
|
+
|
|
52
|
+
{
|
|
53
|
+
"project_id": self.project_id,
|
|
54
|
+
"location": self.location,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
"""
|
|
58
|
+
return {}
|
|
@@ -23,7 +23,7 @@ from typing import TYPE_CHECKING
|
|
|
23
23
|
from google.cloud.batch_v1 import Job, Task
|
|
24
24
|
|
|
25
25
|
from airflow.configuration import conf
|
|
26
|
-
from airflow.
|
|
26
|
+
from airflow.providers.common.compat.sdk import AirflowException
|
|
27
27
|
from airflow.providers.google.cloud.hooks.cloud_batch import CloudBatchHook
|
|
28
28
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
|
29
29
|
from airflow.providers.google.cloud.triggers.cloud_batch import CloudBatchJobFinishedTrigger
|
|
@@ -31,7 +31,7 @@ from airflow.providers.google.cloud.triggers.cloud_batch import CloudBatchJobFin
|
|
|
31
31
|
if TYPE_CHECKING:
|
|
32
32
|
from google.api_core import operation
|
|
33
33
|
|
|
34
|
-
from airflow.
|
|
34
|
+
from airflow.providers.common.compat.sdk import Context
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
class CloudBatchSubmitJobOperator(GoogleCloudBaseOperator):
|
|
@@ -244,7 +244,7 @@ class CloudBatchListTasksOperator(GoogleCloudBaseOperator):
|
|
|
244
244
|
:param job_name: Required. The name of the job for which to list tasks.
|
|
245
245
|
:param gcp_conn_id: The connection ID used to connect to Google Cloud.
|
|
246
246
|
:param filter: The filter based on which to list the jobs. If left empty, all the jobs are listed.
|
|
247
|
-
:param group_name: The name of the group that owns the task. By default it's `group0`.
|
|
247
|
+
:param group_name: The name of the group that owns the task. By default, it's `group0`.
|
|
248
248
|
:param limit: The number of tasks to list.
|
|
249
249
|
If left empty, all the tasks matching the filter will be returned.
|
|
250
250
|
:param impersonation_chain: Optional service account to impersonate using short-term
|
|
@@ -30,7 +30,7 @@ from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
|
|
30
30
|
from google.cloud.devtools.cloudbuild_v1.types import Build, BuildTrigger, RepoSource
|
|
31
31
|
|
|
32
32
|
from airflow.configuration import conf
|
|
33
|
-
from airflow.
|
|
33
|
+
from airflow.providers.common.compat.sdk import AirflowException
|
|
34
34
|
from airflow.providers.google.cloud.hooks.cloud_build import CloudBuildHook
|
|
35
35
|
from airflow.providers.google.cloud.links.cloud_build import (
|
|
36
36
|
CloudBuildLink,
|
|
@@ -48,7 +48,7 @@ from airflow.utils.helpers import exactly_one
|
|
|
48
48
|
if TYPE_CHECKING:
|
|
49
49
|
from google.api_core.retry import Retry
|
|
50
50
|
|
|
51
|
-
from airflow.
|
|
51
|
+
from airflow.providers.common.compat.sdk import Context
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
REGEX_REPO_PATH = re.compile(r"^/(?P<project_id>[^/]+)/(?P<repo_name>[^/]+)[\+/]*(?P<branch_name>[^:]+)?")
|
|
@@ -108,6 +108,12 @@ class CloudBuildCancelBuildOperator(GoogleCloudBaseOperator):
|
|
|
108
108
|
self.impersonation_chain = impersonation_chain
|
|
109
109
|
self.location = location
|
|
110
110
|
|
|
111
|
+
@property
|
|
112
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
113
|
+
return {
|
|
114
|
+
"region": self.location,
|
|
115
|
+
}
|
|
116
|
+
|
|
111
117
|
def execute(self, context: Context):
|
|
112
118
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
113
119
|
result = hook.cancel_build(
|
|
@@ -119,14 +125,12 @@ class CloudBuildCancelBuildOperator(GoogleCloudBaseOperator):
|
|
|
119
125
|
location=self.location,
|
|
120
126
|
)
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
context["task_instance"].xcom_push(key="id", value=result.id)
|
|
123
129
|
project_id = self.project_id or hook.project_id
|
|
124
130
|
if project_id:
|
|
125
131
|
CloudBuildLink.persist(
|
|
126
132
|
context=context,
|
|
127
|
-
task_instance=self,
|
|
128
133
|
project_id=project_id,
|
|
129
|
-
region=self.location,
|
|
130
134
|
build_id=result.id,
|
|
131
135
|
)
|
|
132
136
|
return Build.to_dict(result)
|
|
@@ -210,6 +214,12 @@ class CloudBuildCreateBuildOperator(GoogleCloudBaseOperator):
|
|
|
210
214
|
if self.build_raw.endswith(".json"):
|
|
211
215
|
self.build = json.loads(file.read())
|
|
212
216
|
|
|
217
|
+
@property
|
|
218
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
219
|
+
return {
|
|
220
|
+
"region": self.location,
|
|
221
|
+
}
|
|
222
|
+
|
|
213
223
|
def execute(self, context: Context):
|
|
214
224
|
hook = CloudBuildHook(
|
|
215
225
|
gcp_conn_id=self.gcp_conn_id,
|
|
@@ -225,7 +235,7 @@ class CloudBuildCreateBuildOperator(GoogleCloudBaseOperator):
|
|
|
225
235
|
metadata=self.metadata,
|
|
226
236
|
location=self.location,
|
|
227
237
|
)
|
|
228
|
-
|
|
238
|
+
context["task_instance"].xcom_push(key="id", value=self.id_)
|
|
229
239
|
if not self.wait:
|
|
230
240
|
return Build.to_dict(
|
|
231
241
|
hook.get_build(id_=self.id_, project_id=self.project_id, location=self.location)
|
|
@@ -251,9 +261,7 @@ class CloudBuildCreateBuildOperator(GoogleCloudBaseOperator):
|
|
|
251
261
|
if project_id:
|
|
252
262
|
CloudBuildLink.persist(
|
|
253
263
|
context=context,
|
|
254
|
-
task_instance=self,
|
|
255
264
|
project_id=project_id,
|
|
256
|
-
region=self.location,
|
|
257
265
|
build_id=cloud_build_instance_result.id,
|
|
258
266
|
)
|
|
259
267
|
return Build.to_dict(cloud_build_instance_result)
|
|
@@ -269,9 +277,7 @@ class CloudBuildCreateBuildOperator(GoogleCloudBaseOperator):
|
|
|
269
277
|
if project_id:
|
|
270
278
|
CloudBuildLink.persist(
|
|
271
279
|
context=context,
|
|
272
|
-
task_instance=self,
|
|
273
280
|
project_id=project_id,
|
|
274
|
-
region=self.location,
|
|
275
281
|
build_id=event["id_"],
|
|
276
282
|
)
|
|
277
283
|
return event["instance"]
|
|
@@ -336,6 +342,12 @@ class CloudBuildCreateBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
336
342
|
self.impersonation_chain = impersonation_chain
|
|
337
343
|
self.location = location
|
|
338
344
|
|
|
345
|
+
@property
|
|
346
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
347
|
+
return {
|
|
348
|
+
"region": self.location,
|
|
349
|
+
}
|
|
350
|
+
|
|
339
351
|
def execute(self, context: Context):
|
|
340
352
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
341
353
|
result = hook.create_build_trigger(
|
|
@@ -346,21 +358,17 @@ class CloudBuildCreateBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
346
358
|
metadata=self.metadata,
|
|
347
359
|
location=self.location,
|
|
348
360
|
)
|
|
349
|
-
|
|
361
|
+
context["task_instance"].xcom_push(key="id", value=result.id)
|
|
350
362
|
project_id = self.project_id or hook.project_id
|
|
351
363
|
if project_id:
|
|
352
364
|
CloudBuildTriggerDetailsLink.persist(
|
|
353
365
|
context=context,
|
|
354
|
-
task_instance=self,
|
|
355
366
|
project_id=project_id,
|
|
356
|
-
region=self.location,
|
|
357
367
|
trigger_id=result.id,
|
|
358
368
|
)
|
|
359
369
|
CloudBuildTriggersListLink.persist(
|
|
360
370
|
context=context,
|
|
361
|
-
task_instance=self,
|
|
362
371
|
project_id=project_id,
|
|
363
|
-
region=self.location,
|
|
364
372
|
)
|
|
365
373
|
return BuildTrigger.to_dict(result)
|
|
366
374
|
|
|
@@ -419,6 +427,12 @@ class CloudBuildDeleteBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
419
427
|
self.impersonation_chain = impersonation_chain
|
|
420
428
|
self.location = location
|
|
421
429
|
|
|
430
|
+
@property
|
|
431
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
432
|
+
return {
|
|
433
|
+
"region": self.location,
|
|
434
|
+
}
|
|
435
|
+
|
|
422
436
|
def execute(self, context: Context):
|
|
423
437
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
424
438
|
hook.delete_build_trigger(
|
|
@@ -433,9 +447,7 @@ class CloudBuildDeleteBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
433
447
|
if project_id:
|
|
434
448
|
CloudBuildTriggersListLink.persist(
|
|
435
449
|
context=context,
|
|
436
|
-
task_instance=self,
|
|
437
450
|
project_id=project_id,
|
|
438
|
-
region=self.location,
|
|
439
451
|
)
|
|
440
452
|
|
|
441
453
|
|
|
@@ -493,6 +505,12 @@ class CloudBuildGetBuildOperator(GoogleCloudBaseOperator):
|
|
|
493
505
|
self.impersonation_chain = impersonation_chain
|
|
494
506
|
self.location = location
|
|
495
507
|
|
|
508
|
+
@property
|
|
509
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
510
|
+
return {
|
|
511
|
+
"region": self.location,
|
|
512
|
+
}
|
|
513
|
+
|
|
496
514
|
def execute(self, context: Context):
|
|
497
515
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
498
516
|
result = hook.get_build(
|
|
@@ -507,9 +525,7 @@ class CloudBuildGetBuildOperator(GoogleCloudBaseOperator):
|
|
|
507
525
|
if project_id:
|
|
508
526
|
CloudBuildLink.persist(
|
|
509
527
|
context=context,
|
|
510
|
-
task_instance=self,
|
|
511
528
|
project_id=project_id,
|
|
512
|
-
region=self.location,
|
|
513
529
|
build_id=result.id,
|
|
514
530
|
)
|
|
515
531
|
return Build.to_dict(result)
|
|
@@ -569,6 +585,12 @@ class CloudBuildGetBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
569
585
|
self.impersonation_chain = impersonation_chain
|
|
570
586
|
self.location = location
|
|
571
587
|
|
|
588
|
+
@property
|
|
589
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
590
|
+
return {
|
|
591
|
+
"region": self.location,
|
|
592
|
+
}
|
|
593
|
+
|
|
572
594
|
def execute(self, context: Context):
|
|
573
595
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
574
596
|
result = hook.get_build_trigger(
|
|
@@ -583,9 +605,7 @@ class CloudBuildGetBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
583
605
|
if project_id:
|
|
584
606
|
CloudBuildTriggerDetailsLink.persist(
|
|
585
607
|
context=context,
|
|
586
|
-
task_instance=self,
|
|
587
608
|
project_id=project_id,
|
|
588
|
-
region=self.location,
|
|
589
609
|
trigger_id=result.id,
|
|
590
610
|
)
|
|
591
611
|
return BuildTrigger.to_dict(result)
|
|
@@ -649,6 +669,12 @@ class CloudBuildListBuildTriggersOperator(GoogleCloudBaseOperator):
|
|
|
649
669
|
self.gcp_conn_id = gcp_conn_id
|
|
650
670
|
self.impersonation_chain = impersonation_chain
|
|
651
671
|
|
|
672
|
+
@property
|
|
673
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
674
|
+
return {
|
|
675
|
+
"region": self.location,
|
|
676
|
+
}
|
|
677
|
+
|
|
652
678
|
def execute(self, context: Context):
|
|
653
679
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
654
680
|
results = hook.list_build_triggers(
|
|
@@ -664,9 +690,7 @@ class CloudBuildListBuildTriggersOperator(GoogleCloudBaseOperator):
|
|
|
664
690
|
if project_id:
|
|
665
691
|
CloudBuildTriggersListLink.persist(
|
|
666
692
|
context=context,
|
|
667
|
-
task_instance=self,
|
|
668
693
|
project_id=project_id,
|
|
669
|
-
region=self.location,
|
|
670
694
|
)
|
|
671
695
|
return [BuildTrigger.to_dict(result) for result in results]
|
|
672
696
|
|
|
@@ -729,6 +753,12 @@ class CloudBuildListBuildsOperator(GoogleCloudBaseOperator):
|
|
|
729
753
|
self.gcp_conn_id = gcp_conn_id
|
|
730
754
|
self.impersonation_chain = impersonation_chain
|
|
731
755
|
|
|
756
|
+
@property
|
|
757
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
758
|
+
return {
|
|
759
|
+
"region": self.location,
|
|
760
|
+
}
|
|
761
|
+
|
|
732
762
|
def execute(self, context: Context):
|
|
733
763
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
734
764
|
results = hook.list_builds(
|
|
@@ -743,7 +773,8 @@ class CloudBuildListBuildsOperator(GoogleCloudBaseOperator):
|
|
|
743
773
|
project_id = self.project_id or hook.project_id
|
|
744
774
|
if project_id:
|
|
745
775
|
CloudBuildListLink.persist(
|
|
746
|
-
context=context,
|
|
776
|
+
context=context,
|
|
777
|
+
project_id=project_id,
|
|
747
778
|
)
|
|
748
779
|
return [Build.to_dict(result) for result in results]
|
|
749
780
|
|
|
@@ -805,6 +836,12 @@ class CloudBuildRetryBuildOperator(GoogleCloudBaseOperator):
|
|
|
805
836
|
self.impersonation_chain = impersonation_chain
|
|
806
837
|
self.location = location
|
|
807
838
|
|
|
839
|
+
@property
|
|
840
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
841
|
+
return {
|
|
842
|
+
"region": self.location,
|
|
843
|
+
}
|
|
844
|
+
|
|
808
845
|
def execute(self, context: Context):
|
|
809
846
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
810
847
|
result = hook.retry_build(
|
|
@@ -817,14 +854,12 @@ class CloudBuildRetryBuildOperator(GoogleCloudBaseOperator):
|
|
|
817
854
|
location=self.location,
|
|
818
855
|
)
|
|
819
856
|
|
|
820
|
-
|
|
857
|
+
context["task_instance"].xcom_push(key="id", value=result.id)
|
|
821
858
|
project_id = self.project_id or hook.project_id
|
|
822
859
|
if project_id:
|
|
823
860
|
CloudBuildLink.persist(
|
|
824
861
|
context=context,
|
|
825
|
-
task_instance=self,
|
|
826
862
|
project_id=project_id,
|
|
827
|
-
region=self.location,
|
|
828
863
|
build_id=result.id,
|
|
829
864
|
)
|
|
830
865
|
return Build.to_dict(result)
|
|
@@ -891,6 +926,12 @@ class CloudBuildRunBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
891
926
|
self.impersonation_chain = impersonation_chain
|
|
892
927
|
self.location = location
|
|
893
928
|
|
|
929
|
+
@property
|
|
930
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
931
|
+
return {
|
|
932
|
+
"region": self.location,
|
|
933
|
+
}
|
|
934
|
+
|
|
894
935
|
def execute(self, context: Context):
|
|
895
936
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
896
937
|
result = hook.run_build_trigger(
|
|
@@ -903,14 +944,12 @@ class CloudBuildRunBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
903
944
|
metadata=self.metadata,
|
|
904
945
|
location=self.location,
|
|
905
946
|
)
|
|
906
|
-
|
|
947
|
+
context["task_instance"].xcom_push(key="id", value=result.id)
|
|
907
948
|
project_id = self.project_id or hook.project_id
|
|
908
949
|
if project_id:
|
|
909
950
|
CloudBuildLink.persist(
|
|
910
951
|
context=context,
|
|
911
|
-
task_instance=self,
|
|
912
952
|
project_id=project_id,
|
|
913
|
-
region=self.location,
|
|
914
953
|
build_id=result.id,
|
|
915
954
|
)
|
|
916
955
|
return Build.to_dict(result)
|
|
@@ -974,6 +1013,12 @@ class CloudBuildUpdateBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
974
1013
|
self.impersonation_chain = impersonation_chain
|
|
975
1014
|
self.location = location
|
|
976
1015
|
|
|
1016
|
+
@property
|
|
1017
|
+
def extra_links_params(self) -> dict[str, Any]:
|
|
1018
|
+
return {
|
|
1019
|
+
"region": self.location,
|
|
1020
|
+
}
|
|
1021
|
+
|
|
977
1022
|
def execute(self, context: Context):
|
|
978
1023
|
hook = CloudBuildHook(gcp_conn_id=self.gcp_conn_id, impersonation_chain=self.impersonation_chain)
|
|
979
1024
|
result = hook.update_build_trigger(
|
|
@@ -985,14 +1030,12 @@ class CloudBuildUpdateBuildTriggerOperator(GoogleCloudBaseOperator):
|
|
|
985
1030
|
metadata=self.metadata,
|
|
986
1031
|
location=self.location,
|
|
987
1032
|
)
|
|
988
|
-
|
|
1033
|
+
context["task_instance"].xcom_push(key="id", value=result.id)
|
|
989
1034
|
project_id = self.project_id or hook.project_id
|
|
990
1035
|
if project_id:
|
|
991
1036
|
CloudBuildTriggerDetailsLink.persist(
|
|
992
1037
|
context=context,
|
|
993
|
-
task_instance=self,
|
|
994
1038
|
project_id=project_id,
|
|
995
|
-
region=self.location,
|
|
996
1039
|
trigger_id=result.id,
|
|
997
1040
|
)
|
|
998
1041
|
return BuildTrigger.to_dict(result)
|