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/04/16 14:47:33 UTC

[GitHub] [airflow] kaxil commented on a change in pull request #8405: Fix timing-based flakey test in TestLocalTaskJob

kaxil commented on a change in pull request #8405: Fix timing-based flakey test in TestLocalTaskJob
URL: https://github.com/apache/airflow/pull/8405#discussion_r409616777
 
 

 ##########
 File path: tests/jobs/test_local_task_job.py
 ##########
 @@ -325,28 +336,20 @@ def check_failure(context):
                           session=session)
         ti = TaskInstance(task=task, execution_date=DEFAULT_DATE)
         ti.refresh_from_db()
+
         job1 = LocalTaskJob(task_instance=ti,
                             ignore_ti_state=True,
                             executor=SequentialExecutor())
-        from airflow.task.task_runner.standard_task_runner import StandardTaskRunner
-        job1.task_runner = StandardTaskRunner(job1)
-        process = multiprocessing.Process(target=job1.run)
-        process.start()
-        ti.refresh_from_db()
-        for _ in range(0, 50):
-            if ti.state == State.RUNNING:
-                break
-            time.sleep(0.1)
-            ti.refresh_from_db()
-        self.assertEqual(State.RUNNING, ti.state)
-        ti.state = State.FAILED
-        session.merge(ti)
-        session.commit()
+        with timeout(30):
+            # This should be _much_ shorter to run.
+            # If you change this limit, make the timeout in the callbable above bigger
 
 Review comment:
   ```suggestion
               # If you change this limit, make the timeout in the callable above bigger
   ```

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


With regards,
Apache Git Services