ashb commented on a change in pull request #5162: [AIRFLOW-4358] Speed up
test_jobs by not running tasks
URL: https://github.com/apache/airflow/pull/5162#discussion_r279436117
##########
File path: tests/test_jobs.py
##########
@@ -253,51 +276,79 @@ def test_backfill_multi_dates(self):
dag.clear()
session.close()
- @unittest.skipIf('sqlite' in configuration.conf.get('core',
'sql_alchemy_conn'),
- "concurrent access not supported in sqlite")
- def test_backfill_examples(self):
+ @unittest.skipIf(
+ "sqlite" in configuration.conf.get("core", "sql_alchemy_conn"),
+ "concurrent access not supported in sqlite",
+ )
+ @parameterized.expand(
+ [
+ [
+ "example_branch_operator",
+ (
+ "run_this_first",
+ "branching",
+ "branch_a",
+ "branch_b",
+ "branch_c",
+ "branch_d",
+ "follow_branch_a",
+ "follow_branch_b",
+ "follow_branch_c",
+ "follow_branch_d",
+ "join",
+ ),
+ ],
+ [
+ "example_bash_operator",
+ ("runme_0", "runme_1", "runme_2", "also_run_this",
"run_after_loop", "run_this_last"),
+ ],
+ [
+ "example_skip_dag",
+ (
+ "always_true_1",
+ "always_true_2",
+ "skip_operator_1",
+ "skip_operator_2",
+ "all_success",
+ "one_success",
+ "final_1",
+ "final_2",
+ ),
+ ],
+ ["latest_only", ("latest_only", "task1")],
+ ]
+ )
+ def test_backfill_examples(self, dag_id, expected_execution_order):
"""
Test backfilling example dags
Try to backfill some of the example dags. Be careful, not all dags are
suitable
for doing this. For example, a dag that sleeps forever, or does not
have a
schedule won't work here since you simply can't backfill them.
"""
- include_dags = {
- 'example_branch_operator',
- 'example_bash_operator',
- 'example_skip_dag',
- 'latest_only'
- }
-
- dags = [
- dag for dag in self.dagbag.dags.values()
- if 'example_dags' in dag.full_filepath and dag.dag_id in
include_dags
- ]
-
- for dag in dags:
- dag.clear(
- start_date=DEFAULT_DATE,
- end_date=DEFAULT_DATE)
+ self.maxDiff = None
+ dag = self.dagbag.get_dag(dag_id)
- # Make sure that we have the dags that we want to test available
- # in the example_dags folder, if this assertion fails, one of the
- # dags in the include_dags array isn't available anymore
- self.assertEqual(len(include_dags), len(dags))
+ logger.info('*** Running example DAG: {}'.format(dag.dag_id))
Review comment:
Will do :). (I didn't notice this as I didn't really "change" this line, it
was just a indentation change.)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services