try: os.makedirs('data/samples/') except FileExistsError: pass else: MODE = None if not MODE: # Try to establish a connection to the DB for 5 seconds: x = 0 connection_established = False logger.info( f"... Trying to connect to database at: {db_settings['host']}:{db_settings['port']}" ) while x < 5: connection_established = infl.init_db() if connection_established: break else: sleep(1) x += 1 if not connection_established: if db_settings['host'] == 'localhost' or '127.0' in db_settings[ 'host'] or get_ip() in db_settings['host']: if recover_influx_container(): infl.init_db() run_main() else: logger.info(
title = None # Create the data/samples directory: try: os.makedirs('data/samples/') except FileExistsError: pass else: MODE = None if not MODE: # Try to establish a connection to the DB for 5 seconds: x = 0 connection_established = False while x < 5: try: infl.init_db() connection_established = True break except: sleep(1) x += 1 if not connection_established: raise Exception( "Could not connect to InfluxDB. Check that the container is running!" ) run_main() else: # Program launched in one of the non-main modes. Increase logging level.