@@ -27,6 +27,7 @@ from typing import Any, Callable, TypeVar, overload
27
27
from docker .types import Mount
28
28
from kubernetes .client import models as k8s
29
29
30
+ from airflow .providers .cncf .kubernetes .callbacks import KubernetesPodOperatorCallback
30
31
from airflow .providers .cncf .kubernetes .secret import Secret
31
32
from airflow .sdk .bases .decorator import FParams , FReturn , Task , TaskDecorator , _TaskDecorator
32
33
from airflow .sdk .definitions .dag import dag
@@ -96,16 +97,21 @@ class TaskDecoratorCollection:
96
97
multiple_outputs : bool | None = None ,
97
98
# 'python_callable', 'op_args' and 'op_kwargs' since they are filled by
98
99
# _PythonVirtualenvDecoratedOperator.
100
+ python_callable : Callable ,
101
+ op_args : Collection [Any ] | None = None ,
102
+ op_kwargs : Mapping [str , Any ] | None = None ,
99
103
requirements : None | Iterable [str ] | str = None ,
100
104
python_version : None | str | int | float = None ,
101
105
serializer : Literal ["pickle" , "cloudpickle" , "dill" ] | None = None ,
102
106
system_site_packages : bool = True ,
103
107
templates_dict : Mapping [str , Any ] | None = None ,
108
+ templates_exts : list [str ] | None = None ,
104
109
pip_install_options : list [str ] | None = None ,
110
+ expect_airflow : bool = True ,
105
111
skip_on_exit_code : int | Container [int ] | None = None ,
106
112
index_urls : None | Collection [str ] | str = None ,
107
113
venv_cache_path : None | str = None ,
108
- show_return_value_in_logs : bool = True ,
114
+ string_args : Iterable [ str ] | None = None ,
109
115
env_vars : dict [str , str ] | None = None ,
110
116
inherit_env : bool = True ,
111
117
** kwargs ,
@@ -218,18 +224,24 @@ class TaskDecoratorCollection:
218
224
self ,
219
225
* ,
220
226
multiple_outputs : bool | None = None ,
221
- # 'python_callable', 'op_args' and 'op_kwargs' since they are filled by
222
- # _PythonVirtualenvDecoratedOperator.
227
+ python_callable : Callable ,
223
228
requirements : None | Iterable [str ] | str = None ,
229
+ op_args : Collection [Any ] | None = None ,
230
+ op_kwargs : Mapping [str , Any ] | None = None ,
231
+ string_args : Iterable [str ] | None = None ,
224
232
python_version : None | str | int | float = None ,
225
233
serializer : Literal ["pickle" , "cloudpickle" , "dill" ] | None = None ,
226
234
system_site_packages : bool = True ,
227
235
templates_dict : Mapping [str , Any ] | None = None ,
236
+ templates_exts : list [str ] | None = None ,
228
237
pip_install_options : list [str ] | None = None ,
229
238
skip_on_exit_code : int | Container [int ] | None = None ,
230
239
index_urls : None | Collection [str ] | str = None ,
231
240
venv_cache_path : None | str = None ,
241
+ expect_airflow : bool = True ,
232
242
show_return_value_in_logs : bool = True ,
243
+ env_vars : dict [str , str ] | None = None ,
244
+ inherit_env : bool = True ,
233
245
** kwargs ,
234
246
) -> TaskDecorator :
235
247
"""Create a decorator to wrap the decorated callable into a BranchPythonVirtualenvOperator.
@@ -507,6 +519,7 @@ class TaskDecoratorCollection:
507
519
image : str | None = None ,
508
520
name : str | None = None ,
509
521
random_name_suffix : bool = ...,
522
+ cmds : list [str ] | None = None ,
510
523
arguments : list [str ] | None = None ,
511
524
ports : list [k8s .V1ContainerPort ] | None = None ,
512
525
volume_mounts : list [k8s .V1VolumeMount ] | None = None ,
@@ -520,6 +533,7 @@ class TaskDecoratorCollection:
520
533
reattach_on_restart : bool = ...,
521
534
startup_timeout_seconds : int = ...,
522
535
startup_check_interval_seconds : int = ...,
536
+ schedule_timeout_seconds : int | None = None ,
523
537
get_logs : bool = True ,
524
538
container_logs : Iterable [str ] | str | Literal [True ] = ...,
525
539
image_pull_policy : str | None = None ,
@@ -530,6 +544,7 @@ class TaskDecoratorCollection:
530
544
node_selector : dict | None = None ,
531
545
image_pull_secrets : list [k8s .V1LocalObjectReference ] | None = None ,
532
546
service_account_name : str | None = None ,
547
+ automount_service_account_token : bool | None = None ,
533
548
hostnetwork : bool = False ,
534
549
host_aliases : list [k8s .V1HostAlias ] | None = None ,
535
550
tolerations : list [k8s .V1Toleration ] | None = None ,
@@ -553,13 +568,19 @@ class TaskDecoratorCollection:
553
568
skip_on_exit_code : int | Container [int ] | None = None ,
554
569
base_container_name : str | None = None ,
555
570
base_container_status_polling_interval : float = ...,
571
+ init_container_logs : Iterable [str ] | str | Literal [True ] | None = None ,
556
572
deferrable : bool = ...,
557
573
poll_interval : float = ...,
558
574
log_pod_spec_on_failure : bool = ...,
559
575
on_finish_action : str = ...,
576
+ is_delete_operator_pod : None | bool = None ,
560
577
termination_message_policy : str = ...,
561
578
active_deadline_seconds : int | None = None ,
579
+ callbacks : (
580
+ list [type [KubernetesPodOperatorCallback ]] | type [KubernetesPodOperatorCallback ] | None
581
+ ) = None ,
562
582
progress_callback : Callable [[str ], None ] | None = None ,
583
+ logging_interval : int | None = None ,
563
584
** kwargs ,
564
585
) -> TaskDecorator :
565
586
"""Create a decorator to convert a callable to a Kubernetes Pod task.
@@ -849,6 +870,8 @@ class TaskDecoratorCollection:
849
870
mode : str = ...,
850
871
exponential_backoff : bool = False ,
851
872
max_wait : timedelta | float | None = None ,
873
+ silent_fail : bool = False ,
874
+ never_fail : bool = False ,
852
875
** kwargs ,
853
876
) -> TaskDecorator :
854
877
"""
@@ -873,6 +896,13 @@ class TaskDecoratorCollection:
873
896
:param exponential_backoff: allow progressive longer waits between
874
897
pokes by using exponential backoff algorithm
875
898
:param max_wait: maximum wait interval between pokes, can be ``timedelta`` or ``float`` seconds
899
+ :param silent_fail: If true, and poke method raises an exception different from
900
+ AirflowSensorTimeout, AirflowTaskTimeout, AirflowSkipException
901
+ and AirflowFailException, the sensor will log the error and continue
902
+ its execution. Otherwise, the sensor task fails, and it can be retried
903
+ based on the provided `retries` parameter.
904
+ :param never_fail: If true, and poke method raises an exception, sensor will be skipped.
905
+ Mutually exclusive with soft_fail.
876
906
"""
877
907
@overload
878
908
def sensor (self , python_callable : Callable [FParams , FReturn ] | None = None ) -> Task [FParams , FReturn ]: ...
0 commit comments