apache-airflow-providers-standard 1.2.0__py3-none-any.whl → 1.3.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.
Files changed (30) hide show
  1. airflow/providers/standard/__init__.py +1 -1
  2. airflow/providers/standard/example_dags/__init__.py +16 -0
  3. airflow/providers/standard/example_dags/example_bash_decorator.py +114 -0
  4. airflow/providers/standard/example_dags/example_bash_operator.py +74 -0
  5. airflow/providers/standard/example_dags/example_branch_datetime_operator.py +105 -0
  6. airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py +61 -0
  7. airflow/providers/standard/example_dags/example_branch_operator.py +166 -0
  8. airflow/providers/standard/example_dags/example_branch_operator_decorator.py +142 -0
  9. airflow/providers/standard/example_dags/example_external_task_child_deferrable.py +34 -0
  10. airflow/providers/standard/example_dags/example_external_task_marker_dag.py +98 -0
  11. airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py +64 -0
  12. airflow/providers/standard/example_dags/example_latest_only.py +40 -0
  13. airflow/providers/standard/example_dags/example_python_decorator.py +132 -0
  14. airflow/providers/standard/example_dags/example_python_operator.py +147 -0
  15. airflow/providers/standard/example_dags/example_sensor_decorator.py +66 -0
  16. airflow/providers/standard/example_dags/example_sensors.py +135 -0
  17. airflow/providers/standard/example_dags/example_short_circuit_decorator.py +60 -0
  18. airflow/providers/standard/example_dags/example_short_circuit_operator.py +66 -0
  19. airflow/providers/standard/example_dags/example_trigger_controller_dag.py +46 -0
  20. airflow/providers/standard/example_dags/sql/__init__.py +16 -0
  21. airflow/providers/standard/example_dags/sql/sample.sql +24 -0
  22. airflow/providers/standard/operators/python.py +15 -9
  23. airflow/providers/standard/sensors/date_time.py +10 -4
  24. airflow/providers/standard/sensors/external_task.py +7 -6
  25. airflow/providers/standard/sensors/time.py +52 -40
  26. airflow/providers/standard/sensors/time_delta.py +47 -20
  27. {apache_airflow_providers_standard-1.2.0.dist-info → apache_airflow_providers_standard-1.3.0rc1.dist-info}/METADATA +7 -7
  28. {apache_airflow_providers_standard-1.2.0.dist-info → apache_airflow_providers_standard-1.3.0rc1.dist-info}/RECORD +30 -10
  29. {apache_airflow_providers_standard-1.2.0.dist-info → apache_airflow_providers_standard-1.3.0rc1.dist-info}/WHEEL +0 -0
  30. {apache_airflow_providers_standard-1.2.0.dist-info → apache_airflow_providers_standard-1.3.0rc1.dist-info}/entry_points.txt +0 -0
@@ -17,14 +17,16 @@
17
17
  # under the License.
18
18
  from __future__ import annotations
19
19
 
20
+ import warnings
20
21
  from datetime import datetime, timedelta
21
22
  from time import sleep
22
23
  from typing import TYPE_CHECKING, Any, NoReturn
23
24
 
25
+ from deprecated.classic import deprecated
24
26
  from packaging.version import Version
25
27
 
26
28
  from airflow.configuration import conf
27
- from airflow.exceptions import AirflowSkipException
29
+ from airflow.exceptions import AirflowProviderDeprecationWarning, AirflowSkipException
28
30
  from airflow.providers.standard.triggers.temporal import DateTimeTrigger, TimeDeltaTrigger
29
31
  from airflow.providers.standard.version_compat import AIRFLOW_V_3_0_PLUS
30
32
  from airflow.sensors.base import BaseSensorOperator
@@ -52,6 +54,7 @@ class TimeDeltaSensor(BaseSensorOperator):
52
54
  otherwise run_after will be used.
53
55
 
54
56
  :param delta: time to wait before succeeding.
57
+ :param deferrable: Run sensor in deferrable mode. If set to True, task will defer itself to avoid taking up a worker slot while it is waiting.
55
58
 
56
59
  .. seealso::
57
60
  For more information on how to use this sensor, take a look at the guide:
@@ -59,9 +62,18 @@ class TimeDeltaSensor(BaseSensorOperator):
59
62
 
60
63
  """
61
64
 
62
- def __init__(self, *, delta, **kwargs):
65
+ def __init__(
66
+ self,
67
+ *,
68
+ delta: timedelta,
69
+ deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
70
+ end_from_trigger: bool = False,
71
+ **kwargs,
72
+ ):
63
73
  super().__init__(**kwargs)
64
74
  self.delta = delta
75
+ self.deferrable = deferrable
76
+ self.end_from_trigger = end_from_trigger
65
77
 
66
78
  def _derive_base_time(self, context: Context) -> datetime:
67
79
  """
@@ -90,27 +102,21 @@ class TimeDeltaSensor(BaseSensorOperator):
90
102
  self.log.info("Checking if the delta has elapsed base_time=%s, delta=%s", base_time, self.delta)
91
103
  return timezone.utcnow() > target_dttm
92
104
 
93
-
94
- class TimeDeltaSensorAsync(TimeDeltaSensor):
95
105
  """
96
- A deferrable drop-in replacement for TimeDeltaSensor.
97
-
98
- Will defers itself to avoid taking up a worker slot while it is waiting.
99
-
100
- :param delta: time length to wait after the data interval before succeeding.
101
- :param end_from_trigger: End the task directly from the triggerer without going into the worker.
102
-
103
- .. seealso::
104
- For more information on how to use this sensor, take a look at the guide:
105
- :ref:`howto/operator:TimeDeltaSensorAsync`
106
-
106
+ Asynchronous execution
107
107
  """
108
108
 
109
- def __init__(self, *, end_from_trigger: bool = False, delta, **kwargs) -> None:
110
- super().__init__(delta=delta, **kwargs)
111
- self.end_from_trigger = end_from_trigger
112
-
113
109
  def execute(self, context: Context) -> bool | NoReturn:
110
+ """
111
+ Depending on the deferrable flag, either execute the sensor in a blocking way or defer it.
112
+
113
+ - Sync path → use BaseSensorOperator.execute() which loops over ``poke``.
114
+ - Async path → defer to DateTimeTrigger and free the worker slot.
115
+ """
116
+ if not self.deferrable:
117
+ return super().execute(context=context)
118
+
119
+ # Deferrable path
114
120
  base_time = self._derive_base_time(context=context)
115
121
  target_dttm: datetime = base_time + self.delta
116
122
 
@@ -129,9 +135,10 @@ class TimeDeltaSensorAsync(TimeDeltaSensor):
129
135
 
130
136
  # todo: remove backcompat when min airflow version greater than 2.11
131
137
  timeout: int | float | timedelta
132
- if _get_airflow_version() >= Version("2.11.0"):
138
+ if AIRFLOW_V_3_0_PLUS:
133
139
  timeout = self.timeout
134
140
  else:
141
+ # <=2.11 requires timedelta
135
142
  timeout = timedelta(seconds=self.timeout)
136
143
 
137
144
  self.defer(
@@ -145,6 +152,26 @@ class TimeDeltaSensorAsync(TimeDeltaSensor):
145
152
  return None
146
153
 
147
154
 
155
+ # TODO: Remove in the next major release
156
+ @deprecated(
157
+ "Use `TimeDeltaSensor` with `deferrable=True` instead", category=AirflowProviderDeprecationWarning
158
+ )
159
+ class TimeDeltaSensorAsync(TimeDeltaSensor):
160
+ """
161
+ Deprecated. Use TimeDeltaSensor with deferrable=True instead.
162
+
163
+ :sphinx-autoapi-skip:
164
+ """
165
+
166
+ def __init__(self, *, end_from_trigger: bool = False, delta, **kwargs) -> None:
167
+ warnings.warn(
168
+ "TimeDeltaSensorAsync is deprecated and will be removed in a future version. Use `TimeDeltaSensor` with `deferrable=True` instead.",
169
+ AirflowProviderDeprecationWarning,
170
+ stacklevel=2,
171
+ )
172
+ super().__init__(delta=delta, deferrable=True, end_from_trigger=end_from_trigger, **kwargs)
173
+
174
+
148
175
  class WaitSensor(BaseSensorOperator):
149
176
  """
150
177
  A sensor that waits a specified period of time before completing.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: apache-airflow-providers-standard
3
- Version: 1.2.0
3
+ Version: 1.3.0rc1
4
4
  Summary: Provider package apache-airflow-providers-standard for Apache Airflow
5
5
  Keywords: airflow-provider,standard,airflow,integration
6
6
  Author-email: Apache Software Foundation <dev@airflow.apache.org>
@@ -20,10 +20,10 @@ Classifier: Programming Language :: Python :: 3.10
20
20
  Classifier: Programming Language :: Python :: 3.11
21
21
  Classifier: Programming Language :: Python :: 3.12
22
22
  Classifier: Topic :: System :: Monitoring
23
- Requires-Dist: apache-airflow>=2.10.0
23
+ Requires-Dist: apache-airflow>=2.10.0rc1
24
24
  Project-URL: Bug Tracker, https://github.com/apache/airflow/issues
25
- Project-URL: Changelog, https://airflow.apache.org/docs/apache-airflow-providers-standard/1.2.0/changelog.html
26
- Project-URL: Documentation, https://airflow.apache.org/docs/apache-airflow-providers-standard/1.2.0
25
+ Project-URL: Changelog, https://airflow.staged.apache.org/docs/apache-airflow-providers-standard/1.3.0/changelog.html
26
+ Project-URL: Documentation, https://airflow.staged.apache.org/docs/apache-airflow-providers-standard/1.3.0
27
27
  Project-URL: Mastodon, https://fosstodon.org/@airflow
28
28
  Project-URL: Slack Chat, https://s.apache.org/airflow-slack
29
29
  Project-URL: Source Code, https://github.com/apache/airflow
@@ -54,7 +54,7 @@ Project-URL: YouTube, https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/
54
54
 
55
55
  Package ``apache-airflow-providers-standard``
56
56
 
57
- Release: ``1.2.0``
57
+ Release: ``1.3.0``
58
58
 
59
59
 
60
60
  Airflow Standard Provider
@@ -67,7 +67,7 @@ This is a provider package for ``standard`` provider. All classes for this provi
67
67
  are in ``airflow.providers.standard`` python package.
68
68
 
69
69
  You can find package information and changelog for the provider
70
- in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-standard/1.2.0/>`_.
70
+ in the `documentation <https://airflow.apache.org/docs/apache-airflow-providers-standard/1.3.0/>`_.
71
71
 
72
72
  Installation
73
73
  ------------
@@ -88,5 +88,5 @@ PIP package Version required
88
88
  ================== ==================
89
89
 
90
90
  The changelog for the provider package can be found in the
91
- `changelog <https://airflow.apache.org/docs/apache-airflow-providers-standard/1.2.0/changelog.html>`_.
91
+ `changelog <https://airflow.apache.org/docs/apache-airflow-providers-standard/1.3.0/changelog.html>`_.
92
92
 
@@ -1,5 +1,5 @@
1
1
  airflow/providers/standard/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
2
- airflow/providers/standard/__init__.py,sha256=w-ohvwgsE19GzHH1PMPQpVI6bMYmgFWm6aBLEj5TVBg,1497
2
+ airflow/providers/standard/__init__.py,sha256=DWSlRY2UJACO0AHs5NTsnaYEDXkspAcyGPIjdbB10lw,1497
3
3
  airflow/providers/standard/exceptions.py,sha256=MN4gEuNI8rFYx8zs5aAsUKDwyZQNuCig68h15CdwJ90,2075
4
4
  airflow/providers/standard/get_provider_info.py,sha256=9qlyfIHRu_d_jZyyE0SR8s2dN9HEjzV5P2EjyVCcbw4,7003
5
5
  airflow/providers/standard/version_compat.py,sha256=j5PCtXvZ71aBjixu-EFTNtVDPsngzzs7os0ZQDgFVDk,1536
@@ -13,6 +13,26 @@ airflow/providers/standard/decorators/python.py,sha256=9Fdk8CRQJ7HQzhKT1Qh-CzfbX
13
13
  airflow/providers/standard/decorators/python_virtualenv.py,sha256=Xhul1iA0mJlN5N1EZl1LWIs90pUhS6bawQtVSpQhqEg,2565
14
14
  airflow/providers/standard/decorators/sensor.py,sha256=04PPtcDhSr_Wa4LJct2eiBczb8JEAzjiSos2CqBu3-4,3230
15
15
  airflow/providers/standard/decorators/short_circuit.py,sha256=3_6UHDhloPMT3fGeHFDBjf3rScXQm4wtfx59n-n__Ys,2506
16
+ airflow/providers/standard/example_dags/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
17
+ airflow/providers/standard/example_dags/example_bash_decorator.py,sha256=6tJyRuHso9ITzTrKWK_kvMLKQFVzajkuWfkvaP-fMp4,3878
18
+ airflow/providers/standard/example_dags/example_bash_operator.py,sha256=tAS4cBsKW9B1nUukmYTpUw5Vf63476v_-tYjffyAtd4,2352
19
+ airflow/providers/standard/example_dags/example_branch_datetime_operator.py,sha256=6sGzn1xlMaF3I-HMI7bvx78oyxZUw5WAF_Gja_ZUch0,3765
20
+ airflow/providers/standard/example_dags/example_branch_day_of_week_operator.py,sha256=75ncMaGfkjxN0ULszqeXrSL5rHauUTNOhGiGAGPm3pw,2362
21
+ airflow/providers/standard/example_dags/example_branch_operator.py,sha256=c4dr2drDHgYEN5ZdtlN_KH6sdXEHdxqEbsQDCHbPku4,5269
22
+ airflow/providers/standard/example_dags/example_branch_operator_decorator.py,sha256=mF_87Kqxhui6sCsWvBXJ6m_w9bUoeqrA_rUVJuyIeq4,4801
23
+ airflow/providers/standard/example_dags/example_external_task_child_deferrable.py,sha256=o-ji3leJTBjiChEWoqVu4ykz1YVYUd8-ApmZwHFcNc8,1233
24
+ airflow/providers/standard/example_dags/example_external_task_marker_dag.py,sha256=gssBjlfrGMDLZxTYOxo8ihXLbJ-3Uu31QodINGFWYNU,3650
25
+ airflow/providers/standard/example_dags/example_external_task_parent_deferrable.py,sha256=GFr2LHK7DkCDE_vDczi8pbz_VFeGoNxgy2QJzsG9dt0,2297
26
+ airflow/providers/standard/example_dags/example_latest_only.py,sha256=ac9WpLMWLzyuxZks74t3HojS7vRG2gynmQfGm13gwOI,1456
27
+ airflow/providers/standard/example_dags/example_python_decorator.py,sha256=jveqPOw1GZzD3Z37_rYc8Q8hcyx8vCNjgetpO_P6qmg,4281
28
+ airflow/providers/standard/example_dags/example_python_operator.py,sha256=3L6CZHK2Fb7zmA9tDhZ5QaEe38WJYlS4l35Gc7xJAoE,4761
29
+ airflow/providers/standard/example_dags/example_sensor_decorator.py,sha256=zEZUh2YD17T8-bX-HGjar5cCqgi6qHIB0fXY29lboJA,1873
30
+ airflow/providers/standard/example_dags/example_sensors.py,sha256=6gLWMyRA5GS71a7IvO_--Dd12aML9GyLYMOmjgyLg30,4658
31
+ airflow/providers/standard/example_dags/example_short_circuit_decorator.py,sha256=Fo8ip4wUqFcfdKffMu40SvDfdIfgZ0Bmq_4S7aA8s7o,2420
32
+ airflow/providers/standard/example_dags/example_short_circuit_operator.py,sha256=WatudzQM8K_6SJ8ndgGrhpcR89AJboOpPIK37U1mOAk,2414
33
+ airflow/providers/standard/example_dags/example_trigger_controller_dag.py,sha256=lHgCZC5Zkv4E3couxAYlpb1EazSmOF_qKqunIAfjskM,1752
34
+ airflow/providers/standard/example_dags/sql/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
35
+ airflow/providers/standard/example_dags/sql/sample.sql,sha256=OVk1qozBY58lp_tFtnyQiLSbKRdqKn4zbxJHH_Umdek,866
16
36
  airflow/providers/standard/hooks/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
17
37
  airflow/providers/standard/hooks/filesystem.py,sha256=fDZwW_EYD8z1QXnReqI7gIwSbDPZNTKtqQvgktiP02o,2870
18
38
  airflow/providers/standard/hooks/package_index.py,sha256=U7_s_02-wwz9kTkzKr3JAhVQj2spuntWd_GmjfpV-y4,3769
@@ -23,18 +43,18 @@ airflow/providers/standard/operators/branch.py,sha256=C_AUd7TSo_U52GiWsrR7rJIsRU
23
43
  airflow/providers/standard/operators/datetime.py,sha256=bYDdbfAyAlEXRRHjOgB06UhgDum6SPdd5I3u-ylPSaw,5005
24
44
  airflow/providers/standard/operators/empty.py,sha256=C7_uLWJK6kExzlNc7xdMo8VAQ_ONWITvEQ2FImrMepM,1324
25
45
  airflow/providers/standard/operators/latest_only.py,sha256=1yJtpi6cK4TIjARQgcrf460as4V6uVBdoDtjJEUnbvs,4884
26
- airflow/providers/standard/operators/python.py,sha256=pyYeVlk2ZioYMFnA3ZICY8T7vEcWJZTmSyPmZp6hWVk,51544
46
+ airflow/providers/standard/operators/python.py,sha256=3ybN_tse04iGYt27ld16JWkNOs_jNK15MjbuBOBKPPY,51848
27
47
  airflow/providers/standard/operators/smooth.py,sha256=d3OV38EzV_wlfMYN3JGWGwyzsFonx8VbqgGfXSw0_bM,1382
28
48
  airflow/providers/standard/operators/trigger_dagrun.py,sha256=isd9HVzYhAZS_Y3V1iQ3Gm2QlOV6KdGWHdq0PnhWxrU,16746
29
49
  airflow/providers/standard/operators/weekday.py,sha256=Qg7LhXYtybVSGZn8uQqF-r7RB7zOXfe3R6vSGVa_rJk,5083
30
50
  airflow/providers/standard/sensors/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
31
51
  airflow/providers/standard/sensors/bash.py,sha256=sNcII9aLzJhfdimOwsTggeZYk1TM_ulWDS5iKpB_9XE,4963
32
- airflow/providers/standard/sensors/date_time.py,sha256=hRUuLaNgqDh4jqaIaD8zdyq2BUXkpWM2NzJN5YkwTJI,6077
33
- airflow/providers/standard/sensors/external_task.py,sha256=63w5wzM61MrfH6546rKnYEWcZqeL8APrULNLLue44gg,28249
52
+ airflow/providers/standard/sensors/date_time.py,sha256=3hW0GBVheICII6Y81doZ43SxI395KjPkHDM8oE1V44w,6240
53
+ airflow/providers/standard/sensors/external_task.py,sha256=SLYf-a9PoTaDT6Ciy5YJCmn3bDoIxiRy-n5bS4zmDPw,28301
34
54
  airflow/providers/standard/sensors/filesystem.py,sha256=rfupSeHtFGdAcL6cw3H6u6ttBxogSThYiPqsUKgABMU,6029
35
55
  airflow/providers/standard/sensors/python.py,sha256=2tCCQa4ynsBpIfRKZdXnq2-9qIk9odikvRj46jxvR24,3387
36
- airflow/providers/standard/sensors/time.py,sha256=q0cDO3hz7VYkNUOJS2UiTKY-IICCBAdEsw25l23DPgM,4836
37
- airflow/providers/standard/sensors/time_delta.py,sha256=1OlDMIwNYXhBeeE8TmfsAMIFIOur4BMlDWe0L_JScZc,6633
56
+ airflow/providers/standard/sensors/time.py,sha256=YlQnEmV-JazxOPZnnGD1leuZQROvRMDU3VtGQf05y8U,5070
57
+ airflow/providers/standard/sensors/time_delta.py,sha256=D9LPHM8MIJWqbOfFmUMR-I0dd1HFNWMAZ7hXtTebNrQ,7633
38
58
  airflow/providers/standard/sensors/weekday.py,sha256=XoEp5HYmxHQOFZlyBPuRJcPO2srjftguilJH33H1L4M,4449
39
59
  airflow/providers/standard/triggers/__init__.py,sha256=9hdXHABrVpkbpjZgUft39kOFL2xSGeG4GEua0Hmelus,785
40
60
  airflow/providers/standard/triggers/external_task.py,sha256=cuIUvLeOC6Epf4JDvFZSqcWU9fdh2plMbwop_pceb98,11599
@@ -46,7 +66,7 @@ airflow/providers/standard/utils/python_virtualenv_script.jinja2,sha256=3Z334hVq
46
66
  airflow/providers/standard/utils/sensor_helper.py,sha256=PNIETsl_a4BkmOypFfHdpP0VuTkC6eWKUDuwnNVaWsA,5000
47
67
  airflow/providers/standard/utils/skipmixin.py,sha256=XkhDozcXUHZ7C6AxzEW8ZYrqbra1oJGGR3ZieNQ-N0M,7791
48
68
  airflow/providers/standard/utils/weekday.py,sha256=ySDrIkWv-lqqxURo9E98IGInDqERec2O4y9o2hQTGiQ,2685
49
- apache_airflow_providers_standard-1.2.0.dist-info/entry_points.txt,sha256=mW2YRh3mVdZdaP5-iGSNgmcCh3YYdALIn28BCLBZZ40,104
50
- apache_airflow_providers_standard-1.2.0.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
51
- apache_airflow_providers_standard-1.2.0.dist-info/METADATA,sha256=_WLep_II4mFk6TA6B_B6UMrW6UNEgT8x55XXHrMeaxE,3788
52
- apache_airflow_providers_standard-1.2.0.dist-info/RECORD,,
69
+ apache_airflow_providers_standard-1.3.0rc1.dist-info/entry_points.txt,sha256=mW2YRh3mVdZdaP5-iGSNgmcCh3YYdALIn28BCLBZZ40,104
70
+ apache_airflow_providers_standard-1.3.0rc1.dist-info/WHEEL,sha256=G2gURzTEtmeR8nrdXUJfNiB3VYVxigPQ-bEQujpNiNs,82
71
+ apache_airflow_providers_standard-1.3.0rc1.dist-info/METADATA,sha256=vy9ggL36QOmGCFiWTAP14wDl6yKoWA0LN4PHZuT2XJI,3808
72
+ apache_airflow_providers_standard-1.3.0rc1.dist-info/RECORD,,