882695ead3a63c68053ad2bad8b6be4b2da68cf0 lrnassar Thu Mar 16 16:45:10 2023 -0700 Changing a verbose print to debug only to reduce the amount of emails sent from this script. Will still email when sending out to a hub provider. No RM. diff --git src/utils/hubPublicMail src/utils/hubPublicMail index 60496bc..6c09b81 100755 --- src/utils/hubPublicMail +++ src/utils/hubPublicMail @@ -53,31 +53,31 @@ if args==[]: parser.print_help() exit(1) if options.debug: logging.basicConfig(level=logging.DEBUG) logging.getLogger().setLevel(logging.DEBUG) else: logging.basicConfig(level=logging.INFO) logging.getLogger().setLevel(logging.INFO) return args, options # ----------- main -------------- def getHubUrls(centralName): " return list of huburls " - logging.info("Getting hubUrls from db %s" % centralName) + logging.debug("Getting hubUrls from db %s" % centralName) cmd = "hgsql %s -se 'select hubUrl from hubPublic'" % centralName lines = os.popen(cmd).read().splitlines() # please do not suggest using subprocess in code review. Thx. return lines def parseEmail(s): " return only email address given email value of hub.txt. handles these weird cases " # jferna10@ucsc.edu or max@soe.ucsc.edu # yzz2 at psu.edu # Ian Dunham if "<" in s: return s.split('"')[1] if " at " in s: return s.replace(" at ", "@") if " or " in s: return s.split(" or ")[1] @@ -97,31 +97,31 @@ f = requests.get(url, verify=False) except KeyboardInterrupt: # handle ctrl-c for debugging sys.exit(1) except: reqFailed = True text = f.text else: # FTP try: f = urllib.request.urlopen(url, timeout=10) text = f.read().decode("utf8") except: reqFailed = True if reqFailed: - logging.info("URL %s failed." % url) + logging.debug("URL %s failed." % url) didFail.append(url) continue lines = text.splitlines() for l in lines: l = l.strip() if l=="": continue keyVal = l.strip().split(None, maxsplit=1) if len(keyVal)!=2: # some hubs may have broken hub.txt files. Treat these as if they were broken. didFail.append(url) break key, val = keyVal