incubator-airflow/tests/sensors
yuqian90 4f2e0cf173
Speed up `dag.clear()` when clearing lots of ExternalTaskSensor and ExternalTaskMarker (#11184)
This is an improvement to the UI response time when clearing dozens of DagRuns of large DAGs (thousands of tasks) containing many ExternalTaskSensor + ExternalTaskMarker pairs. In the current implementation, clearing tasks can get slow especially if the user chooses to clear with Future, Downstream and Recursive all selected.

This PR speeds it up. There are two major improvements:

Updating self._task_group in dag.sub_dag() is improved to not deep copy _task_group because it's a waste of time. Instead, do something like dag.task_dict, set it to None first and then copy explicitly.
Pass the TaskInstance already visited down the recursive calls of dag.clear() as visited_external_tis. This speeds up the example in test_clear_overlapping_external_task_marker by almost five folds.
For real large dags containing 500 tasks set up in a similar manner, the time it takes to clear 30 DagRun is cut from around 100s to less than 10s.
2020-10-22 15:37:36 +01:00
..
__init__.py [AIRFLOW-6714] Remove magic comments about UTF-8 (#7338) 2020-02-02 22:18:19 +01:00
test_base_sensor.py Fix BaseSensorOperator soft_fail mode to respect downstream tasks trigger_rule (#8867) 2020-08-06 13:08:01 +02:00
test_bash.py [AIRFLOW-6817] remove imports from `airflow/__init__.py`, replaced implicit imports with explicit imports, added entry to `UPDATING.MD` - squashed/rebased (#7456) 2020-02-22 08:21:19 +01:00
test_date_time_sensor.py Use unittest.mock instead of backported mock library (#11643) 2020-10-22 13:23:15 +01:00
test_external_task_sensor.py Speed up `dag.clear()` when clearing lots of ExternalTaskSensor and ExternalTaskMarker (#11184) 2020-10-22 15:37:36 +01:00
test_filesystem.py Remove unittest.main() from tests (#8454) 2020-04-19 22:05:47 +02:00
test_python.py Add run_type to DagRun (#8227) 2020-06-04 16:20:26 +02:00
test_smart_sensor_operator.py Use unittest.mock instead of backported mock library (#11643) 2020-10-22 13:23:15 +01:00
test_sql_sensor.py Check for same task instead of Equality to detect Duplicate Tasks (#8828) 2020-05-16 11:21:12 +01:00
test_time_sensor.py Use unittest.mock instead of backported mock library (#11643) 2020-10-22 13:23:15 +01:00
test_timedelta_sensor.py [AIRFLOW-6817] remove imports from `airflow/__init__.py`, replaced implicit imports with explicit imports, added entry to `UPDATING.MD` - squashed/rebased (#7456) 2020-02-22 08:21:19 +01:00
test_timeout_sensor.py Removes stable tests from quarantine (#10768) 2020-09-08 07:36:12 +02:00
test_weekday_sensor.py Remove side effects from tests (#9675) 2020-07-05 22:56:15 +01:00