apache-airflow-providers-google 14.0.0rc1__py3-none-any.whl → 14.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- airflow/providers/google/3rd-party-licenses/LICENSES.txt +14 -0
- airflow/providers/google/3rd-party-licenses/NOTICE +15 -0
- airflow/providers/google/__init__.py +1 -1
- airflow/providers/google/_vendor/__init__.py +0 -0
- airflow/providers/google/_vendor/json_merge_patch.py +91 -0
- airflow/providers/google/ads/hooks/ads.py +12 -11
- airflow/providers/google/cloud/_internal_client/secret_manager_client.py +3 -2
- airflow/providers/google/cloud/hooks/alloy_db.py +2 -3
- airflow/providers/google/cloud/hooks/automl.py +7 -13
- airflow/providers/google/cloud/hooks/bigquery.py +21 -22
- airflow/providers/google/cloud/hooks/bigquery_dts.py +8 -8
- airflow/providers/google/cloud/hooks/bigtable.py +3 -2
- airflow/providers/google/cloud/hooks/cloud_batch.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_build.py +7 -13
- airflow/providers/google/cloud/hooks/cloud_composer.py +7 -12
- airflow/providers/google/cloud/hooks/cloud_memorystore.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_run.py +4 -3
- airflow/providers/google/cloud/hooks/cloud_sql.py +1 -1
- airflow/providers/google/cloud/hooks/cloud_storage_transfer_service.py +8 -9
- airflow/providers/google/cloud/hooks/compute.py +3 -3
- airflow/providers/google/cloud/hooks/datacatalog.py +4 -3
- airflow/providers/google/cloud/hooks/dataflow.py +12 -12
- airflow/providers/google/cloud/hooks/dataform.py +3 -2
- airflow/providers/google/cloud/hooks/datafusion.py +2 -2
- airflow/providers/google/cloud/hooks/dataplex.py +11 -10
- airflow/providers/google/cloud/hooks/dataproc.py +5 -4
- airflow/providers/google/cloud/hooks/dataproc_metastore.py +4 -3
- airflow/providers/google/cloud/hooks/dlp.py +4 -3
- airflow/providers/google/cloud/hooks/gcs.py +19 -12
- airflow/providers/google/cloud/hooks/kms.py +3 -2
- airflow/providers/google/cloud/hooks/kubernetes_engine.py +20 -14
- airflow/providers/google/cloud/hooks/life_sciences.py +1 -1
- airflow/providers/google/cloud/hooks/managed_kafka.py +227 -3
- airflow/providers/google/cloud/hooks/natural_language.py +3 -2
- airflow/providers/google/cloud/hooks/os_login.py +3 -2
- airflow/providers/google/cloud/hooks/pubsub.py +6 -6
- airflow/providers/google/cloud/hooks/secret_manager.py +3 -2
- airflow/providers/google/cloud/hooks/spanner.py +2 -2
- airflow/providers/google/cloud/hooks/speech_to_text.py +3 -2
- airflow/providers/google/cloud/hooks/stackdriver.py +4 -4
- airflow/providers/google/cloud/hooks/tasks.py +4 -3
- airflow/providers/google/cloud/hooks/text_to_speech.py +3 -2
- airflow/providers/google/cloud/hooks/translate.py +6 -15
- airflow/providers/google/cloud/hooks/vertex_ai/auto_ml.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/batch_prediction_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/custom_job.py +7 -13
- airflow/providers/google/cloud/hooks/vertex_ai/dataset.py +5 -12
- airflow/providers/google/cloud/hooks/vertex_ai/endpoint_service.py +4 -11
- airflow/providers/google/cloud/hooks/vertex_ai/feature_store.py +4 -3
- airflow/providers/google/cloud/hooks/vertex_ai/hyperparameter_tuning_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/model_service.py +6 -11
- airflow/providers/google/cloud/hooks/vertex_ai/pipeline_job.py +6 -12
- airflow/providers/google/cloud/hooks/vertex_ai/prediction_service.py +3 -2
- airflow/providers/google/cloud/hooks/video_intelligence.py +3 -2
- airflow/providers/google/cloud/hooks/vision.py +4 -3
- airflow/providers/google/cloud/hooks/workflows.py +3 -2
- airflow/providers/google/cloud/links/base.py +7 -1
- airflow/providers/google/cloud/links/datafusion.py +8 -2
- airflow/providers/google/cloud/links/dataproc.py +8 -1
- airflow/providers/google/cloud/links/kubernetes_engine.py +2 -1
- airflow/providers/google/cloud/links/managed_kafka.py +30 -0
- airflow/providers/google/cloud/log/gcs_task_handler.py +15 -7
- airflow/providers/google/cloud/log/stackdriver_task_handler.py +8 -6
- airflow/providers/google/cloud/openlineage/utils.py +4 -2
- airflow/providers/google/cloud/operators/alloy_db.py +6 -5
- airflow/providers/google/cloud/operators/automl.py +11 -9
- airflow/providers/google/cloud/operators/bigquery.py +8 -6
- airflow/providers/google/cloud/operators/bigquery_dts.py +10 -8
- airflow/providers/google/cloud/operators/bigtable.py +3 -1
- airflow/providers/google/cloud/operators/cloud_base.py +2 -1
- airflow/providers/google/cloud/operators/cloud_batch.py +4 -2
- airflow/providers/google/cloud/operators/cloud_build.py +5 -3
- airflow/providers/google/cloud/operators/cloud_composer.py +7 -5
- airflow/providers/google/cloud/operators/cloud_memorystore.py +6 -4
- airflow/providers/google/cloud/operators/cloud_run.py +5 -3
- airflow/providers/google/cloud/operators/compute.py +5 -4
- airflow/providers/google/cloud/operators/datacatalog.py +11 -9
- airflow/providers/google/cloud/operators/dataform.py +5 -3
- airflow/providers/google/cloud/operators/datafusion.py +1 -1
- airflow/providers/google/cloud/operators/dataplex.py +20 -18
- airflow/providers/google/cloud/operators/dataproc.py +34 -5
- airflow/providers/google/cloud/operators/dataproc_metastore.py +18 -7
- airflow/providers/google/cloud/operators/dlp.py +19 -17
- airflow/providers/google/cloud/operators/gcs.py +5 -4
- airflow/providers/google/cloud/operators/kubernetes_engine.py +54 -5
- airflow/providers/google/cloud/operators/managed_kafka.py +271 -4
- airflow/providers/google/cloud/operators/natural_language.py +5 -3
- airflow/providers/google/cloud/operators/pubsub.py +10 -8
- airflow/providers/google/cloud/operators/speech_to_text.py +5 -3
- airflow/providers/google/cloud/operators/stackdriver.py +5 -3
- airflow/providers/google/cloud/operators/tasks.py +6 -4
- airflow/providers/google/cloud/operators/text_to_speech.py +4 -2
- airflow/providers/google/cloud/operators/translate.py +5 -3
- airflow/providers/google/cloud/operators/translate_speech.py +4 -2
- airflow/providers/google/cloud/operators/vertex_ai/auto_ml.py +8 -6
- airflow/providers/google/cloud/operators/vertex_ai/batch_prediction_job.py +6 -4
- airflow/providers/google/cloud/operators/vertex_ai/custom_job.py +8 -6
- airflow/providers/google/cloud/operators/vertex_ai/dataset.py +6 -4
- airflow/providers/google/cloud/operators/vertex_ai/endpoint_service.py +6 -4
- airflow/providers/google/cloud/operators/vertex_ai/hyperparameter_tuning_job.py +6 -4
- airflow/providers/google/cloud/operators/vertex_ai/model_service.py +6 -4
- airflow/providers/google/cloud/operators/vertex_ai/pipeline_job.py +6 -4
- airflow/providers/google/cloud/operators/video_intelligence.py +5 -3
- airflow/providers/google/cloud/operators/vision.py +6 -4
- airflow/providers/google/cloud/operators/workflows.py +7 -5
- airflow/providers/google/cloud/secrets/secret_manager.py +2 -1
- airflow/providers/google/cloud/sensors/bigquery_dts.py +5 -3
- airflow/providers/google/cloud/sensors/bigtable.py +3 -2
- airflow/providers/google/cloud/sensors/cloud_composer.py +1 -1
- airflow/providers/google/cloud/sensors/dataplex.py +6 -4
- airflow/providers/google/cloud/sensors/dataproc.py +3 -2
- airflow/providers/google/cloud/sensors/dataproc_metastore.py +2 -1
- airflow/providers/google/cloud/sensors/gcs.py +4 -2
- airflow/providers/google/cloud/sensors/pubsub.py +3 -2
- airflow/providers/google/cloud/sensors/workflows.py +5 -3
- airflow/providers/google/cloud/transfers/bigquery_to_gcs.py +5 -3
- airflow/providers/google/cloud/transfers/gcs_to_bigquery.py +12 -10
- airflow/providers/google/cloud/triggers/bigquery_dts.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_batch.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_build.py +2 -1
- airflow/providers/google/cloud/triggers/cloud_composer.py +1 -1
- airflow/providers/google/cloud/triggers/cloud_storage_transfer_service.py +3 -2
- airflow/providers/google/cloud/triggers/dataflow.py +3 -2
- airflow/providers/google/cloud/triggers/dataplex.py +2 -1
- airflow/providers/google/cloud/triggers/dataproc.py +3 -2
- airflow/providers/google/cloud/triggers/kubernetes_engine.py +1 -1
- airflow/providers/google/cloud/triggers/pubsub.py +2 -1
- airflow/providers/google/cloud/triggers/vertex_ai.py +8 -7
- airflow/providers/google/cloud/utils/credentials_provider.py +4 -3
- airflow/providers/google/cloud/utils/external_token_supplier.py +0 -1
- airflow/providers/google/cloud/{example_dags/__init__.py → utils/validators.py} +27 -0
- airflow/providers/google/common/auth_backend/google_openid.py +14 -5
- airflow/providers/google/common/consts.py +2 -1
- airflow/providers/google/common/hooks/base_google.py +7 -8
- airflow/providers/google/common/hooks/operation_helpers.py +79 -0
- airflow/providers/google/get_provider_info.py +11 -6
- airflow/providers/google/marketing_platform/hooks/analytics_admin.py +3 -2
- airflow/providers/google/marketing_platform/hooks/search_ads.py +1 -1
- airflow/providers/google/marketing_platform/links/analytics_admin.py +10 -2
- airflow/providers/google/marketing_platform/operators/analytics_admin.py +7 -5
- {apache_airflow_providers_google-14.0.0rc1.dist-info → apache_airflow_providers_google-14.1.0.dist-info}/METADATA +35 -38
- {apache_airflow_providers_google-14.0.0rc1.dist-info → apache_airflow_providers_google-14.1.0.dist-info}/RECORD +144 -140
- {apache_airflow_providers_google-14.0.0rc1.dist-info → apache_airflow_providers_google-14.1.0.dist-info}/WHEEL +1 -1
- airflow/providers/google/cloud/example_dags/example_cloud_task.py +0 -54
- {apache_airflow_providers_google-14.0.0rc1.dist-info → apache_airflow_providers_google-14.1.0.dist-info}/entry_points.txt +0 -0
@@ -23,23 +23,26 @@ from collections.abc import Sequence
|
|
23
23
|
from functools import cached_property
|
24
24
|
from typing import TYPE_CHECKING
|
25
25
|
|
26
|
+
from google.api_core.exceptions import AlreadyExists, NotFound
|
27
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
28
|
+
from google.cloud.managedkafka_v1 import types
|
29
|
+
|
26
30
|
from airflow.exceptions import AirflowException
|
27
31
|
from airflow.providers.google.cloud.hooks.managed_kafka import ManagedKafkaHook
|
28
32
|
from airflow.providers.google.cloud.links.managed_kafka import (
|
29
33
|
ApacheKafkaClusterLink,
|
30
34
|
ApacheKafkaClusterListLink,
|
35
|
+
ApacheKafkaConsumerGroupLink,
|
31
36
|
ApacheKafkaTopicLink,
|
32
37
|
)
|
33
38
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
34
|
-
from google.api_core.exceptions import AlreadyExists, NotFound
|
35
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
36
|
-
from google.cloud.managedkafka_v1 import types
|
37
39
|
|
38
40
|
if TYPE_CHECKING:
|
39
|
-
from airflow.utils.context import Context
|
40
41
|
from google.api_core.retry import Retry
|
41
42
|
from google.protobuf.field_mask_pb2 import FieldMask
|
42
43
|
|
44
|
+
from airflow.utils.context import Context
|
45
|
+
|
43
46
|
|
44
47
|
class ManagedKafkaBaseOperator(GoogleCloudBaseOperator):
|
45
48
|
"""
|
@@ -786,3 +789,267 @@ class ManagedKafkaDeleteTopicOperator(ManagedKafkaBaseOperator):
|
|
786
789
|
except NotFound as not_found_err:
|
787
790
|
self.log.info("The Apache Kafka topic ID %s does not exist.", self.topic_id)
|
788
791
|
raise AirflowException(not_found_err)
|
792
|
+
|
793
|
+
|
794
|
+
class ManagedKafkaListConsumerGroupsOperator(ManagedKafkaBaseOperator):
|
795
|
+
"""
|
796
|
+
List the consumer groups in a given cluster.
|
797
|
+
|
798
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
799
|
+
:param location: Required. The ID of the Google Cloud region that the service belongs to.
|
800
|
+
:param cluster_id: Required. The ID of the cluster whose consumer groups are to be listed.
|
801
|
+
:param page_size: Optional. The maximum number of consumer groups to return. The service may return
|
802
|
+
fewer than this value. If unset or zero, all consumer groups for the parent is returned.
|
803
|
+
:param page_token: Optional. A page token, received from a previous ``ListConsumerGroups`` call.
|
804
|
+
Provide this to retrieve the subsequent page. When paginating, all other parameters provided to
|
805
|
+
``ListConsumerGroups`` must match the call that provided the page token.
|
806
|
+
:param retry: Designation of what errors, if any, should be retried.
|
807
|
+
:param timeout: The timeout for this request.
|
808
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
809
|
+
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
|
810
|
+
:param impersonation_chain: Optional service account to impersonate using short-term
|
811
|
+
credentials, or chained list of accounts required to get the access_token
|
812
|
+
of the last account in the list, which will be impersonated in the request.
|
813
|
+
If set as a string, the account must grant the originating account
|
814
|
+
the Service Account Token Creator IAM role.
|
815
|
+
If set as a sequence, the identities from the list must grant
|
816
|
+
Service Account Token Creator IAM role to the directly preceding identity, with first
|
817
|
+
account from the list granting this role to the originating account (templated).
|
818
|
+
"""
|
819
|
+
|
820
|
+
template_fields: Sequence[str] = tuple({"cluster_id"} | set(ManagedKafkaBaseOperator.template_fields))
|
821
|
+
operator_extra_links = (ApacheKafkaClusterLink(),)
|
822
|
+
|
823
|
+
def __init__(
|
824
|
+
self,
|
825
|
+
cluster_id: str,
|
826
|
+
page_size: int | None = None,
|
827
|
+
page_token: str | None = None,
|
828
|
+
*args,
|
829
|
+
**kwargs,
|
830
|
+
) -> None:
|
831
|
+
super().__init__(*args, **kwargs)
|
832
|
+
self.cluster_id = cluster_id
|
833
|
+
self.page_size = page_size
|
834
|
+
self.page_token = page_token
|
835
|
+
|
836
|
+
def execute(self, context: Context):
|
837
|
+
ApacheKafkaClusterLink.persist(context=context, task_instance=self, cluster_id=self.cluster_id)
|
838
|
+
self.log.info("Listing Consumer Groups for cluster %s.", self.cluster_id)
|
839
|
+
try:
|
840
|
+
consumer_group_list_pager = self.hook.list_consumer_groups(
|
841
|
+
project_id=self.project_id,
|
842
|
+
location=self.location,
|
843
|
+
cluster_id=self.cluster_id,
|
844
|
+
page_size=self.page_size,
|
845
|
+
page_token=self.page_token,
|
846
|
+
retry=self.retry,
|
847
|
+
timeout=self.timeout,
|
848
|
+
metadata=self.metadata,
|
849
|
+
)
|
850
|
+
self.xcom_push(
|
851
|
+
context=context,
|
852
|
+
key="consumer_group_page",
|
853
|
+
value=types.ListConsumerGroupsResponse.to_dict(consumer_group_list_pager._response),
|
854
|
+
)
|
855
|
+
except Exception as error:
|
856
|
+
raise AirflowException(error)
|
857
|
+
return [types.ConsumerGroup.to_dict(consumer_group) for consumer_group in consumer_group_list_pager]
|
858
|
+
|
859
|
+
|
860
|
+
class ManagedKafkaGetConsumerGroupOperator(ManagedKafkaBaseOperator):
|
861
|
+
"""
|
862
|
+
Return the properties of a single consumer group.
|
863
|
+
|
864
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
865
|
+
:param location: Required. The ID of the Google Cloud region that the service belongs to.
|
866
|
+
:param cluster_id: Required. The ID of the cluster whose consumer group is to be returned.
|
867
|
+
:param consumer_group_id: Required. The ID of the consumer group whose configuration to return.
|
868
|
+
:param retry: Designation of what errors, if any, should be retried.
|
869
|
+
:param timeout: The timeout for this request.
|
870
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
871
|
+
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
|
872
|
+
:param impersonation_chain: Optional service account to impersonate using short-term
|
873
|
+
credentials, or chained list of accounts required to get the access_token
|
874
|
+
of the last account in the list, which will be impersonated in the request.
|
875
|
+
If set as a string, the account must grant the originating account
|
876
|
+
the Service Account Token Creator IAM role.
|
877
|
+
If set as a sequence, the identities from the list must grant
|
878
|
+
Service Account Token Creator IAM role to the directly preceding identity, with first
|
879
|
+
account from the list granting this role to the originating account (templated).
|
880
|
+
"""
|
881
|
+
|
882
|
+
template_fields: Sequence[str] = tuple(
|
883
|
+
{"cluster_id", "consumer_group_id"} | set(ManagedKafkaBaseOperator.template_fields)
|
884
|
+
)
|
885
|
+
operator_extra_links = (ApacheKafkaConsumerGroupLink(),)
|
886
|
+
|
887
|
+
def __init__(
|
888
|
+
self,
|
889
|
+
cluster_id: str,
|
890
|
+
consumer_group_id: str,
|
891
|
+
*args,
|
892
|
+
**kwargs,
|
893
|
+
) -> None:
|
894
|
+
super().__init__(*args, **kwargs)
|
895
|
+
self.cluster_id = cluster_id
|
896
|
+
self.consumer_group_id = consumer_group_id
|
897
|
+
|
898
|
+
def execute(self, context: Context):
|
899
|
+
ApacheKafkaConsumerGroupLink.persist(
|
900
|
+
context=context,
|
901
|
+
task_instance=self,
|
902
|
+
cluster_id=self.cluster_id,
|
903
|
+
consumer_group_id=self.consumer_group_id,
|
904
|
+
)
|
905
|
+
self.log.info("Getting Consumer Group: %s", self.consumer_group_id)
|
906
|
+
try:
|
907
|
+
consumer_group = self.hook.get_consumer_group(
|
908
|
+
project_id=self.project_id,
|
909
|
+
location=self.location,
|
910
|
+
cluster_id=self.cluster_id,
|
911
|
+
consumer_group_id=self.consumer_group_id,
|
912
|
+
retry=self.retry,
|
913
|
+
timeout=self.timeout,
|
914
|
+
metadata=self.metadata,
|
915
|
+
)
|
916
|
+
self.log.info(
|
917
|
+
"The consumer group %s from cluster %s was retrieved.",
|
918
|
+
self.consumer_group_id,
|
919
|
+
self.cluster_id,
|
920
|
+
)
|
921
|
+
return types.ConsumerGroup.to_dict(consumer_group)
|
922
|
+
except NotFound as not_found_err:
|
923
|
+
self.log.info("The Consumer Group %s does not exist.", self.consumer_group_id)
|
924
|
+
raise AirflowException(not_found_err)
|
925
|
+
|
926
|
+
|
927
|
+
class ManagedKafkaUpdateConsumerGroupOperator(ManagedKafkaBaseOperator):
|
928
|
+
"""
|
929
|
+
Update the properties of a single consumer group.
|
930
|
+
|
931
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
932
|
+
:param location: Required. The ID of the Google Cloud region that the service belongs to.
|
933
|
+
:param cluster_id: Required. The ID of the cluster whose topic is to be updated.
|
934
|
+
:param consumer_group_id: Required. The ID of the consumer group whose configuration to update.
|
935
|
+
:param consumer_group: Required. The consumer_group to update. Its ``name`` field must be populated.
|
936
|
+
:param update_mask: Required. Field mask is used to specify the fields to be overwritten in the
|
937
|
+
ConsumerGroup resource by the update. The fields specified in the update_mask are relative to the
|
938
|
+
resource, not the full request. A field will be overwritten if it is in the mask.
|
939
|
+
:param retry: Designation of what errors, if any, should be retried.
|
940
|
+
:param timeout: The timeout for this request.
|
941
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
942
|
+
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
|
943
|
+
:param impersonation_chain: Optional service account to impersonate using short-term
|
944
|
+
credentials, or chained list of accounts required to get the access_token
|
945
|
+
of the last account in the list, which will be impersonated in the request.
|
946
|
+
If set as a string, the account must grant the originating account
|
947
|
+
the Service Account Token Creator IAM role.
|
948
|
+
If set as a sequence, the identities from the list must grant
|
949
|
+
Service Account Token Creator IAM role to the directly preceding identity, with first
|
950
|
+
account from the list granting this role to the originating account (templated).
|
951
|
+
"""
|
952
|
+
|
953
|
+
template_fields: Sequence[str] = tuple(
|
954
|
+
{"cluster_id", "consumer_group_id", "consumer_group", "update_mask"}
|
955
|
+
| set(ManagedKafkaBaseOperator.template_fields)
|
956
|
+
)
|
957
|
+
operator_extra_links = (ApacheKafkaConsumerGroupLink(),)
|
958
|
+
|
959
|
+
def __init__(
|
960
|
+
self,
|
961
|
+
cluster_id: str,
|
962
|
+
consumer_group_id: str,
|
963
|
+
consumer_group: types.Topic | dict,
|
964
|
+
update_mask: FieldMask | dict,
|
965
|
+
*args,
|
966
|
+
**kwargs,
|
967
|
+
) -> None:
|
968
|
+
super().__init__(*args, **kwargs)
|
969
|
+
self.cluster_id = cluster_id
|
970
|
+
self.consumer_group_id = consumer_group_id
|
971
|
+
self.consumer_group = consumer_group
|
972
|
+
self.update_mask = update_mask
|
973
|
+
|
974
|
+
def execute(self, context: Context):
|
975
|
+
ApacheKafkaConsumerGroupLink.persist(
|
976
|
+
context=context,
|
977
|
+
task_instance=self,
|
978
|
+
cluster_id=self.cluster_id,
|
979
|
+
consumer_group_id=self.consumer_group_id,
|
980
|
+
)
|
981
|
+
self.log.info("Updating an Apache Kafka consumer group.")
|
982
|
+
try:
|
983
|
+
consumer_group_obj = self.hook.update_consumer_group(
|
984
|
+
project_id=self.project_id,
|
985
|
+
location=self.location,
|
986
|
+
cluster_id=self.cluster_id,
|
987
|
+
consumer_group_id=self.consumer_group_id,
|
988
|
+
consumer_group=self.consumer_group,
|
989
|
+
update_mask=self.update_mask,
|
990
|
+
retry=self.retry,
|
991
|
+
timeout=self.timeout,
|
992
|
+
metadata=self.metadata,
|
993
|
+
)
|
994
|
+
self.log.info("Apache Kafka consumer group %s was updated.", self.consumer_group_id)
|
995
|
+
return types.ConsumerGroup.to_dict(consumer_group_obj)
|
996
|
+
except NotFound as not_found_err:
|
997
|
+
self.log.info("The Consumer Group %s does not exist.", self.consumer_group_id)
|
998
|
+
raise AirflowException(not_found_err)
|
999
|
+
except Exception as error:
|
1000
|
+
raise AirflowException(error)
|
1001
|
+
|
1002
|
+
|
1003
|
+
class ManagedKafkaDeleteConsumerGroupOperator(ManagedKafkaBaseOperator):
|
1004
|
+
"""
|
1005
|
+
Delete a single consumer group.
|
1006
|
+
|
1007
|
+
:param project_id: Required. The ID of the Google Cloud project that the service belongs to.
|
1008
|
+
:param location: Required. The ID of the Google Cloud region that the service belongs to.
|
1009
|
+
:param cluster_id: Required. The ID of the cluster whose consumer group is to be deleted.
|
1010
|
+
:param consumer_group_id: Required. The ID of the consumer group to delete.
|
1011
|
+
:param retry: Designation of what errors, if any, should be retried.
|
1012
|
+
:param timeout: The timeout for this request.
|
1013
|
+
:param metadata: Strings which should be sent along with the request as metadata.
|
1014
|
+
:param gcp_conn_id: The connection ID to use connecting to Google Cloud.
|
1015
|
+
:param impersonation_chain: Optional service account to impersonate using short-term
|
1016
|
+
credentials, or chained list of accounts required to get the access_token
|
1017
|
+
of the last account in the list, which will be impersonated in the request.
|
1018
|
+
If set as a string, the account must grant the originating account
|
1019
|
+
the Service Account Token Creator IAM role.
|
1020
|
+
If set as a sequence, the identities from the list must grant
|
1021
|
+
Service Account Token Creator IAM role to the directly preceding identity, with first
|
1022
|
+
account from the list granting this role to the originating account (templated).
|
1023
|
+
"""
|
1024
|
+
|
1025
|
+
template_fields: Sequence[str] = tuple(
|
1026
|
+
{"cluster_id", "consumer_group_id"} | set(ManagedKafkaBaseOperator.template_fields)
|
1027
|
+
)
|
1028
|
+
|
1029
|
+
def __init__(
|
1030
|
+
self,
|
1031
|
+
cluster_id: str,
|
1032
|
+
consumer_group_id: str,
|
1033
|
+
*args,
|
1034
|
+
**kwargs,
|
1035
|
+
) -> None:
|
1036
|
+
super().__init__(*args, **kwargs)
|
1037
|
+
self.cluster_id = cluster_id
|
1038
|
+
self.consumer_group_id = consumer_group_id
|
1039
|
+
|
1040
|
+
def execute(self, context: Context):
|
1041
|
+
try:
|
1042
|
+
self.log.info("Deleting Apache Kafka consumer group: %s", self.consumer_group_id)
|
1043
|
+
self.hook.delete_consumer_group(
|
1044
|
+
project_id=self.project_id,
|
1045
|
+
location=self.location,
|
1046
|
+
cluster_id=self.cluster_id,
|
1047
|
+
consumer_group_id=self.consumer_group_id,
|
1048
|
+
retry=self.retry,
|
1049
|
+
timeout=self.timeout,
|
1050
|
+
metadata=self.metadata,
|
1051
|
+
)
|
1052
|
+
self.log.info("Apache Kafka consumer group was deleted.")
|
1053
|
+
except NotFound as not_found_err:
|
1054
|
+
self.log.info("The Apache Kafka consumer group ID %s does not exist.", self.consumer_group_id)
|
1055
|
+
raise AirflowException(not_found_err)
|
@@ -22,16 +22,18 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
-
from airflow.providers.google.cloud.hooks.natural_language import CloudNaturalLanguageHook
|
26
|
-
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
27
25
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
28
26
|
from google.protobuf.json_format import MessageToDict
|
29
27
|
|
28
|
+
from airflow.providers.google.cloud.hooks.natural_language import CloudNaturalLanguageHook
|
29
|
+
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
30
|
+
|
30
31
|
if TYPE_CHECKING:
|
31
|
-
from airflow.utils.context import Context
|
32
32
|
from google.api_core.retry import Retry
|
33
33
|
from google.cloud.language_v1.types import Document, EncodingType
|
34
34
|
|
35
|
+
from airflow.utils.context import Context
|
36
|
+
|
35
37
|
|
36
38
|
MetaData = Sequence[tuple[str, str]]
|
37
39
|
|
@@ -28,13 +28,6 @@ from __future__ import annotations
|
|
28
28
|
from collections.abc import Sequence
|
29
29
|
from typing import TYPE_CHECKING, Any, Callable
|
30
30
|
|
31
|
-
from airflow.exceptions import AirflowException
|
32
|
-
from airflow.providers.google.cloud.hooks.pubsub import PubSubHook
|
33
|
-
from airflow.providers.google.cloud.links.pubsub import PubSubSubscriptionLink, PubSubTopicLink
|
34
|
-
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
35
|
-
from airflow.providers.google.cloud.triggers.pubsub import PubsubPullTrigger
|
36
|
-
from airflow.providers.google.common.consts import GOOGLE_DEFAULT_DEFERRABLE_METHOD_NAME
|
37
|
-
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
38
31
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
39
32
|
from google.cloud.pubsub_v1.types import (
|
40
33
|
DeadLetterPolicy,
|
@@ -47,10 +40,19 @@ from google.cloud.pubsub_v1.types import (
|
|
47
40
|
SchemaSettings,
|
48
41
|
)
|
49
42
|
|
43
|
+
from airflow.exceptions import AirflowException
|
44
|
+
from airflow.providers.google.cloud.hooks.pubsub import PubSubHook
|
45
|
+
from airflow.providers.google.cloud.links.pubsub import PubSubSubscriptionLink, PubSubTopicLink
|
46
|
+
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
47
|
+
from airflow.providers.google.cloud.triggers.pubsub import PubsubPullTrigger
|
48
|
+
from airflow.providers.google.common.consts import GOOGLE_DEFAULT_DEFERRABLE_METHOD_NAME
|
49
|
+
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
50
|
+
|
50
51
|
if TYPE_CHECKING:
|
51
|
-
from airflow.utils.context import Context
|
52
52
|
from google.api_core.retry import Retry
|
53
53
|
|
54
|
+
from airflow.utils.context import Context
|
55
|
+
|
54
56
|
|
55
57
|
class PubSubCreateTopicOperator(GoogleCloudBaseOperator):
|
56
58
|
"""
|
@@ -22,19 +22,21 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
26
|
+
from google.protobuf.json_format import MessageToDict
|
27
|
+
|
25
28
|
from airflow.exceptions import AirflowException
|
26
29
|
from airflow.providers.google.cloud.hooks.speech_to_text import CloudSpeechToTextHook, RecognitionAudio
|
27
30
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
28
31
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
29
32
|
from airflow.providers.google.common.links.storage import FileDetailsLink
|
30
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
31
|
-
from google.protobuf.json_format import MessageToDict
|
32
33
|
|
33
34
|
if TYPE_CHECKING:
|
34
|
-
from airflow.utils.context import Context
|
35
35
|
from google.api_core.retry import Retry
|
36
36
|
from google.cloud.speech_v1.types import RecognitionConfig
|
37
37
|
|
38
|
+
from airflow.utils.context import Context
|
39
|
+
|
38
40
|
|
39
41
|
class CloudSpeechToTextRecognizeSpeechOperator(GoogleCloudBaseOperator):
|
40
42
|
"""
|
@@ -20,6 +20,9 @@ from __future__ import annotations
|
|
20
20
|
from collections.abc import Sequence
|
21
21
|
from typing import TYPE_CHECKING
|
22
22
|
|
23
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
24
|
+
from google.cloud.monitoring_v3 import AlertPolicy, NotificationChannel
|
25
|
+
|
23
26
|
from airflow.providers.google.cloud.hooks.stackdriver import StackdriverHook
|
24
27
|
from airflow.providers.google.cloud.links.stackdriver import (
|
25
28
|
StackdriverNotificationsLink,
|
@@ -27,13 +30,12 @@ from airflow.providers.google.cloud.links.stackdriver import (
|
|
27
30
|
)
|
28
31
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
29
32
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
30
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
31
|
-
from google.cloud.monitoring_v3 import AlertPolicy, NotificationChannel
|
32
33
|
|
33
34
|
if TYPE_CHECKING:
|
34
|
-
from airflow.utils.context import Context
|
35
35
|
from google.api_core.retry import Retry
|
36
36
|
|
37
|
+
from airflow.utils.context import Context
|
38
|
+
|
37
39
|
|
38
40
|
class StackdriverListAlertPoliciesOperator(GoogleCloudBaseOperator):
|
39
41
|
"""
|
@@ -22,19 +22,21 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
+
from google.api_core.exceptions import AlreadyExists
|
26
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
27
|
+
from google.cloud.tasks_v2.types import Queue, Task
|
28
|
+
|
25
29
|
from airflow.providers.google.cloud.hooks.tasks import CloudTasksHook
|
26
30
|
from airflow.providers.google.cloud.links.cloud_tasks import CloudTasksLink, CloudTasksQueueLink
|
27
31
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
28
32
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
29
|
-
from google.api_core.exceptions import AlreadyExists
|
30
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
31
|
-
from google.cloud.tasks_v2.types import Queue, Task
|
32
33
|
|
33
34
|
if TYPE_CHECKING:
|
34
|
-
from airflow.utils.context import Context
|
35
35
|
from google.api_core.retry import Retry
|
36
36
|
from google.protobuf.field_mask_pb2 import FieldMask
|
37
37
|
|
38
|
+
from airflow.utils.context import Context
|
39
|
+
|
38
40
|
|
39
41
|
MetaData = Sequence[tuple[str, str]]
|
40
42
|
|
@@ -23,19 +23,21 @@ from collections.abc import Sequence
|
|
23
23
|
from tempfile import NamedTemporaryFile
|
24
24
|
from typing import TYPE_CHECKING
|
25
25
|
|
26
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
27
|
+
|
26
28
|
from airflow.exceptions import AirflowException
|
27
29
|
from airflow.providers.google.cloud.hooks.gcs import GCSHook
|
28
30
|
from airflow.providers.google.cloud.hooks.text_to_speech import CloudTextToSpeechHook
|
29
31
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
30
32
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
31
33
|
from airflow.providers.google.common.links.storage import FileDetailsLink
|
32
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
33
34
|
|
34
35
|
if TYPE_CHECKING:
|
35
|
-
from airflow.utils.context import Context
|
36
36
|
from google.api_core.retry import Retry
|
37
37
|
from google.cloud.texttospeech_v1.types import AudioConfig, SynthesisInput, VoiceSelectionParams
|
38
38
|
|
39
|
+
from airflow.utils.context import Context
|
40
|
+
|
39
41
|
|
40
42
|
class CloudTextToSpeechSynthesizeOperator(GoogleCloudBaseOperator):
|
41
43
|
"""
|
@@ -22,6 +22,9 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import MutableMapping, MutableSequence, Sequence
|
23
23
|
from typing import TYPE_CHECKING, cast
|
24
24
|
|
25
|
+
from google.api_core.exceptions import GoogleAPICallError
|
26
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
27
|
+
|
25
28
|
from airflow.exceptions import AirflowException
|
26
29
|
from airflow.providers.google.cloud.hooks.translate import CloudTranslateHook, TranslateHook
|
27
30
|
from airflow.providers.google.cloud.links.translate import (
|
@@ -35,11 +38,8 @@ from airflow.providers.google.cloud.links.translate import (
|
|
35
38
|
)
|
36
39
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
37
40
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
38
|
-
from google.api_core.exceptions import GoogleAPICallError
|
39
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
40
41
|
|
41
42
|
if TYPE_CHECKING:
|
42
|
-
from airflow.utils.context import Context
|
43
43
|
from google.api_core.retry import Retry
|
44
44
|
from google.cloud.translate_v3.types import (
|
45
45
|
BatchDocumentInputConfig,
|
@@ -55,6 +55,8 @@ if TYPE_CHECKING:
|
|
55
55
|
)
|
56
56
|
from google.cloud.translate_v3.types.translation_service import Glossary, GlossaryInputConfig
|
57
57
|
|
58
|
+
from airflow.utils.context import Context
|
59
|
+
|
58
60
|
|
59
61
|
class CloudTranslateTextOperator(GoogleCloudBaseOperator):
|
60
62
|
"""
|
@@ -22,18 +22,20 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
+
from google.protobuf.json_format import MessageToDict
|
26
|
+
|
25
27
|
from airflow.exceptions import AirflowException
|
26
28
|
from airflow.providers.google.cloud.hooks.speech_to_text import CloudSpeechToTextHook
|
27
29
|
from airflow.providers.google.cloud.hooks.translate import CloudTranslateHook
|
28
30
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
29
31
|
from airflow.providers.google.common.hooks.base_google import PROVIDE_PROJECT_ID
|
30
32
|
from airflow.providers.google.common.links.storage import FileDetailsLink
|
31
|
-
from google.protobuf.json_format import MessageToDict
|
32
33
|
|
33
34
|
if TYPE_CHECKING:
|
34
|
-
from airflow.utils.context import Context
|
35
35
|
from google.cloud.speech_v1.types import RecognitionAudio, RecognitionConfig
|
36
36
|
|
37
|
+
from airflow.utils.context import Context
|
38
|
+
|
37
39
|
|
38
40
|
class CloudTranslateSpeechOperator(GoogleCloudBaseOperator):
|
39
41
|
"""
|
@@ -23,6 +23,12 @@ from __future__ import annotations
|
|
23
23
|
from collections.abc import Sequence
|
24
24
|
from typing import TYPE_CHECKING
|
25
25
|
|
26
|
+
from google.api_core.exceptions import NotFound
|
27
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
28
|
+
from google.cloud.aiplatform import datasets
|
29
|
+
from google.cloud.aiplatform.models import Model
|
30
|
+
from google.cloud.aiplatform_v1.types.training_pipeline import TrainingPipeline
|
31
|
+
|
26
32
|
from airflow.exceptions import AirflowProviderDeprecationWarning
|
27
33
|
from airflow.providers.google.cloud.hooks.vertex_ai.auto_ml import AutoMLHook
|
28
34
|
from airflow.providers.google.cloud.links.vertex_ai import (
|
@@ -32,16 +38,12 @@ from airflow.providers.google.cloud.links.vertex_ai import (
|
|
32
38
|
)
|
33
39
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
34
40
|
from airflow.providers.google.common.deprecated import deprecated
|
35
|
-
from google.api_core.exceptions import NotFound
|
36
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
37
|
-
from google.cloud.aiplatform import datasets
|
38
|
-
from google.cloud.aiplatform.models import Model
|
39
|
-
from google.cloud.aiplatform_v1.types.training_pipeline import TrainingPipeline
|
40
41
|
|
41
42
|
if TYPE_CHECKING:
|
42
|
-
from airflow.utils.context import Context
|
43
43
|
from google.api_core.retry import Retry
|
44
44
|
|
45
|
+
from airflow.utils.context import Context
|
46
|
+
|
45
47
|
|
46
48
|
class AutoMLTrainingJobBaseOperator(GoogleCloudBaseOperator):
|
47
49
|
"""The base class for operators that launch AutoML jobs on VertexAI."""
|
@@ -24,6 +24,10 @@ from collections.abc import Sequence
|
|
24
24
|
from functools import cached_property
|
25
25
|
from typing import TYPE_CHECKING, Any
|
26
26
|
|
27
|
+
from google.api_core.exceptions import NotFound
|
28
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
29
|
+
from google.cloud.aiplatform_v1.types import BatchPredictionJob
|
30
|
+
|
27
31
|
from airflow.configuration import conf
|
28
32
|
from airflow.exceptions import AirflowException
|
29
33
|
from airflow.providers.google.cloud.hooks.vertex_ai.batch_prediction_job import BatchPredictionJobHook
|
@@ -33,15 +37,13 @@ from airflow.providers.google.cloud.links.vertex_ai import (
|
|
33
37
|
)
|
34
38
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
35
39
|
from airflow.providers.google.cloud.triggers.vertex_ai import CreateBatchPredictionJobTrigger
|
36
|
-
from google.api_core.exceptions import NotFound
|
37
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
38
|
-
from google.cloud.aiplatform_v1.types import BatchPredictionJob
|
39
40
|
|
40
41
|
if TYPE_CHECKING:
|
41
|
-
from airflow.utils.context import Context
|
42
42
|
from google.api_core.retry import Retry
|
43
43
|
from google.cloud.aiplatform import BatchPredictionJob as BatchPredictionJobObject, Model, explain
|
44
44
|
|
45
|
+
from airflow.utils.context import Context
|
46
|
+
|
45
47
|
|
46
48
|
class CreateBatchPredictionJobOperator(GoogleCloudBaseOperator):
|
47
49
|
"""
|
@@ -23,6 +23,12 @@ from collections.abc import Sequence
|
|
23
23
|
from functools import cached_property
|
24
24
|
from typing import TYPE_CHECKING, Any
|
25
25
|
|
26
|
+
from google.api_core.exceptions import NotFound
|
27
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
28
|
+
from google.cloud.aiplatform.models import Model
|
29
|
+
from google.cloud.aiplatform_v1.types.dataset import Dataset
|
30
|
+
from google.cloud.aiplatform_v1.types.training_pipeline import TrainingPipeline
|
31
|
+
|
26
32
|
from airflow.configuration import conf
|
27
33
|
from airflow.exceptions import AirflowException, AirflowProviderDeprecationWarning
|
28
34
|
from airflow.providers.google.cloud.hooks.vertex_ai.custom_job import CustomJobHook
|
@@ -38,14 +44,8 @@ from airflow.providers.google.cloud.triggers.vertex_ai import (
|
|
38
44
|
CustomTrainingJobTrigger,
|
39
45
|
)
|
40
46
|
from airflow.providers.google.common.deprecated import deprecated
|
41
|
-
from google.api_core.exceptions import NotFound
|
42
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
43
|
-
from google.cloud.aiplatform.models import Model
|
44
|
-
from google.cloud.aiplatform_v1.types.dataset import Dataset
|
45
|
-
from google.cloud.aiplatform_v1.types.training_pipeline import TrainingPipeline
|
46
47
|
|
47
48
|
if TYPE_CHECKING:
|
48
|
-
from airflow.utils.context import Context
|
49
49
|
from google.api_core.retry import Retry
|
50
50
|
from google.cloud.aiplatform import (
|
51
51
|
CustomContainerTrainingJob,
|
@@ -53,6 +53,8 @@ if TYPE_CHECKING:
|
|
53
53
|
CustomTrainingJob,
|
54
54
|
)
|
55
55
|
|
56
|
+
from airflow.utils.context import Context
|
57
|
+
|
56
58
|
|
57
59
|
class CustomTrainingJobBaseOperator(GoogleCloudBaseOperator):
|
58
60
|
"""The base class for operators that launch Custom jobs on VertexAI."""
|
@@ -22,18 +22,20 @@ from __future__ import annotations
|
|
22
22
|
from collections.abc import Sequence
|
23
23
|
from typing import TYPE_CHECKING
|
24
24
|
|
25
|
-
from airflow.providers.google.cloud.hooks.vertex_ai.dataset import DatasetHook
|
26
|
-
from airflow.providers.google.cloud.links.vertex_ai import VertexAIDatasetLink, VertexAIDatasetListLink
|
27
|
-
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
28
25
|
from google.api_core.exceptions import NotFound
|
29
26
|
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
30
27
|
from google.cloud.aiplatform_v1.types import Dataset, ExportDataConfig, ImportDataConfig
|
31
28
|
|
29
|
+
from airflow.providers.google.cloud.hooks.vertex_ai.dataset import DatasetHook
|
30
|
+
from airflow.providers.google.cloud.links.vertex_ai import VertexAIDatasetLink, VertexAIDatasetListLink
|
31
|
+
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
32
|
+
|
32
33
|
if TYPE_CHECKING:
|
33
|
-
from airflow.utils.context import Context
|
34
34
|
from google.api_core.retry import Retry
|
35
35
|
from google.protobuf.field_mask_pb2 import FieldMask
|
36
36
|
|
37
|
+
from airflow.utils.context import Context
|
38
|
+
|
37
39
|
|
38
40
|
class CreateDatasetOperator(GoogleCloudBaseOperator):
|
39
41
|
"""
|
@@ -23,6 +23,10 @@ from __future__ import annotations
|
|
23
23
|
from collections.abc import Sequence
|
24
24
|
from typing import TYPE_CHECKING
|
25
25
|
|
26
|
+
from google.api_core.exceptions import NotFound
|
27
|
+
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
28
|
+
from google.cloud.aiplatform_v1.types import DeployedModel, Endpoint, endpoint_service
|
29
|
+
|
26
30
|
from airflow.providers.google.cloud.hooks.vertex_ai.endpoint_service import EndpointServiceHook
|
27
31
|
from airflow.providers.google.cloud.links.vertex_ai import (
|
28
32
|
VertexAIEndpointLink,
|
@@ -30,15 +34,13 @@ from airflow.providers.google.cloud.links.vertex_ai import (
|
|
30
34
|
VertexAIModelLink,
|
31
35
|
)
|
32
36
|
from airflow.providers.google.cloud.operators.cloud_base import GoogleCloudBaseOperator
|
33
|
-
from google.api_core.exceptions import NotFound
|
34
|
-
from google.api_core.gapic_v1.method import DEFAULT, _MethodDefault
|
35
|
-
from google.cloud.aiplatform_v1.types import DeployedModel, Endpoint, endpoint_service
|
36
37
|
|
37
38
|
if TYPE_CHECKING:
|
38
|
-
from airflow.utils.context import Context
|
39
39
|
from google.api_core.retry import Retry
|
40
40
|
from google.protobuf.field_mask_pb2 import FieldMask
|
41
41
|
|
42
|
+
from airflow.utils.context import Context
|
43
|
+
|
42
44
|
|
43
45
|
class CreateEndpointOperator(GoogleCloudBaseOperator):
|
44
46
|
"""
|