60f6cb43588518973a7c814280a211b56cd269d8
gperez2
  Sat Jan 25 14:23:11 2025 -0800
Removing unneeded selenium packages from the script and adding errors to skip, No RM

diff --git src/utils/qa/checkSessionsFromRR.py src/utils/qa/checkSessionsFromRR.py
index a88d765c7f5..8a10082c331 100755
--- src/utils/qa/checkSessionsFromRR.py
+++ src/utils/qa/checkSessionsFromRR.py
@@ -18,32 +18,30 @@
 #           bedGraphLoadItems: table t1_genome_65e19_d5ded0 only has 0 data columns, must be at least 4 
 #This error is due to custom tracks in track collections expiring which were stored as a hub. 
 # ^IGNORE
 
 import os # Module to interact with the operating system
 import getpass # Module to get the username of the person running the script
 import sys # Module to access system-specific parameters and functions
 import re # Module for regular expression matching operations
 import json # Module for working with JSON data
 import io # Module for handling I/O operations
 import requests # Module to make HTTP requests
 import random # Module to generate random numbers and select random items
 import subprocess # Module to run subprocesses
 from datetime import datetime # Module to handle dates and times
 from urllib.parse import unquote # Module to decode URL-encoded strings
-from selenium import webdriver # Module for web browser automation
-from selenium.webdriver.chrome.options import Options # Module to set Chrome options for Selenium
 
 # Get the username of the person running the script
 user = getpass.getuser()
 
 def bash(cmd):
     """Input bash cmd and return stdout"""
     rawOutput = subprocess.run(cmd,check=True, shell=True, stdout=subprocess.PIPE, universal_newlines=True, stderr=subprocess.STDOUT, errors='backslashreplace')
     return(rawOutput.stdout.split('\n')[0:-1])
 
 def random_session_lines(file_path, num_lines):
     """Gets a number of random lines that consist of session contents and encodes as Latin-1 of the Unicode character set"""
     with open(file_path, 'r', encoding="latin-1") as file:
         lines = file.readlines()
         selected_lines = random.sample(lines, num_lines)
         return selected_lines
@@ -118,56 +116,67 @@
     session=session.split('cgi-bin')[1]
     session=machine+session
     return session
 
 def checkSession(session):
     """Checks if session loads on machine"""
 
     #Strings to check
     check_hgTracks='// END hgTracks'
     check_error='<!-- ERROR -->'
     check_warning="id='warnBox'"
     hubid_error="Couldn't connect to database"
     hubid_error_dev="can not find any trackDb tables for hub_"
     hubCollection_error= r'doesn\\x27t\\x20exist\\x20in\\x20customTrash\\x20database\\x2C\\x20or\\x20hFindTableInfoWithConn\\x20failed'
     buffer_error= r'buffer\\x20overflow\\x2C\\x20size\\x204096\\x2C\\x20format\\x3A\\x20Click\\x20to\\x20alter\\x20the\\x20display'
+    hub_error="Error: The database"
+    genomeName_error="Error: The genome"
     # List to append session load error
     error_list=[]
     try:
         checkLoad=bash("curl -Ls '%s'" % session)
         checkLoad=str(checkLoad)[1:-1]
         
         #If session contains strings to check if session loaded, set a variable that session loaded
         if check_hgTracks in checkLoad:
             if check_error in checkLoad: #checks if there is an error when session is loaded
                if check_warning in checkLoad: #checks if the error is a warning when session is loaded
                   check3='loads'
                else: #If session contains the error string to check, add error to list 
                   error_list.append('error')
             check2='loads'
        #Pass if session load error is Couldn't connect to database hub error (hub id issue)
         elif hubid_error in checkLoad:
             pass
        #Pass if session load error is can not find any trackDb tables for hub_ ((hub id issue))
         elif hubid_error_dev in checkLoad:
             pass
         # Check for the hubCollection error by matching the exact string pattern
         elif re.search(re.escape(hubCollection_error), checkLoad):
             pass
         # Check for buffer overflow error by matching the exact string pattern
         elif re.search(re.escape(buffer_error), checkLoad):
             pass
+       #Pass if session load error is Error: The database...
+       #The hubId is not in hubStatus at all, that is, it's never been connected.
+       #The hub has an error in the hubStatus table.
+        elif hub_error in checkLoad:
+            pass
+       #Pass if session load error is Error: The genome
+       #This would most likely happen if the hub used to have that genome but doesn't anymore.
+        elif genomeName_error in checkLoad:
+            pass
         else: #If session does not contains strings to check, add error to list 
              error_list.append('error')
     except subprocess.CalledProcessError as e:
         #If session fails to curl, add error to list 
         error_list.append('error')
     #If an error is present in the error list, save the session URL to variable 
     if 'error' in error_list:
         sessionLoad=session
     else: #If no error is present in the error list, set variable that session loaded
         sessionLoad='loads'
         session_dir=session.split('genecats.gi.ucsc.edu')[1]
         session_path=myDir+session_dir
    
     return sessionLoad