raulcd commented on code in PR #50598:
URL: https://github.com/apache/arrow/pull/50598#discussion_r3635991640


##########
python/scripts/run_emscripten_tests.py:
##########
@@ -31,9 +31,16 @@
 from io import BytesIO
 
 from selenium import webdriver
+from selenium.common.exceptions import TimeoutException
 
 
 class TemplateOverrider(http.server.SimpleHTTPRequestHandler):
+    def handle(self):
+        try:
+            super().handle()
+        except (BrokenPipeError, ConnectionResetError):

Review Comment:
   can we add a comment around why we are ignoring these two exceptions?



##########
python/scripts/run_emscripten_tests.py:
##########
@@ -200,19 +207,34 @@ def wait_for_done(self):
 
 class BrowserDriver:
     def __init__(self, hostname, port, driver):
+        self.url = f"http://{hostname}:{port}/test.html";
         self.driver = driver
-        self.driver.get(f"http://{hostname}:{port}/test.html";)
+        self.driver.get(self.url)
         # Chrome on CI takes longer than locally to compile.
         self.driver.set_script_timeout(1200)
 
     def load_pyodide(self, dist_dir):
         pass
 
     def load_arrow(self):
-        self.execute_python(
-            f"import pyodide_js as pjs\n"
-            f"await pjs.loadPackage('{PYARROW_WHEEL_PATH.name}')\n"
-        )
+        code = (f"import pyodide_js as pjs\n"
+                f"await pjs.loadPackage('{PYARROW_WHEEL_PATH.name}')\n")
+        self.driver.set_script_timeout(300)
+        try:
+            for attempt in range(3):
+                try:
+                    return self.execute_python(code)
+                except TimeoutException:
+                    if attempt == 2:
+                        raise
+                    print("Timed out loading PyArrow in browser. Restarting 
browser",
+                          flush=True)
+                    self.restart_browser()
+        finally:
+            self.driver.set_script_timeout(1200)

Review Comment:
   Why do we set the script timeout to 1200 unconditionally? If an exception is 
after `attempt==2` this isn't relevant right?



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

Reply via email to