You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/05/27 04:13:21 UTC

[GitHub] [airflow] mik-laj commented on a change in pull request #8922: Add query count test for LocalTaskJob

mik-laj commented on a change in pull request #8922:
URL: https://github.com/apache/airflow/pull/8922#discussion_r430330763



##########
File path: tests/jobs/test_local_task_job.py
##########
@@ -406,3 +409,23 @@ def success_callback(context):
         self.assertTrue(data['called'])
         process.join(timeout=10)
         self.assertFalse(process.is_alive())
+
+
+class TestLocalTaskJobPerformance:
+    @pytest.mark.parametrize("side_effects", [[0], 9 * [None] + [0]])  # type: ignore
+    @mock.patch("airflow.jobs.local_task_job.get_task_runner")
+    def test_number_of_queries_single_loop(self, mock_get_task_runner, side_effects):
+        unique_prefix = str(uuid.uuid4())
+        dag = DAG(dag_id=f'{unique_prefix}_test_number_of_queries', start_date=DEFAULT_DATE)
+        task = DummyOperator(task_id='test_state_succeeded1', dag=dag)
+
+        dag.clear()
+        dag.create_dagrun(run_id=unique_prefix, state=State.NONE)

Review comment:
       Can you remove dagrun in teardown to avoid side-effect?




----------------------------------------------------------------
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:
users@infra.apache.org