eschutho commented on code in PR #23290:
URL: https://github.com/apache/superset/pull/23290#discussion_r1130288647


##########
superset/utils/webdriver.py:
##########
@@ -176,22 +176,46 @@ def get_screenshot(
         sleep(selenium_headstart)
 
         try:
-            logger.debug("Wait for the presence of %s", element_name)
-            element = WebDriverWait(driver, 
self._screenshot_locate_wait).until(
-                EC.presence_of_element_located((By.CLASS_NAME, element_name))
-            )
+            try:
+                # page didn't load
+                logger.debug(
+                    "Wait for the presence of %s at url: %s", element_name, url
+                )
+                element = WebDriverWait(driver, 
self._screenshot_locate_wait).until(
+                    EC.presence_of_element_located((By.CLASS_NAME, 
element_name))
+                )
+            except TimeoutException as ex:
+                logger.exception("Selenium timed out requesting url %s", url)
+                raise ex
 
-            logger.debug("Wait for chart containers to draw")
-            WebDriverWait(driver, self._screenshot_locate_wait).until(
-                EC.visibility_of_all_elements_located(
-                    (By.CLASS_NAME, "slice_container")
+            try:
+                # chart containers didn't render
+                logger.debug("Wait for chart containers to draw at url: %s", 
url)
+                WebDriverWait(driver, self._screenshot_locate_wait).until(
+                    EC.visibility_of_all_elements_located(
+                        (By.CLASS_NAME, "slice_container")
+                    )
                 )
-            )
+            except TimeoutException as ex:
+                logger.exception(
+                    "Selenium timed out waiting for chart containers to draw 
at url %s",
+                    url,
+                )
+                raise ex
 
-            logger.debug("Wait for loading element of charts to be gone")
-            WebDriverWait(driver, self._screenshot_load_wait).until_not(
-                EC.presence_of_all_elements_located((By.CLASS_NAME, "loading"))
-            )
+            try:
+                # charts took too long to load
+                logger.debug(
+                    "Wait for loading element of charts to be gone at url: 
%s", url
+                )
+                WebDriverWait(driver, self._screenshot_load_wait).until_not(

Review Comment:
   this error is going to be because the client db took too long to return the 
data. Some optimization is possible on either the client db or the superset 
instance to tune timeouts. Warning vs exception here is a little questionable. 



-- 
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: notifications-unsubscr...@superset.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to