dstandish commented on code in PR #25521:
URL: https://github.com/apache/airflow/pull/25521#discussion_r938081887
##########
tests/serialization/test_dag_serialization.py:
##########
@@ -1329,6 +1367,110 @@ class DerivedSensor(ExternalTaskSensor):
}
]
+ @conf_vars(
+ {
+ (
+ 'scheduler',
+ 'dependency_detector',
+ ):
'tests.serialization.test_dag_serialization.CustomDependencyDetector'
+ }
+ )
+ def test_custom_dep_detector(self):
+ """
+ Prior to deprecation of custom dependency detector, the return type as
Optional[DagDependency].
+ This class verifies that custom dependency detector classes which
assume that return type will still
+ work until support for them is removed in 3.0.
+
+ TODO: remove in Airflow 3.0
+ """
+ from airflow.operators.empty import EmptyOperator
+ from airflow.sensors.external_task import ExternalTaskSensor
+
+ execution_date = datetime(2020, 1, 1)
+ with DAG(dag_id="test", start_date=execution_date) as dag:
+ task1 = ExternalTaskSensor(
+ task_id="task1",
+ external_dag_id="external_dag_id",
+ mode="reschedule",
+ )
+ task2 = EmptyOperator(task_id="task2")
+ task1 >> task2
+ CustomDepOperator(task_id='hello', bash_command='hi')
+ dag = SerializedDAG.to_dict(dag)
+ assert sorted(dag['dag']['dag_dependencies'], key=lambda x:
tuple(x.values())) == sorted(
+ [
+ {
+ 'source': 'external_dag_id',
+ 'target': 'test',
+ 'dependency_type': 'sensor',
+ 'dependency_id': 'task1',
+ },
+ {
+ 'source': 'test',
+ 'target': 'nothing',
+ 'dependency_type': 'abc',
+ 'dependency_id': 'hello',
+ },
+ ],
+ key=lambda x: tuple(x.values()),
+ )
+
+ def test_dag_deps_datasets(self):
+ """
+ Check that dag_dependencies node is populated correctly for a DAG with
datasets.
+ """
+ from airflow.operators.empty import EmptyOperator
+ from airflow.sensors.external_task import ExternalTaskSensor
+
+ d1 = Dataset('d1')
+ d2 = Dataset('d2')
+ d3 = Dataset('d2')
Review Comment:
oh, ... yeah it shouldn't haha that's my b
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]