ashb commented on code in PR #22698:
URL: https://github.com/apache/airflow/pull/22698#discussion_r844957869


##########
tests/serialization/test_dag_serialization.py:
##########
@@ -1236,6 +1237,65 @@ def test_deps_sorted(self):
             'airflow.ti_deps.deps.trigger_rule_dep.TriggerRuleDep',
         ]
 
+    def test_skip_noncore_nonpluginn_ti_deps(self):
+        # trigger rule not registered through the plugin system will not be 
serialized
+        class DummyTriggerRule(BaseTIDep):
+            pass
+
+        class DummyTask(BaseOperator):
+            deps = frozenset(list(BaseOperator.deps) + [DummyTriggerRule()])
+
+        execution_date = datetime(2020, 1, 1)
+        with DAG(dag_id="test_skip_noncore_ti_deps", 
start_date=execution_date) as dag:
+            DummyTask(task_id="task1")
+
+        serialize_op = 
SerializedBaseOperator.serialize_operator(dag.task_dict["task1"])
+        assert serialize_op["deps"] == [
+            'airflow.ti_deps.deps.not_in_retry_period_dep.NotInRetryPeriodDep',
+            
'airflow.ti_deps.deps.not_previously_skipped_dep.NotPreviouslySkippedDep',
+            'airflow.ti_deps.deps.prev_dagrun_dep.PrevDagrunDep',
+            'airflow.ti_deps.deps.trigger_rule_dep.TriggerRuleDep',
+        ]
+
+        # manually injected noncore ti dep should be ignored
+        serialize_op['deps'].append('DummyTriggerRule')
+        op = SerializedBaseOperator.deserialize_operator(serialize_op)

Review Comment:
   I think this should be an error? (But I don't know what the behaviour in the 
scheduler would be if loading a dag failed)



-- 
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]

Reply via email to