apache-airflow-providers-google 10.17.0rc1__py3-none-any.whl → 10.18.0rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/__init__.py +3 -3
- airflow/providers/google/cloud/hooks/automl.py +1 -1
- airflow/providers/google/cloud/hooks/bigquery.py +64 -33
- airflow/providers/google/cloud/hooks/cloud_composer.py +250 -2
- airflow/providers/google/cloud/hooks/cloud_sql.py +154 -7
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +7 -2
- airflow/providers/google/cloud/hooks/compute_ssh.py +2 -1
- airflow/providers/google/cloud/hooks/dataflow.py +246 -32
- airflow/providers/google/cloud/hooks/dataplex.py +6 -2
- airflow/providers/google/cloud/hooks/dlp.py +14 -14
- airflow/providers/google/cloud/hooks/gcs.py +6 -2
- airflow/providers/google/cloud/hooks/gdm.py +2 -2
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +2 -2
- airflow/providers/google/cloud/hooks/mlengine.py +8 -4
- airflow/providers/google/cloud/hooks/pubsub.py +1 -1
- airflow/providers/google/cloud/hooks/secret_manager.py +252 -4
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +1431 -74
- airflow/providers/google/cloud/links/vertex_ai.py +2 -1
- airflow/providers/google/cloud/log/gcs_task_handler.py +2 -1
- airflow/providers/google/cloud/operators/automl.py +13 -12
- airflow/providers/google/cloud/operators/bigquery.py +36 -22
- airflow/providers/google/cloud/operators/bigquery_dts.py +4 -3
- airflow/providers/google/cloud/operators/bigtable.py +7 -6
- airflow/providers/google/cloud/operators/cloud_build.py +12 -11
- airflow/providers/google/cloud/operators/cloud_composer.py +147 -2
- airflow/providers/google/cloud/operators/cloud_memorystore.py +17 -16
- airflow/providers/google/cloud/operators/cloud_sql.py +60 -17
- airflow/providers/google/cloud/operators/cloud_storage_transfer_service.py +35 -16
- airflow/providers/google/cloud/operators/compute.py +12 -11
- airflow/providers/google/cloud/operators/datacatalog.py +21 -20
- airflow/providers/google/cloud/operators/dataflow.py +59 -42
- airflow/providers/google/cloud/operators/datafusion.py +11 -10
- airflow/providers/google/cloud/operators/datapipeline.py +3 -2
- airflow/providers/google/cloud/operators/dataprep.py +5 -4
- airflow/providers/google/cloud/operators/dataproc.py +19 -16
- airflow/providers/google/cloud/operators/datastore.py +8 -7
- airflow/providers/google/cloud/operators/dlp.py +31 -30
- airflow/providers/google/cloud/operators/functions.py +4 -3
- airflow/providers/google/cloud/operators/gcs.py +66 -41
- airflow/providers/google/cloud/operators/kubernetes_engine.py +232 -12
- airflow/providers/google/cloud/operators/life_sciences.py +2 -1
- airflow/providers/google/cloud/operators/mlengine.py +11 -10
- airflow/providers/google/cloud/operators/pubsub.py +6 -5
- airflow/providers/google/cloud/operators/spanner.py +7 -6
- airflow/providers/google/cloud/operators/speech_to_text.py +2 -1
- airflow/providers/google/cloud/operators/stackdriver.py +11 -10
- airflow/providers/google/cloud/operators/tasks.py +14 -13
- airflow/providers/google/cloud/operators/text_to_speech.py +2 -1
- airflow/providers/google/cloud/operators/translate_speech.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +333 -26
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +20 -12
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +0 -1
- airflow/providers/google/cloud/operators/vision.py +13 -12
- airflow/providers/google/cloud/operators/workflows.py +10 -9
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -1
- airflow/providers/google/cloud/sensors/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/sensors/bigtable.py +2 -1
- airflow/providers/google/cloud/sensors/cloud_storage_transfer_service.py +2 -1
- airflow/providers/google/cloud/sensors/dataflow.py +239 -52
- airflow/providers/google/cloud/sensors/datafusion.py +2 -1
- airflow/providers/google/cloud/sensors/dataproc.py +3 -2
- airflow/providers/google/cloud/sensors/gcs.py +14 -12
- airflow/providers/google/cloud/sensors/tasks.py +2 -1
- airflow/providers/google/cloud/sensors/workflows.py +2 -1
- airflow/providers/google/cloud/transfers/adls_to_gcs.py +8 -2
- airflow/providers/google/cloud/transfers/azure_blob_to_gcs.py +7 -1
- airflow/providers/google/cloud/transfers/azure_fileshare_to_gcs.py +7 -1
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +2 -1
- airflow/providers/google/cloud/transfers/bigquery_to_mssql.py +1 -1
- airflow/providers/google/cloud/transfers/bigquery_to_sql.py +1 -0
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +5 -6
- airflow/providers/google/cloud/transfers/gcs_to_gcs.py +22 -12
- airflow/providers/google/cloud/triggers/bigquery.py +14 -3
- airflow/providers/google/cloud/triggers/cloud_composer.py +68 -0
- airflow/providers/google/cloud/triggers/cloud_sql.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +2 -1
- airflow/providers/google/cloud/triggers/dataflow.py +504 -4
- airflow/providers/google/cloud/triggers/dataproc.py +110 -26
- airflow/providers/google/cloud/triggers/mlengine.py +2 -1
- airflow/providers/google/cloud/triggers/vertex_ai.py +94 -0
- airflow/providers/google/common/hooks/base_google.py +45 -7
- airflow/providers/google/firebase/hooks/firestore.py +2 -2
- airflow/providers/google/firebase/operators/firestore.py +2 -1
- airflow/providers/google/get_provider_info.py +3 -2
- {apache_airflow_providers_google-10.17.0rc1.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/METADATA +8 -8
- {apache_airflow_providers_google-10.17.0rc1.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/RECORD +88 -89
- airflow/providers/google/cloud/example_dags/example_cloud_sql_query.py +0 -289
- {apache_airflow_providers_google-10.17.0rc1.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-10.17.0rc1.dist-info → apache_airflow_providers_google-10.18.0rc1.dist-info}/entry_points.txt +0 -0
@@ -36,6 +36,7 @@ from airflow.providers.google.cloud.links.compute import (
|
|
36
36
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
37
37
|
from airflow.providers.google.cloud.utils.field_sanitizer import GcpBodyFieldSanitizer
|
38
38
|
from airflow.providers.google.cloud.utils.field_validator import GcpBodyFieldValidator
|
39
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
39
40
|
|
40
41
|
if TYPE_CHECKING:
|
41
42
|
from google.api_core.retry import Retry
|
@@ -51,7 +52,7 @@ class ComputeEngineBaseOperator(GoogleCloudBaseOperator):
|
|
51
52
|
*,
|
52
53
|
zone: str,
|
53
54
|
resource_id: str | None = None,
|
54
|
-
project_id: str
|
55
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
55
56
|
gcp_conn_id: str = "google_cloud_default",
|
56
57
|
api_version: str = "v1",
|
57
58
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -138,7 +139,7 @@ class ComputeEngineInsertInstanceOperator(ComputeEngineBaseOperator):
|
|
138
139
|
body: dict,
|
139
140
|
zone: str,
|
140
141
|
resource_id: str | None = None,
|
141
|
-
project_id: str
|
142
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
142
143
|
request_id: str | None = None,
|
143
144
|
retry: Retry | None = None,
|
144
145
|
timeout: float | None = None,
|
@@ -320,7 +321,7 @@ class ComputeEngineInsertInstanceFromTemplateOperator(ComputeEngineBaseOperator)
|
|
320
321
|
body: dict,
|
321
322
|
zone: str,
|
322
323
|
resource_id: str | None = None,
|
323
|
-
project_id: str
|
324
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
324
325
|
request_id: str | None = None,
|
325
326
|
retry: Retry | None = None,
|
326
327
|
timeout: float | None = None,
|
@@ -477,7 +478,7 @@ class ComputeEngineDeleteInstanceOperator(ComputeEngineBaseOperator):
|
|
477
478
|
resource_id: str,
|
478
479
|
zone: str,
|
479
480
|
request_id: str | None = None,
|
480
|
-
project_id: str
|
481
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
481
482
|
retry: Retry | None = None,
|
482
483
|
timeout: float | None = None,
|
483
484
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -721,7 +722,7 @@ class ComputeEngineSetMachineTypeOperator(ComputeEngineBaseOperator):
|
|
721
722
|
zone: str,
|
722
723
|
resource_id: str,
|
723
724
|
body: dict,
|
724
|
-
project_id: str
|
725
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
725
726
|
gcp_conn_id: str = "google_cloud_default",
|
726
727
|
api_version: str = "v1",
|
727
728
|
validate_body: bool = True,
|
@@ -882,7 +883,7 @@ class ComputeEngineInsertInstanceTemplateOperator(ComputeEngineBaseOperator):
|
|
882
883
|
self,
|
883
884
|
*,
|
884
885
|
body: dict,
|
885
|
-
project_id: str
|
886
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
886
887
|
resource_id: str | None = None,
|
887
888
|
request_id: str | None = None,
|
888
889
|
retry: Retry | None = None,
|
@@ -1044,7 +1045,7 @@ class ComputeEngineDeleteInstanceTemplateOperator(ComputeEngineBaseOperator):
|
|
1044
1045
|
*,
|
1045
1046
|
resource_id: str,
|
1046
1047
|
request_id: str | None = None,
|
1047
|
-
project_id: str
|
1048
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1048
1049
|
retry: Retry | None = None,
|
1049
1050
|
timeout: float | None = None,
|
1050
1051
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1164,7 +1165,7 @@ class ComputeEngineCopyInstanceTemplateOperator(ComputeEngineBaseOperator):
|
|
1164
1165
|
*,
|
1165
1166
|
resource_id: str,
|
1166
1167
|
body_patch: dict,
|
1167
|
-
project_id: str
|
1168
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1168
1169
|
request_id: str | None = None,
|
1169
1170
|
gcp_conn_id: str = "google_cloud_default",
|
1170
1171
|
api_version: str = "v1",
|
@@ -1323,7 +1324,7 @@ class ComputeEngineInstanceGroupUpdateManagerTemplateOperator(ComputeEngineBaseO
|
|
1323
1324
|
zone: str,
|
1324
1325
|
source_template: str,
|
1325
1326
|
destination_template: str,
|
1326
|
-
project_id: str
|
1327
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1327
1328
|
update_policy: dict[str, Any] | None = None,
|
1328
1329
|
request_id: str | None = None,
|
1329
1330
|
gcp_conn_id: str = "google_cloud_default",
|
@@ -1468,7 +1469,7 @@ class ComputeEngineInsertInstanceGroupManagerOperator(ComputeEngineBaseOperator)
|
|
1468
1469
|
*,
|
1469
1470
|
body: dict,
|
1470
1471
|
zone: str,
|
1471
|
-
project_id: str
|
1472
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1472
1473
|
resource_id: str | None = None,
|
1473
1474
|
request_id: str | None = None,
|
1474
1475
|
gcp_conn_id: str = "google_cloud_default",
|
@@ -1630,7 +1631,7 @@ class ComputeEngineDeleteInstanceGroupManagerOperator(ComputeEngineBaseOperator)
|
|
1630
1631
|
*,
|
1631
1632
|
resource_id: str,
|
1632
1633
|
zone: str,
|
1633
|
-
project_id: str
|
1634
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1634
1635
|
request_id: str | None = None,
|
1635
1636
|
gcp_conn_id: str = "google_cloud_default",
|
1636
1637
|
api_version="v1",
|
@@ -38,6 +38,7 @@ from airflow.providers.google.cloud.links.datacatalog import (
|
|
38
38
|
DataCatalogTagTemplateLink,
|
39
39
|
)
|
40
40
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
41
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
41
42
|
|
42
43
|
if TYPE_CHECKING:
|
43
44
|
from google.api_core.retry import Retry
|
@@ -104,7 +105,7 @@ class CloudDataCatalogCreateEntryOperator(GoogleCloudBaseOperator):
|
|
104
105
|
entry_group: str,
|
105
106
|
entry_id: str,
|
106
107
|
entry: dict | Entry,
|
107
|
-
project_id: str
|
108
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
108
109
|
retry: Retry | _MethodDefault = DEFAULT,
|
109
110
|
timeout: float | None = None,
|
110
111
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -220,7 +221,7 @@ class CloudDataCatalogCreateEntryGroupOperator(GoogleCloudBaseOperator):
|
|
220
221
|
location: str,
|
221
222
|
entry_group_id: str,
|
222
223
|
entry_group: dict | EntryGroup,
|
223
|
-
project_id: str
|
224
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
224
225
|
retry: Retry | _MethodDefault = DEFAULT,
|
225
226
|
timeout: float | None = None,
|
226
227
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -336,7 +337,7 @@ class CloudDataCatalogCreateTagOperator(GoogleCloudBaseOperator):
|
|
336
337
|
entry: str,
|
337
338
|
tag: dict | Tag,
|
338
339
|
template_id: str | None = None,
|
339
|
-
project_id: str
|
340
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
340
341
|
retry: Retry | _MethodDefault = DEFAULT,
|
341
342
|
timeout: float | None = None,
|
342
343
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -467,7 +468,7 @@ class CloudDataCatalogCreateTagTemplateOperator(GoogleCloudBaseOperator):
|
|
467
468
|
location: str,
|
468
469
|
tag_template_id: str,
|
469
470
|
tag_template: dict | TagTemplate,
|
470
|
-
project_id: str
|
471
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
471
472
|
retry: Retry | _MethodDefault = DEFAULT,
|
472
473
|
timeout: float | None = None,
|
473
474
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -583,7 +584,7 @@ class CloudDataCatalogCreateTagTemplateFieldOperator(GoogleCloudBaseOperator):
|
|
583
584
|
tag_template: str,
|
584
585
|
tag_template_field_id: str,
|
585
586
|
tag_template_field: dict | TagTemplateField,
|
586
|
-
project_id: str
|
587
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
587
588
|
retry: Retry | _MethodDefault = DEFAULT,
|
588
589
|
timeout: float | None = None,
|
589
590
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -690,7 +691,7 @@ class CloudDataCatalogDeleteEntryOperator(GoogleCloudBaseOperator):
|
|
690
691
|
location: str,
|
691
692
|
entry_group: str,
|
692
693
|
entry: str,
|
693
|
-
project_id: str
|
694
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
694
695
|
retry: Retry | _MethodDefault = DEFAULT,
|
695
696
|
timeout: float | None = None,
|
696
697
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -774,7 +775,7 @@ class CloudDataCatalogDeleteEntryGroupOperator(GoogleCloudBaseOperator):
|
|
774
775
|
*,
|
775
776
|
location: str,
|
776
777
|
entry_group: str,
|
777
|
-
project_id: str
|
778
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
778
779
|
retry: Retry | _MethodDefault = DEFAULT,
|
779
780
|
timeout: float | None = None,
|
780
781
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -860,7 +861,7 @@ class CloudDataCatalogDeleteTagOperator(GoogleCloudBaseOperator):
|
|
860
861
|
entry_group: str,
|
861
862
|
entry: str,
|
862
863
|
tag: str,
|
863
|
-
project_id: str
|
864
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
864
865
|
retry: Retry | _MethodDefault = DEFAULT,
|
865
866
|
timeout: float | None = None,
|
866
867
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -949,7 +950,7 @@ class CloudDataCatalogDeleteTagTemplateOperator(GoogleCloudBaseOperator):
|
|
949
950
|
location: str,
|
950
951
|
tag_template: str,
|
951
952
|
force: bool,
|
952
|
-
project_id: str
|
953
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
953
954
|
retry: Retry | _MethodDefault = DEFAULT,
|
954
955
|
timeout: float | None = None,
|
955
956
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1037,7 +1038,7 @@ class CloudDataCatalogDeleteTagTemplateFieldOperator(GoogleCloudBaseOperator):
|
|
1037
1038
|
tag_template: str,
|
1038
1039
|
field: str,
|
1039
1040
|
force: bool,
|
1040
|
-
project_id: str
|
1041
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1041
1042
|
retry: Retry | _MethodDefault = DEFAULT,
|
1042
1043
|
timeout: float | None = None,
|
1043
1044
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1125,7 +1126,7 @@ class CloudDataCatalogGetEntryOperator(GoogleCloudBaseOperator):
|
|
1125
1126
|
location: str,
|
1126
1127
|
entry_group: str,
|
1127
1128
|
entry: str,
|
1128
|
-
project_id: str
|
1129
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1129
1130
|
retry: Retry | _MethodDefault = DEFAULT,
|
1130
1131
|
timeout: float | None = None,
|
1131
1132
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1220,7 +1221,7 @@ class CloudDataCatalogGetEntryGroupOperator(GoogleCloudBaseOperator):
|
|
1220
1221
|
location: str,
|
1221
1222
|
entry_group: str,
|
1222
1223
|
read_mask: FieldMask,
|
1223
|
-
project_id: str
|
1224
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1224
1225
|
retry: Retry | _MethodDefault = DEFAULT,
|
1225
1226
|
timeout: float | None = None,
|
1226
1227
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1308,7 +1309,7 @@ class CloudDataCatalogGetTagTemplateOperator(GoogleCloudBaseOperator):
|
|
1308
1309
|
*,
|
1309
1310
|
location: str,
|
1310
1311
|
tag_template: str,
|
1311
|
-
project_id: str
|
1312
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1312
1313
|
retry: Retry | _MethodDefault = DEFAULT,
|
1313
1314
|
timeout: float | None = None,
|
1314
1315
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1403,7 +1404,7 @@ class CloudDataCatalogListTagsOperator(GoogleCloudBaseOperator):
|
|
1403
1404
|
entry_group: str,
|
1404
1405
|
entry: str,
|
1405
1406
|
page_size: int = 100,
|
1406
|
-
project_id: str
|
1407
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1407
1408
|
retry: Retry | _MethodDefault = DEFAULT,
|
1408
1409
|
timeout: float | None = None,
|
1409
1410
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1497,7 +1498,7 @@ class CloudDataCatalogLookupEntryOperator(GoogleCloudBaseOperator):
|
|
1497
1498
|
*,
|
1498
1499
|
linked_resource: str | None = None,
|
1499
1500
|
sql_resource: str | None = None,
|
1500
|
-
project_id: str
|
1501
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1501
1502
|
retry: Retry | _MethodDefault = DEFAULT,
|
1502
1503
|
timeout: float | None = None,
|
1503
1504
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1593,7 +1594,7 @@ class CloudDataCatalogRenameTagTemplateFieldOperator(GoogleCloudBaseOperator):
|
|
1593
1594
|
tag_template: str,
|
1594
1595
|
field: str,
|
1595
1596
|
new_tag_template_field_id: str,
|
1596
|
-
project_id: str
|
1597
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1597
1598
|
retry: Retry | _MethodDefault = DEFAULT,
|
1598
1599
|
timeout: float | None = None,
|
1599
1600
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1808,7 +1809,7 @@ class CloudDataCatalogUpdateEntryOperator(GoogleCloudBaseOperator):
|
|
1808
1809
|
location: str | None = None,
|
1809
1810
|
entry_group: str | None = None,
|
1810
1811
|
entry_id: str | None = None,
|
1811
|
-
project_id: str
|
1812
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1812
1813
|
retry: Retry | _MethodDefault = DEFAULT,
|
1813
1814
|
timeout: float | None = None,
|
1814
1815
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -1920,7 +1921,7 @@ class CloudDataCatalogUpdateTagOperator(GoogleCloudBaseOperator):
|
|
1920
1921
|
entry_group: str | None = None,
|
1921
1922
|
entry: str | None = None,
|
1922
1923
|
tag_id: str | None = None,
|
1923
|
-
project_id: str
|
1924
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1924
1925
|
retry: Retry | _MethodDefault = DEFAULT,
|
1925
1926
|
timeout: float | None = None,
|
1926
1927
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -2034,7 +2035,7 @@ class CloudDataCatalogUpdateTagTemplateOperator(GoogleCloudBaseOperator):
|
|
2034
2035
|
update_mask: dict | FieldMask,
|
2035
2036
|
location: str | None = None,
|
2036
2037
|
tag_template_id: str | None = None,
|
2037
|
-
project_id: str
|
2038
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
2038
2039
|
retry: Retry | _MethodDefault = DEFAULT,
|
2039
2040
|
timeout: float | None = None,
|
2040
2041
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -2151,7 +2152,7 @@ class CloudDataCatalogUpdateTagTemplateFieldOperator(GoogleCloudBaseOperator):
|
|
2151
2152
|
location: str | None = None,
|
2152
2153
|
tag_template: str | None = None,
|
2153
2154
|
tag_template_field_id: str | None = None,
|
2154
|
-
project_id: str
|
2155
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
2155
2156
|
retry: Retry | _MethodDefault = DEFAULT,
|
2156
2157
|
timeout: float | None = None,
|
2157
2158
|
metadata: Sequence[tuple[str, str]] = (),
|
@@ -41,6 +41,8 @@ from airflow.providers.google.cloud.hooks.gcs import GCSHook
|
|
41
41
|
from airflow.providers.google.cloud.links.dataflow import DataflowJobLink
|
42
42
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
43
43
|
from airflow.providers.google.cloud.triggers.dataflow import TemplateJobStartTrigger
|
44
|
+
from airflow.providers.google.common.consts import GOOGLE_DEFAULT_DEFERRABLE_METHOD_NAME
|
45
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
44
46
|
from airflow.version import version
|
45
47
|
|
46
48
|
if TYPE_CHECKING:
|
@@ -142,7 +144,7 @@ class DataflowConfiguration:
|
|
142
144
|
*,
|
143
145
|
job_name: str = "{{task.task_id}}",
|
144
146
|
append_job_name: bool = True,
|
145
|
-
project_id: str
|
147
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
146
148
|
location: str | None = DEFAULT_DATAFLOW_LOCATION,
|
147
149
|
gcp_conn_id: str = "google_cloud_default",
|
148
150
|
poll_sleep: int = 10,
|
@@ -348,7 +350,7 @@ class DataflowCreateJavaJobOperator(GoogleCloudBaseOperator):
|
|
348
350
|
job_name: str = "{{task.task_id}}",
|
349
351
|
dataflow_default_options: dict | None = None,
|
350
352
|
options: dict | None = None,
|
351
|
-
project_id: str
|
353
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
352
354
|
location: str = DEFAULT_DATAFLOW_LOCATION,
|
353
355
|
gcp_conn_id: str = "google_cloud_default",
|
354
356
|
poll_sleep: int = 10,
|
@@ -459,7 +461,7 @@ class DataflowCreateJavaJobOperator(GoogleCloudBaseOperator):
|
|
459
461
|
|
460
462
|
class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
461
463
|
"""
|
462
|
-
Start a
|
464
|
+
Start a Dataflow job with a classic template; the parameters of the operation will be passed to the job.
|
463
465
|
|
464
466
|
.. seealso::
|
465
467
|
For more information on how to use this operator, take a look at the guide:
|
@@ -606,7 +608,7 @@ class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
|
606
608
|
self,
|
607
609
|
*,
|
608
610
|
template: str,
|
609
|
-
project_id: str
|
611
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
610
612
|
job_name: str = "{{task.task_id}}",
|
611
613
|
options: dict[str, Any] | None = None,
|
612
614
|
dataflow_default_options: dict[str, Any] | None = None,
|
@@ -642,7 +644,7 @@ class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
|
642
644
|
self.deferrable = deferrable
|
643
645
|
self.expected_terminal_state = expected_terminal_state
|
644
646
|
|
645
|
-
self.job: dict | None = None
|
647
|
+
self.job: dict[str, str] | None = None
|
646
648
|
|
647
649
|
self._validate_deferrable_params()
|
648
650
|
|
@@ -680,29 +682,34 @@ class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
|
680
682
|
if not self.location:
|
681
683
|
self.location = DEFAULT_DATAFLOW_LOCATION
|
682
684
|
|
683
|
-
|
685
|
+
if not self.deferrable:
|
686
|
+
self.job = self.hook.start_template_dataflow(
|
687
|
+
job_name=self.job_name,
|
688
|
+
variables=options,
|
689
|
+
parameters=self.parameters,
|
690
|
+
dataflow_template=self.template,
|
691
|
+
on_new_job_callback=set_current_job,
|
692
|
+
project_id=self.project_id,
|
693
|
+
location=self.location,
|
694
|
+
environment=self.environment,
|
695
|
+
append_job_name=self.append_job_name,
|
696
|
+
)
|
697
|
+
job_id = self.hook.extract_job_id(self.job)
|
698
|
+
self.xcom_push(context, key="job_id", value=job_id)
|
699
|
+
return job_id
|
700
|
+
|
701
|
+
self.job = self.hook.launch_job_with_template(
|
684
702
|
job_name=self.job_name,
|
685
703
|
variables=options,
|
686
704
|
parameters=self.parameters,
|
687
705
|
dataflow_template=self.template,
|
688
|
-
on_new_job_callback=set_current_job,
|
689
706
|
project_id=self.project_id,
|
707
|
+
append_job_name=self.append_job_name,
|
690
708
|
location=self.location,
|
691
709
|
environment=self.environment,
|
692
|
-
append_job_name=self.append_job_name,
|
693
710
|
)
|
694
|
-
job_id = self.
|
695
|
-
|
696
|
-
if job_id is None:
|
697
|
-
raise AirflowException(
|
698
|
-
"While reading job object after template execution error occurred. Job object has no id."
|
699
|
-
)
|
700
|
-
|
701
|
-
if not self.deferrable:
|
702
|
-
return job_id
|
703
|
-
|
704
|
-
context["ti"].xcom_push(key="job_id", value=job_id)
|
705
|
-
|
711
|
+
job_id = self.hook.extract_job_id(self.job)
|
712
|
+
DataflowJobLink.persist(self, context, self.project_id, self.location, job_id)
|
706
713
|
self.defer(
|
707
714
|
trigger=TemplateJobStartTrigger(
|
708
715
|
project_id=self.project_id,
|
@@ -713,16 +720,17 @@ class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
|
713
720
|
impersonation_chain=self.impersonation_chain,
|
714
721
|
cancel_timeout=self.cancel_timeout,
|
715
722
|
),
|
716
|
-
method_name=
|
723
|
+
method_name=GOOGLE_DEFAULT_DEFERRABLE_METHOD_NAME,
|
717
724
|
)
|
718
725
|
|
719
|
-
def execute_complete(self, context: Context, event: dict[str, Any]):
|
726
|
+
def execute_complete(self, context: Context, event: dict[str, Any]) -> str:
|
720
727
|
"""Execute after trigger finishes its work."""
|
721
728
|
if event["status"] in ("error", "stopped"):
|
722
729
|
self.log.info("status: %s, msg: %s", event["status"], event["message"])
|
723
730
|
raise AirflowException(event["message"])
|
724
731
|
|
725
732
|
job_id = event["job_id"]
|
733
|
+
self.xcom_push(context, key="job_id", value=job_id)
|
726
734
|
self.log.info("Task %s completed with response %s", self.task_id, event["message"])
|
727
735
|
return job_id
|
728
736
|
|
@@ -740,7 +748,7 @@ class DataflowTemplatedJobStartOperator(GoogleCloudBaseOperator):
|
|
740
748
|
|
741
749
|
class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
742
750
|
"""
|
743
|
-
Starts
|
751
|
+
Starts a Dataflow Job with a Flex Template.
|
744
752
|
|
745
753
|
.. seealso::
|
746
754
|
For more information on how to use this operator, take a look at the guide:
|
@@ -802,6 +810,9 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
802
810
|
:param expected_terminal_state: The expected final status of the operator on which the corresponding
|
803
811
|
Airflow task succeeds. When not specified, it will be determined by the hook.
|
804
812
|
:param append_job_name: True if unique suffix has to be appended to job name.
|
813
|
+
:param poll_sleep: The time in seconds to sleep between polling Google
|
814
|
+
Cloud Platform for the dataflow job status while the job is in the
|
815
|
+
JOB_STATE_RUNNING state.
|
805
816
|
"""
|
806
817
|
|
807
818
|
template_fields: Sequence[str] = ("body", "location", "project_id", "gcp_conn_id")
|
@@ -811,7 +822,7 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
811
822
|
self,
|
812
823
|
body: dict,
|
813
824
|
location: str,
|
814
|
-
project_id: str
|
825
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
815
826
|
gcp_conn_id: str = "google_cloud_default",
|
816
827
|
drain_pipeline: bool = False,
|
817
828
|
cancel_timeout: int | None = 10 * 60,
|
@@ -820,6 +831,7 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
820
831
|
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
821
832
|
append_job_name: bool = True,
|
822
833
|
expected_terminal_state: str | None = None,
|
834
|
+
poll_sleep: int = 10,
|
823
835
|
*args,
|
824
836
|
**kwargs,
|
825
837
|
) -> None:
|
@@ -831,11 +843,12 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
831
843
|
self.drain_pipeline = drain_pipeline
|
832
844
|
self.cancel_timeout = cancel_timeout
|
833
845
|
self.wait_until_finished = wait_until_finished
|
834
|
-
self.job: dict | None = None
|
846
|
+
self.job: dict[str, str] | None = None
|
835
847
|
self.impersonation_chain = impersonation_chain
|
836
848
|
self.deferrable = deferrable
|
837
849
|
self.expected_terminal_state = expected_terminal_state
|
838
850
|
self.append_job_name = append_job_name
|
851
|
+
self.poll_sleep = poll_sleep
|
839
852
|
|
840
853
|
self._validate_deferrable_params()
|
841
854
|
|
@@ -870,32 +883,35 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
870
883
|
self.job = current_job
|
871
884
|
DataflowJobLink.persist(self, context, self.project_id, self.location, self.job.get("id"))
|
872
885
|
|
873
|
-
|
886
|
+
if not self.deferrable:
|
887
|
+
self.job = self.hook.start_flex_template(
|
888
|
+
body=self.body,
|
889
|
+
location=self.location,
|
890
|
+
project_id=self.project_id,
|
891
|
+
on_new_job_callback=set_current_job,
|
892
|
+
)
|
893
|
+
job_id = self.hook.extract_job_id(self.job)
|
894
|
+
self.xcom_push(context, key="job_id", value=job_id)
|
895
|
+
return self.job
|
896
|
+
|
897
|
+
self.job = self.hook.launch_job_with_flex_template(
|
874
898
|
body=self.body,
|
875
899
|
location=self.location,
|
876
900
|
project_id=self.project_id,
|
877
|
-
on_new_job_callback=set_current_job,
|
878
901
|
)
|
879
|
-
|
880
|
-
|
881
|
-
if job_id is None:
|
882
|
-
raise AirflowException(
|
883
|
-
"While reading job object after template execution error occurred. Job object has no id."
|
884
|
-
)
|
885
|
-
|
886
|
-
if not self.deferrable:
|
887
|
-
return self.job
|
888
|
-
|
902
|
+
job_id = self.hook.extract_job_id(self.job)
|
903
|
+
DataflowJobLink.persist(self, context, self.project_id, self.location, job_id)
|
889
904
|
self.defer(
|
890
905
|
trigger=TemplateJobStartTrigger(
|
891
906
|
project_id=self.project_id,
|
892
907
|
job_id=job_id,
|
893
908
|
location=self.location,
|
894
909
|
gcp_conn_id=self.gcp_conn_id,
|
910
|
+
poll_sleep=self.poll_sleep,
|
895
911
|
impersonation_chain=self.impersonation_chain,
|
896
912
|
cancel_timeout=self.cancel_timeout,
|
897
913
|
),
|
898
|
-
method_name=
|
914
|
+
method_name=GOOGLE_DEFAULT_DEFERRABLE_METHOD_NAME,
|
899
915
|
)
|
900
916
|
|
901
917
|
def _append_uuid_to_job_name(self):
|
@@ -906,7 +922,7 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
906
922
|
job_body["jobName"] = job_name
|
907
923
|
self.log.info("Job name was changed to %s", job_name)
|
908
924
|
|
909
|
-
def execute_complete(self, context: Context, event: dict):
|
925
|
+
def execute_complete(self, context: Context, event: dict) -> dict[str, str]:
|
910
926
|
"""Execute after trigger finishes its work."""
|
911
927
|
if event["status"] in ("error", "stopped"):
|
912
928
|
self.log.info("status: %s, msg: %s", event["status"], event["message"])
|
@@ -914,6 +930,7 @@ class DataflowStartFlexTemplateOperator(GoogleCloudBaseOperator):
|
|
914
930
|
|
915
931
|
job_id = event["job_id"]
|
916
932
|
self.log.info("Task %s completed with response %s", job_id, event["message"])
|
933
|
+
self.xcom_push(context, key="job_id", value=job_id)
|
917
934
|
job = self.hook.get_job(job_id=job_id, project_id=self.project_id, location=self.location)
|
918
935
|
return job
|
919
936
|
|
@@ -982,7 +999,7 @@ class DataflowStartSqlJobOperator(GoogleCloudBaseOperator):
|
|
982
999
|
query: str,
|
983
1000
|
options: dict[str, Any],
|
984
1001
|
location: str = DEFAULT_DATAFLOW_LOCATION,
|
985
|
-
project_id: str
|
1002
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
986
1003
|
gcp_conn_id: str = "google_cloud_default",
|
987
1004
|
drain_pipeline: bool = False,
|
988
1005
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -1150,7 +1167,7 @@ class DataflowCreatePythonJobOperator(GoogleCloudBaseOperator):
|
|
1150
1167
|
py_options: list[str] | None = None,
|
1151
1168
|
py_requirements: list[str] | None = None,
|
1152
1169
|
py_system_site_packages: bool = False,
|
1153
|
-
project_id: str
|
1170
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1154
1171
|
location: str = DEFAULT_DATAFLOW_LOCATION,
|
1155
1172
|
gcp_conn_id: str = "google_cloud_default",
|
1156
1173
|
poll_sleep: int = 10,
|
@@ -1297,7 +1314,7 @@ class DataflowStopJobOperator(GoogleCloudBaseOperator):
|
|
1297
1314
|
self,
|
1298
1315
|
job_name_prefix: str | None = None,
|
1299
1316
|
job_id: str | None = None,
|
1300
|
-
project_id: str
|
1317
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
1301
1318
|
location: str = DEFAULT_DATAFLOW_LOCATION,
|
1302
1319
|
gcp_conn_id: str = "google_cloud_default",
|
1303
1320
|
poll_sleep: int = 10,
|
@@ -37,6 +37,7 @@ from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseO
|
|
37
37
|
from airflow.providers.google.cloud.triggers.datafusion import DataFusionStartPipelineTrigger
|
38
38
|
from airflow.providers.google.cloud.utils.datafusion import DataFusionPipelineType
|
39
39
|
from airflow.providers.google.cloud.utils.helpers import resource_path_to_dict
|
40
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
40
41
|
|
41
42
|
if TYPE_CHECKING:
|
42
43
|
from airflow.utils.context import Context
|
@@ -97,7 +98,7 @@ class CloudDataFusionRestartInstanceOperator(GoogleCloudBaseOperator):
|
|
97
98
|
*,
|
98
99
|
instance_name: str,
|
99
100
|
location: str,
|
100
|
-
project_id: str
|
101
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
101
102
|
api_version: str = "v1beta1",
|
102
103
|
gcp_conn_id: str = "google_cloud_default",
|
103
104
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -169,7 +170,7 @@ class CloudDataFusionDeleteInstanceOperator(GoogleCloudBaseOperator):
|
|
169
170
|
*,
|
170
171
|
instance_name: str,
|
171
172
|
location: str,
|
172
|
-
project_id: str
|
173
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
173
174
|
api_version: str = "v1beta1",
|
174
175
|
gcp_conn_id: str = "google_cloud_default",
|
175
176
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -237,7 +238,7 @@ class CloudDataFusionCreateInstanceOperator(GoogleCloudBaseOperator):
|
|
237
238
|
instance_name: str,
|
238
239
|
instance: dict[str, Any],
|
239
240
|
location: str,
|
240
|
-
project_id: str
|
241
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
241
242
|
api_version: str = "v1beta1",
|
242
243
|
gcp_conn_id: str = "google_cloud_default",
|
243
244
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -340,7 +341,7 @@ class CloudDataFusionUpdateInstanceOperator(GoogleCloudBaseOperator):
|
|
340
341
|
instance: dict[str, Any],
|
341
342
|
update_mask: str,
|
342
343
|
location: str,
|
343
|
-
project_id: str
|
344
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
344
345
|
api_version: str = "v1beta1",
|
345
346
|
gcp_conn_id: str = "google_cloud_default",
|
346
347
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -417,7 +418,7 @@ class CloudDataFusionGetInstanceOperator(GoogleCloudBaseOperator):
|
|
417
418
|
*,
|
418
419
|
instance_name: str,
|
419
420
|
location: str,
|
420
|
-
project_id: str
|
421
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
421
422
|
api_version: str = "v1beta1",
|
422
423
|
gcp_conn_id: str = "google_cloud_default",
|
423
424
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -499,7 +500,7 @@ class CloudDataFusionCreatePipelineOperator(GoogleCloudBaseOperator):
|
|
499
500
|
instance_name: str,
|
500
501
|
location: str,
|
501
502
|
namespace: str = "default",
|
502
|
-
project_id: str
|
503
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
503
504
|
api_version: str = "v1beta1",
|
504
505
|
gcp_conn_id: str = "google_cloud_default",
|
505
506
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -587,7 +588,7 @@ class CloudDataFusionDeletePipelineOperator(GoogleCloudBaseOperator):
|
|
587
588
|
location: str,
|
588
589
|
version_id: str | None = None,
|
589
590
|
namespace: str = "default",
|
590
|
-
project_id: str
|
591
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
591
592
|
api_version: str = "v1beta1",
|
592
593
|
gcp_conn_id: str = "google_cloud_default",
|
593
594
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -670,7 +671,7 @@ class CloudDataFusionListPipelinesOperator(GoogleCloudBaseOperator):
|
|
670
671
|
artifact_name: str | None = None,
|
671
672
|
artifact_version: str | None = None,
|
672
673
|
namespace: str = "default",
|
673
|
-
project_id: str
|
674
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
674
675
|
api_version: str = "v1beta1",
|
675
676
|
gcp_conn_id: str = "google_cloud_default",
|
676
677
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -777,7 +778,7 @@ class CloudDataFusionStartPipelineOperator(GoogleCloudBaseOperator):
|
|
777
778
|
success_states: list[str] | None = None,
|
778
779
|
namespace: str = "default",
|
779
780
|
pipeline_timeout: int = 5 * 60,
|
780
|
-
project_id: str
|
781
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
781
782
|
api_version: str = "v1beta1",
|
782
783
|
gcp_conn_id: str = "google_cloud_default",
|
783
784
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -929,7 +930,7 @@ class CloudDataFusionStopPipelineOperator(GoogleCloudBaseOperator):
|
|
929
930
|
instance_name: str,
|
930
931
|
location: str,
|
931
932
|
namespace: str = "default",
|
932
|
-
project_id: str
|
933
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
933
934
|
api_version: str = "v1beta1",
|
934
935
|
gcp_conn_id: str = "google_cloud_default",
|
935
936
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -24,6 +24,7 @@ from typing import TYPE_CHECKING, Sequence
|
|
24
24
|
from airflow.exceptions import AirflowException
|
25
25
|
from airflow.providers.google.cloud.hooks.datapipeline import DEFAULT_DATAPIPELINE_LOCATION, DataPipelineHook
|
26
26
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
27
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
27
28
|
|
28
29
|
if TYPE_CHECKING:
|
29
30
|
from airflow.utils.context import Context
|
@@ -58,7 +59,7 @@ class CreateDataPipelineOperator(GoogleCloudBaseOperator):
|
|
58
59
|
self,
|
59
60
|
*,
|
60
61
|
body: dict,
|
61
|
-
project_id: str
|
62
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
62
63
|
location: str = DEFAULT_DATAPIPELINE_LOCATION,
|
63
64
|
gcp_conn_id: str = "google_cloud_default",
|
64
65
|
impersonation_chain: str | Sequence[str] | None = None,
|
@@ -120,7 +121,7 @@ class RunDataPipelineOperator(GoogleCloudBaseOperator):
|
|
120
121
|
def __init__(
|
121
122
|
self,
|
122
123
|
data_pipeline_name: str,
|
123
|
-
project_id: str
|
124
|
+
project_id: str = PROVIDE_PROJECT_ID,
|
124
125
|
location: str = DEFAULT_DATAPIPELINE_LOCATION,
|
125
126
|
gcp_conn_id: str = "google_cloud_default",
|
126
127
|
**kwargs,
|