mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 18:58:04 +00:00
[airflow]: extend removed args (AIR302) (#14765)
## Summary Airflow 3.0 removes various deprecated functions, members, modules, and other values. They have been deprecated in 2.x, but the removal causes incompatibilities that we want to detect. This PR deprecates the following names. * in `DAG` * `sla_miss_callback` was removed * in `airflow.operators.trigger_dagrun.TriggerDagRunOperator` * `execution_date` was removed * in `airflow.operators.weekday.DayOfWeekSensor`, `airflow.operators.datetime.BranchDateTimeOperator` and `airflow.operators.weekday.BranchDayOfWeekOperator` * `use_task_execution_day` was removed in favor of `use_task_logical_date` The full list of rules we will extend https://github.com/apache/airflow/issues/44556 ## Test Plan <!-- How was it tested? --> A test fixture is included in the PR.
This commit is contained in:
parent
4fdd4ddfaa
commit
3ea14d7a74
3 changed files with 165 additions and 26 deletions
|
@ -1,6 +1,15 @@
|
|||
from airflow import DAG, dag
|
||||
from airflow.timetables.simple import NullTimetable
|
||||
|
||||
from airflow.operators.trigger_dagrun import TriggerDagRunOperator
|
||||
from airflow.providers.standard.operators import trigger_dagrun
|
||||
|
||||
from airflow.operators.datetime import BranchDateTimeOperator
|
||||
from airflow.providers.standard.operators import datetime
|
||||
|
||||
from airflow.sensors.weekday import DayOfWeekSensor, BranchDayOfWeekOperator
|
||||
from airflow.providers.standard.sensors import weekday
|
||||
|
||||
DAG(dag_id="class_schedule", schedule="@hourly")
|
||||
|
||||
DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
|
||||
|
@ -8,6 +17,13 @@ DAG(dag_id="class_schedule_interval", schedule_interval="@hourly")
|
|||
DAG(dag_id="class_timetable", timetable=NullTimetable())
|
||||
|
||||
|
||||
def sla_callback(*arg, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
DAG(dag_id="class_sla_callback", sla_miss_callback=sla_callback)
|
||||
|
||||
|
||||
@dag(schedule="0 * * * *")
|
||||
def decorator_schedule():
|
||||
pass
|
||||
|
@ -21,3 +37,42 @@ def decorator_schedule_interval():
|
|||
@dag(timetable=NullTimetable())
|
||||
def decorator_timetable():
|
||||
pass
|
||||
|
||||
|
||||
@dag(sla_miss_callback=sla_callback)
|
||||
def decorator_sla_callback():
|
||||
pass
|
||||
|
||||
|
||||
@dag()
|
||||
def decorator_deprecated_operator_args():
|
||||
trigger_dagrun_op = trigger_dagrun.TriggerDagRunOperator(
|
||||
task_id="trigger_dagrun_op1", execution_date="2024-12-04"
|
||||
)
|
||||
trigger_dagrun_op2 = TriggerDagRunOperator(
|
||||
task_id="trigger_dagrun_op2", execution_date="2024-12-04"
|
||||
)
|
||||
|
||||
branch_dt_op = datetime.BranchDateTimeOperator(
|
||||
task_id="branch_dt_op", use_task_execution_day=True
|
||||
)
|
||||
branch_dt_op2 = BranchDateTimeOperator(
|
||||
task_id="branch_dt_op2", use_task_execution_day=True
|
||||
)
|
||||
|
||||
dof_task_sensor = weekday.DayOfWeekSensor(
|
||||
task_id="dof_task_sensor", use_task_execution_day=True
|
||||
)
|
||||
dof_task_sensor2 = DayOfWeekSensor(
|
||||
task_id="dof_task_sensor2", use_task_execution_day=True
|
||||
)
|
||||
|
||||
bdow_op = weekday.BranchDayOfWeekOperator(
|
||||
task_id="bdow_op", use_task_execution_day=True
|
||||
)
|
||||
bdow_op2 = BranchDayOfWeekOperator(task_id="bdow_op2", use_task_execution_day=True)
|
||||
|
||||
trigger_dagrun_op >> trigger_dagrun_op2
|
||||
branch_dt_op >> branch_dt_op2
|
||||
dof_task_sensor >> dof_task_sensor2
|
||||
bdow_op >> bdow_op2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue