Skip to content

Commit

Permalink
Use airflow.models.dag.DAG in examples (apache#34617)
Browse files Browse the repository at this point in the history
  • Loading branch information
Taragolis authored Sep 26, 2023
1 parent 05ce0d1 commit 4df5b57
Show file tree
Hide file tree
Showing 32 changed files with 34 additions and 33 deletions.
2 changes: 1 addition & 1 deletion airflow/example_dags/example_bash_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator
from airflow.operators.empty import EmptyOperator

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_branch_datetime_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.datetime import BranchDateTimeOperator
from airflow.operators.empty import EmptyOperator

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.weekday import BranchDayOfWeekOperator
from airflow.utils.weekday import WeekDay
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_branch_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.utils.edgemodifier import Label

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_branch_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.python import BranchPythonOperator
from airflow.utils.edgemodifier import Label
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_branch_operator_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.utils.edgemodifier import Label
from airflow.utils.trigger_rule import TriggerRule
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator


Expand Down
4 changes: 2 additions & 2 deletions airflow/example_dags/example_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@

import pendulum

from airflow import models
from airflow.models.baseoperator import chain
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator

with models.DAG(
with DAG(
dag_id="example_complex",
schedule=None,
start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_dynamic_task_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

from datetime import datetime

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG

with DAG(dag_id="example_dynamic_task_mapping", start_date=datetime(2022, 3, 4)) as dag:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

from datetime import datetime

from airflow import DAG
from airflow.models.baseoperator import BaseOperator
from airflow.models.dag import DAG


class AddOneOperator(BaseOperator):
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_external_task_marker_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.sensors.external_task import ExternalTaskMarker, ExternalTaskSensor

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@

import pendulum

from airflow import DAG
from airflow.configuration import conf
from airflow.decorators import task
from airflow.example_dags.libs.helper import print_stuff
from airflow.models.dag import DAG

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_latest_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import datetime

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.latest_only import LatestOnlyOperator

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_latest_only_with_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.latest_only import LatestOnlyOperator
from airflow.utils.trigger_rule import TriggerRule
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_local_kubernetes_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
import logging
from datetime import datetime

from airflow import DAG
from airflow.configuration import conf
from airflow.decorators import task
from airflow.example_dags.libs.helper import print_stuff
from airflow.models.dag import DAG

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_nested_branch_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import pendulum

from airflow.decorators import task
from airflow.models import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.utils.trigger_rule import TriggerRule

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_params_trigger_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from pathlib import Path
from typing import TYPE_CHECKING

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.models.param import Param
from airflow.utils.trigger_rule import TriggerRule

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_params_ui_tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
from pathlib import Path
from typing import TYPE_CHECKING

from airflow import DAG
from airflow.decorators import task
from airflow.exceptions import AirflowSkipException
from airflow.models.dag import DAG
from airflow.models.param import Param

if TYPE_CHECKING:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator


Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_python_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.python import ExternalPythonOperator, PythonVirtualenvOperator, is_venv_installed

log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import pendulum

from airflow.models import DAG
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator
from airflow.sensors.bash import BashSensor
from airflow.sensors.filesystem import FileSensor
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_short_circuit_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import pendulum

from airflow import DAG
from airflow.models.baseoperator import chain
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.python import ShortCircuitOperator
from airflow.utils.trigger_rule import TriggerRule
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_skip_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

import pendulum

from airflow import DAG
from airflow.exceptions import AirflowSkipException
from airflow.models.baseoperator import BaseOperator
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.utils.trigger_rule import TriggerRule

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_subdag_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
# [START example_subdag_operator]
import datetime

from airflow import DAG
from airflow.example_dags.subdags.subdag import subdag
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.operators.subdag import SubDagOperator

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_time_delta_sensor_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator
from airflow.sensors.time_delta import TimeDeltaSensorAsync

Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_trigger_controller_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.trigger_dagrun import TriggerDagRunOperator

with DAG(
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_trigger_target_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator


Expand Down
3 changes: 2 additions & 1 deletion airflow/example_dags/example_xcom.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@

import pendulum

from airflow import DAG, XComArg
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.models.xcom_arg import XComArg
from airflow.operators.bash import BashOperator

value_1 = [1, 2, 3]
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/example_xcomargs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import pendulum

from airflow import DAG
from airflow.decorators import task
from airflow.models.dag import DAG
from airflow.operators.bash import BashOperator

log = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/subdags/subdag.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# [START subdag]
import pendulum

from airflow import DAG
from airflow.models.dag import DAG
from airflow.operators.empty import EmptyOperator


Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from datetime import datetime, timedelta

# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
from airflow.models.dag import DAG

# Operators; we need this to operate!
from airflow.operators.bash import BashOperator
Expand Down
2 changes: 1 addition & 1 deletion airflow/example_dags/tutorial_dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import pendulum

# The DAG object; we'll need this to instantiate a DAG
from airflow import DAG
from airflow.models.dag import DAG

# Operators; we need this to operate!
from airflow.operators.python import PythonOperator
Expand Down

0 comments on commit 4df5b57

Please sign in to comment.