apache-airflow-providers-google 15.1.0rc1__py3-none-any.whl → 16.0.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/ads/hooks/ads.py +34 -0
- airflow/providers/google/cloud/hooks/bigquery.py +63 -76
- airflow/providers/google/cloud/hooks/dataflow.py +67 -5
- airflow/providers/google/cloud/hooks/gcs.py +3 -3
- airflow/providers/google/cloud/hooks/looker.py +5 -0
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +0 -36
- airflow/providers/google/cloud/hooks/vertex_ai/generative_model.py +1 -66
- airflow/providers/google/cloud/hooks/vertex_ai/ray.py +223 -0
- airflow/providers/google/cloud/links/cloud_run.py +59 -0
- airflow/providers/google/cloud/links/vertex_ai.py +49 -0
- airflow/providers/google/cloud/log/gcs_task_handler.py +7 -5
- airflow/providers/google/cloud/operators/bigquery.py +49 -10
- airflow/providers/google/cloud/operators/cloud_run.py +20 -2
- airflow/providers/google/cloud/operators/gcs.py +1 -0
- airflow/providers/google/cloud/operators/kubernetes_engine.py +4 -86
- airflow/providers/google/cloud/operators/pubsub.py +2 -1
- airflow/providers/google/cloud/operators/vertex_ai/generative_model.py +0 -92
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +4 -0
- airflow/providers/google/cloud/operators/vertex_ai/ray.py +388 -0
- airflow/providers/google/cloud/transfers/bigquery_to_bigquery.py +9 -5
- airflow/providers/google/cloud/transfers/facebook_ads_to_gcs.py +1 -1
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +2 -0
- airflow/providers/google/cloud/transfers/http_to_gcs.py +193 -0
- airflow/providers/google/cloud/transfers/s3_to_gcs.py +11 -5
- airflow/providers/google/cloud/triggers/bigquery.py +32 -5
- airflow/providers/google/cloud/triggers/dataflow.py +122 -0
- airflow/providers/google/cloud/triggers/dataproc.py +62 -10
- airflow/providers/google/get_provider_info.py +18 -5
- airflow/providers/google/leveldb/hooks/leveldb.py +25 -0
- airflow/providers/google/version_compat.py +0 -1
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-16.0.0rc1.dist-info}/METADATA +97 -90
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-16.0.0rc1.dist-info}/RECORD +35 -32
- airflow/providers/google/cloud/links/automl.py +0 -193
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-16.0.0rc1.dist-info}/WHEEL +0 -0
- {apache_airflow_providers_google-15.1.0rc1.dist-info → apache_airflow_providers_google-16.0.0rc1.dist-info}/entry_points.txt +0 -0
@@ -57,7 +57,6 @@ from airflow.providers.google.cloud.triggers.kubernetes_engine import (
|
|
57
57
|
GKEOperationTrigger,
|
58
58
|
GKEStartPodTrigger,
|
59
59
|
)
|
60
|
-
from airflow.providers.google.common.deprecated import deprecated
|
61
60
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
62
61
|
from airflow.providers_manager import ProvidersManager
|
63
62
|
from airflow.utils.timezone import utcnow
|
@@ -222,7 +221,6 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
222
221
|
If set as a sequence, the identities from the list must grant
|
223
222
|
Service Account Token Creator IAM role to the directly preceding identity, with first
|
224
223
|
account from the list granting this role to the originating account (templated).
|
225
|
-
:param name: (Deprecated) The name of the resource to delete, in this case cluster name
|
226
224
|
:param api_version: The api version to use
|
227
225
|
:param deferrable: Run operator in the deferrable mode.
|
228
226
|
:param poll_interval: Interval size which defines how often operation status is checked.
|
@@ -241,7 +239,6 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
241
239
|
gcp_conn_id: str = "google_cloud_default",
|
242
240
|
impersonation_chain: str | Sequence[str] | None = None,
|
243
241
|
cluster_name: str | None = None,
|
244
|
-
name: str | None = None,
|
245
242
|
api_version: str = "v2",
|
246
243
|
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
247
244
|
poll_interval: int = 10,
|
@@ -251,36 +248,17 @@ class GKEDeleteClusterOperator(GKEOperatorMixin, GoogleCloudBaseOperator):
|
|
251
248
|
super().__init__(*args, **kwargs)
|
252
249
|
|
253
250
|
self.location = location
|
254
|
-
self.cluster_name = cluster_name
|
251
|
+
self.cluster_name = cluster_name
|
255
252
|
self.use_internal_ip = use_internal_ip
|
256
253
|
self.use_dns_endpoint = use_dns_endpoint
|
257
254
|
self.project_id = project_id
|
258
255
|
self.gcp_conn_id = gcp_conn_id
|
259
256
|
self.impersonation_chain = impersonation_chain
|
260
|
-
self._name = name
|
261
257
|
self.api_version = api_version
|
262
258
|
self.deferrable = deferrable
|
263
259
|
self.poll_interval = poll_interval
|
264
260
|
self._check_input()
|
265
261
|
|
266
|
-
@property
|
267
|
-
@deprecated(
|
268
|
-
planned_removal_date="May 01, 2025",
|
269
|
-
use_instead="cluster_name",
|
270
|
-
category=AirflowProviderDeprecationWarning,
|
271
|
-
)
|
272
|
-
def name(self) -> str | None:
|
273
|
-
return self._name
|
274
|
-
|
275
|
-
@name.setter
|
276
|
-
@deprecated(
|
277
|
-
planned_removal_date="May 01, 2025",
|
278
|
-
use_instead="cluster_name",
|
279
|
-
category=AirflowProviderDeprecationWarning,
|
280
|
-
)
|
281
|
-
def name(self, name: str) -> None:
|
282
|
-
self._name = name
|
283
|
-
|
284
262
|
def _check_input(self) -> None:
|
285
263
|
if not all([self.project_id, self.cluster_name, self.location]):
|
286
264
|
self.log.error("One of (project_id, cluster_name, location) is missing or incorrect")
|
@@ -622,21 +600,15 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
622
600
|
If set as a sequence, the identities from the list must grant
|
623
601
|
Service Account Token Creator IAM role to the directly preceding identity, with first
|
624
602
|
account from the list granting this role to the originating account (templated).
|
625
|
-
:param regional: (Deprecated) The location param is region name.
|
626
603
|
:param on_finish_action: What to do when the pod reaches its final state, or the execution is interrupted.
|
627
604
|
If "delete_pod", the pod will be deleted regardless its state; if "delete_succeeded_pod",
|
628
605
|
only succeeded pod will be deleted. You can set to "keep_pod" to keep the pod.
|
629
606
|
Current default is `keep_pod`, but this will be changed in the next major release of this provider.
|
630
|
-
:param is_delete_operator_pod: (Deprecated) What to do when the pod reaches its final
|
631
|
-
state, or the execution is interrupted. If True, delete the
|
632
|
-
pod; if False, leave the pod. Current default is False, but this will be
|
633
|
-
changed in the next major release of this provider.
|
634
|
-
Deprecated - use `on_finish_action` instead.
|
635
607
|
:param deferrable: Run operator in the deferrable mode.
|
636
608
|
"""
|
637
609
|
|
638
610
|
template_fields: Sequence[str] = tuple(
|
639
|
-
{"
|
611
|
+
{"deferrable"}
|
640
612
|
| (set(KubernetesPodOperator.template_fields) - {"is_delete_operator_pod", "regional"})
|
641
613
|
| set(GKEOperatorMixin.template_fields)
|
642
614
|
)
|
@@ -651,30 +623,15 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
651
623
|
project_id: str = PROVIDE_PROJECT_ID,
|
652
624
|
gcp_conn_id: str = "google_cloud_default",
|
653
625
|
impersonation_chain: str | Sequence[str] | None = None,
|
654
|
-
regional: bool | None = None,
|
655
626
|
on_finish_action: str | None = None,
|
656
|
-
is_delete_operator_pod: bool | None = None,
|
657
627
|
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
658
628
|
*args,
|
659
629
|
**kwargs,
|
660
630
|
) -> None:
|
661
|
-
if
|
662
|
-
kwargs["on_finish_action"] = (
|
663
|
-
OnFinishAction.DELETE_POD if is_delete_operator_pod else OnFinishAction.KEEP_POD
|
664
|
-
)
|
665
|
-
elif on_finish_action is not None:
|
631
|
+
if on_finish_action is not None:
|
666
632
|
kwargs["on_finish_action"] = OnFinishAction(on_finish_action)
|
667
633
|
else:
|
668
|
-
|
669
|
-
f"You have not set parameter `on_finish_action` in class {self.__class__.__name__}. "
|
670
|
-
"Currently the default for this parameter is `keep_pod` but in a future release"
|
671
|
-
" the default will be changed to `delete_pod`. To ensure pods are not deleted in"
|
672
|
-
" the future you will need to set `on_finish_action=keep_pod` explicitly.",
|
673
|
-
AirflowProviderDeprecationWarning,
|
674
|
-
stacklevel=2,
|
675
|
-
)
|
676
|
-
kwargs["on_finish_action"] = OnFinishAction.KEEP_POD
|
677
|
-
|
634
|
+
kwargs["on_finish_action"] = OnFinishAction.DELETE_POD
|
678
635
|
super().__init__(*args, **kwargs)
|
679
636
|
self.project_id = project_id
|
680
637
|
self.location = location
|
@@ -683,9 +640,6 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
683
640
|
self.use_internal_ip = use_internal_ip
|
684
641
|
self.use_dns_endpoint = use_dns_endpoint
|
685
642
|
self.impersonation_chain = impersonation_chain
|
686
|
-
self._regional = regional
|
687
|
-
if is_delete_operator_pod is not None:
|
688
|
-
self.is_delete_operator_pod = is_delete_operator_pod
|
689
643
|
self.deferrable = deferrable
|
690
644
|
|
691
645
|
# There is no need to manage the kube_config file, as it will be generated automatically.
|
@@ -693,42 +647,6 @@ class GKEStartPodOperator(GKEOperatorMixin, KubernetesPodOperator):
|
|
693
647
|
if self.config_file:
|
694
648
|
raise AirflowException("config_file is not an allowed parameter for the GKEStartPodOperator.")
|
695
649
|
|
696
|
-
@property
|
697
|
-
@deprecated(
|
698
|
-
planned_removal_date="May 01, 2025",
|
699
|
-
use_instead="on_finish_action",
|
700
|
-
category=AirflowProviderDeprecationWarning,
|
701
|
-
)
|
702
|
-
def is_delete_operator_pod(self) -> bool | None:
|
703
|
-
return self._is_delete_operator_pod
|
704
|
-
|
705
|
-
@is_delete_operator_pod.setter
|
706
|
-
@deprecated(
|
707
|
-
planned_removal_date="May 01, 2025",
|
708
|
-
use_instead="on_finish_action",
|
709
|
-
category=AirflowProviderDeprecationWarning,
|
710
|
-
)
|
711
|
-
def is_delete_operator_pod(self, is_delete_operator_pod) -> None:
|
712
|
-
self._is_delete_operator_pod = is_delete_operator_pod
|
713
|
-
|
714
|
-
@property
|
715
|
-
@deprecated(
|
716
|
-
planned_removal_date="May 01, 2025",
|
717
|
-
reason="The parameter is not in actual use.",
|
718
|
-
category=AirflowProviderDeprecationWarning,
|
719
|
-
)
|
720
|
-
def regional(self) -> bool | None:
|
721
|
-
return self._regional
|
722
|
-
|
723
|
-
@regional.setter
|
724
|
-
@deprecated(
|
725
|
-
planned_removal_date="May 01, 2025",
|
726
|
-
reason="The parameter is not in actual use.",
|
727
|
-
category=AirflowProviderDeprecationWarning,
|
728
|
-
)
|
729
|
-
def regional(self, regional) -> None:
|
730
|
-
self._regional = regional
|
731
|
-
|
732
650
|
def invoke_defer_method(self, last_log_time: DateTime | None = None):
|
733
651
|
"""Redefine triggers which are being used in child classes."""
|
734
652
|
trigger_start_time = utcnow()
|
@@ -40,6 +40,7 @@ from google.cloud.pubsub_v1.types import (
|
|
40
40
|
SchemaSettings,
|
41
41
|
)
|
42
42
|
|
43
|
+
from airflow.configuration import conf
|
43
44
|
from airflow.exceptions import AirflowException
|
44
45
|
from airflow.providers.google.cloud.hooks.pubsub import PubSubHook
|
45
46
|
from airflow.providers.google.cloud.links.pubsub import PubSubSubscriptionLink, PubSubTopicLink
|
@@ -770,7 +771,7 @@ class PubSubPullOperator(GoogleCloudBaseOperator):
|
|
770
771
|
messages_callback: Callable[[list[ReceivedMessage], Context], Any] | None = None,
|
771
772
|
gcp_conn_id: str = "google_cloud_default",
|
772
773
|
impersonation_chain: str | Sequence[str] | None = None,
|
773
|
-
deferrable: bool = False,
|
774
|
+
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
|
774
775
|
poll_interval: int = 300,
|
775
776
|
**kwargs,
|
776
777
|
) -> None:
|
@@ -22,105 +22,13 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
-
from airflow.exceptions import AirflowProviderDeprecationWarning
|
26
25
|
from airflow.providers.google.cloud.hooks.vertex_ai.generative_model import GenerativeModelHook
|
27
26
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
28
|
-
from airflow.providers.google.common.deprecated import deprecated
|
29
27
|
|
30
28
|
if TYPE_CHECKING:
|
31
29
|
from airflow.utils.context import Context
|
32
30
|
|
33
31
|
|
34
|
-
@deprecated(
|
35
|
-
planned_removal_date="April 09, 2025",
|
36
|
-
use_instead="GenerativeModelGenerateContentOperator",
|
37
|
-
category=AirflowProviderDeprecationWarning,
|
38
|
-
)
|
39
|
-
class TextGenerationModelPredictOperator(GoogleCloudBaseOperator):
|
40
|
-
"""
|
41
|
-
Uses the Vertex AI PaLM API to generate natural language text.
|
42
|
-
|
43
|
-
:param project_id: Required. The ID of the Google Cloud project that the
|
44
|
-
service belongs to (templated).
|
45
|
-
:param location: Required. The ID of the Google Cloud location that the
|
46
|
-
service belongs to (templated).
|
47
|
-
:param prompt: Required. Inputs or queries that a user or a program gives
|
48
|
-
to the Vertex AI PaLM API, in order to elicit a specific response (templated).
|
49
|
-
:param pretrained_model: By default uses the pre-trained model `text-bison`,
|
50
|
-
optimized for performing natural language tasks such as classification,
|
51
|
-
summarization, extraction, content creation, and ideation.
|
52
|
-
:param temperature: Temperature controls the degree of randomness in token
|
53
|
-
selection. Defaults to 0.0.
|
54
|
-
:param max_output_tokens: Token limit determines the maximum amount of text
|
55
|
-
output. Defaults to 256.
|
56
|
-
:param top_p: Tokens are selected from most probable to least until the sum
|
57
|
-
of their probabilities equals the top_p value. Defaults to 0.8.
|
58
|
-
:param top_k: A top_k of 1 means the selected token is the most probable
|
59
|
-
among all tokens. Defaults to 0.4.
|
60
|
-
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
|
61
|
-
:param impersonation_chain: Optional service account to impersonate using short-term
|
62
|
-
credentials, or chained list of accounts required to get the access_token
|
63
|
-
of the last account in the list, which will be impersonated in the request.
|
64
|
-
If set as a string, the account must grant the originating account
|
65
|
-
the Service Account Token Creator IAM role.
|
66
|
-
If set as a sequence, the identities from the list must grant
|
67
|
-
Service Account Token Creator IAM role to the directly preceding identity, with first
|
68
|
-
account from the list granting this role to the originating account (templated).
|
69
|
-
"""
|
70
|
-
|
71
|
-
template_fields = ("location", "project_id", "impersonation_chain", "prompt")
|
72
|
-
|
73
|
-
def __init__(
|
74
|
-
self,
|
75
|
-
*,
|
76
|
-
project_id: str,
|
77
|
-
location: str,
|
78
|
-
prompt: str,
|
79
|
-
pretrained_model: str = "text-bison",
|
80
|
-
temperature: float = 0.0,
|
81
|
-
max_output_tokens: int = 256,
|
82
|
-
top_p: float = 0.8,
|
83
|
-
top_k: int = 40,
|
84
|
-
gcp_conn_id: str = "google_cloud_default",
|
85
|
-
impersonation_chain: str | Sequence[str] | None = None,
|
86
|
-
**kwargs,
|
87
|
-
) -> None:
|
88
|
-
super().__init__(**kwargs)
|
89
|
-
self.project_id = project_id
|
90
|
-
self.location = location
|
91
|
-
self.prompt = prompt
|
92
|
-
self.pretrained_model = pretrained_model
|
93
|
-
self.temperature = temperature
|
94
|
-
self.max_output_tokens = max_output_tokens
|
95
|
-
self.top_p = top_p
|
96
|
-
self.top_k = top_k
|
97
|
-
self.gcp_conn_id = gcp_conn_id
|
98
|
-
self.impersonation_chain = impersonation_chain
|
99
|
-
|
100
|
-
def execute(self, context: Context):
|
101
|
-
self.hook = GenerativeModelHook(
|
102
|
-
gcp_conn_id=self.gcp_conn_id,
|
103
|
-
impersonation_chain=self.impersonation_chain,
|
104
|
-
)
|
105
|
-
|
106
|
-
self.log.info("Submitting prompt")
|
107
|
-
response = self.hook.text_generation_model_predict(
|
108
|
-
project_id=self.project_id,
|
109
|
-
location=self.location,
|
110
|
-
prompt=self.prompt,
|
111
|
-
pretrained_model=self.pretrained_model,
|
112
|
-
temperature=self.temperature,
|
113
|
-
max_output_tokens=self.max_output_tokens,
|
114
|
-
top_p=self.top_p,
|
115
|
-
top_k=self.top_k,
|
116
|
-
)
|
117
|
-
|
118
|
-
self.log.info("Model response: %s", response)
|
119
|
-
self.xcom_push(context, key="model_response", value=response)
|
120
|
-
|
121
|
-
return response
|
122
|
-
|
123
|
-
|
124
32
|
class TextEmbeddingModelGetEmbeddingsOperator(GoogleCloudBaseOperator):
|
125
33
|
"""
|
126
34
|
Uses the Vertex AI Embeddings API to generate embeddings based on prompt.
|
@@ -112,6 +112,10 @@ class RunPipelineJobOperator(GoogleCloudBaseOperator):
|
|
112
112
|
"project_id",
|
113
113
|
"input_artifacts",
|
114
114
|
"impersonation_chain",
|
115
|
+
"template_path",
|
116
|
+
"pipeline_root",
|
117
|
+
"parameter_values",
|
118
|
+
"service_account",
|
115
119
|
]
|
116
120
|
operator_extra_links = (VertexAIPipelineJobLink(),)
|
117
121
|
|