NikhilUjjwal7 commented on code in PR #7595:
URL: https://github.com/apache/kyuubi/pull/7595#discussion_r3679726808


##########
python/pyhive/tests/test_hive.py:
##########
@@ -30,13 +30,37 @@
 from pyhive.tests.dbapi_test_case import with_cursor
 
 _HOST = 'localhost'
+_CONNECT_ATTEMPTS = 5
+_CONNECT_RETRY_DELAY_SECONDS = 2
 
 
 class TestHive(unittest.TestCase, DBAPITestCase):
     __test__ = True
 
     def connect(self):
-        return hive.connect(host=_HOST, port=10000, 
configuration={'mapred.job.tracker': 'local'})
+        for attempt in range(_CONNECT_ATTEMPTS):
+            try:
+                return hive.connect(
+                    host=_HOST, port=10000, 
configuration={'mapred.job.tracker': 'local'})
+            except TTransportException:

Review Comment:
   Thanks for the review. I narrowed the retry condition to only transient 
transport failures (`END_OF_FILE`, `TIMED_OUT`, or `TSocket read 0 bytes`) and 
added a negative test to verify non-transient failures like login validation 
errors are not retried.
   
   Tested with:
   
   ```bash
   python -m pytest \
     
python/pyhive/tests/test_hive.py::TestHive::test_connect_retries_transient_transport_failure
 \
     
python/pyhive/tests/test_hive.py::TestHive::test_connect_does_not_retry_non_transient_transport_failure
 \
     -q



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to