airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-2961) Speed up test_backfill_examples test
Date Mon, 27 Aug 2018 15:33:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-2961?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16593828#comment-16593828
] 

ASF GitHub Bot commented on AIRFLOW-2961:
-----------------------------------------

kaxil closed pull request #3811: [AIRFLOW-2961] Refactor tests.BackfillJobTest.test_backfill_examples
test
URL: https://github.com/apache/incubator-airflow/pull/3811
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/tests/jobs.py b/tests/jobs.py
index fd3a96a4d8..f9c07b96c9 100644
--- a/tests/jobs.py
+++ b/tests/jobs.py
@@ -61,6 +61,7 @@
 from airflow import configuration
 configuration.load_test_config()
 
+logger = logging.getLogger(__name__)
 
 try:
     from unittest import mock
@@ -194,23 +195,21 @@ def test_backfill_multi_dates(self):
     def test_backfill_examples(self):
         """
         Test backfilling example dags
-        """
 
-        # some DAGs really are just examples... but try to make them work!
-        skip_dags = [
-            'example_http_operator',
-            'example_twitter_dag',
-            'example_trigger_target_dag',
-            'example_trigger_controller_dag',  # tested above
-            'test_utils',  # sleeps forever
-            'example_kubernetes_executor',  # requires kubernetes cluster
-            'example_kubernetes_operator'  # requires kubernetes cluster
-        ]
+        Try to backfill some of the example dags. Be carefull, 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'
+        }
 
-        logger = logging.getLogger('BackfillJobTest.test_backfill_examples')
         dags = [
             dag for dag in self.dagbag.dags.values()
-            if 'example_dags' in dag.full_filepath and dag.dag_id not in skip_dags
+            if 'example_dags' in dag.full_filepath and dag.dag_id in include_dags
         ]
 
         for dag in dags:
@@ -218,6 +217,11 @@ def test_backfill_examples(self):
                 start_date=DEFAULT_DATE,
                 end_date=DEFAULT_DATE)
 
+        # 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))
+
         for i, dag in enumerate(sorted(dags, key=lambda d: d.dag_id)):
             logger.info('*** Running example DAG #{}: {}'.format(i, dag.dag_id))
             job = BackfillJob(


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Speed up test_backfill_examples test
> ------------------------------------
>
>                 Key: AIRFLOW-2961
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2961
>             Project: Apache Airflow
>          Issue Type: Bug
>            Reporter: Fokko Driesprong
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message