def main(): """ NOTE: main may be used as "console script" entry point by setuptools """ logging_support.LoggingSupport.initService() try: try: _parseArgs() except SystemExit as e: if e.code == 0: # Suppress exception logging when exiting due to --help return raise # Validate environment variables for error-reporting error_reporting.validateErrorReportingEnvVars() xigniteApiToken = os.environ.get("XIGNITE_API_TOKEN") if xigniteApiToken: xigniteApiToken = xigniteApiToken.strip() if not xigniteApiToken: raise Exception("Empty or undefined environment variable " "XIGNITE_API_TOKEN") while True: _checkCompanySymbols(xigniteApiToken) time.sleep(_SLEEP_INTERVAL_SEC) except KeyboardInterrupt: # Suppress exception that typically results from the SIGINT signal sent by # supervisord to stop the service; log with exception info to help debug # deadlocks g_log.info("Observed KeyboardInterrupt", exc_info=True) except: g_log.exception("Failed!") raise
def main(): """ NOTE: main may be used as "console script" entry point by setuptools """ logging_support.LoggingSupport.initTool() try: options = _parseArgs() g_log.debug("Running with options=%r", options) # Validate environment variables for error-reporting error_reporting.validateErrorReportingEnvVars() xigniteApiToken = os.environ.get("XIGNITE_API_TOKEN") if xigniteApiToken: xigniteApiToken = xigniteApiToken.strip() if not xigniteApiToken: raise Exception("Empty or undefined environment variable " "XIGNITE_API_TOKEN") _checkCompanySymbols(xigniteApiToken) except Exception: g_log.exception("%s failed", __name__) raise