def post(self): data = request.json action = data['action'] if str(action).lower() in ["true", "enable", "on"]: enable_telemetry(ca.config_obj['storage_dir']) else: disable_telemetry(ca.config_obj['storage_dir']) inject_telemetry_to_static(ca.config_obj.paths['static']) return '', 200
if os.path.isdir(root_storage_dir) is False: os.makedirs(root_storage_dir) if 'storage_db' in user_config: os.environ['MINDSDB_DB_CON'] = user_config['storage_db'] elif os.environ.get('MINDSDB_DB_CON', '') == '': os.environ['MINDSDB_DB_CON'] = 'sqlite:///' + os.path.join( os.environ['MINDSDB_STORAGE_DIR'], 'mindsdb.sqlite3.db') + '?check_same_thread=False&timeout=30' from mindsdb.utilities.config import Config mindsdb_config = Config() create_dirs_recursive(mindsdb_config['paths']) os.environ['DEFAULT_LOG_LEVEL'] = os.environ.get('DEFAULT_LOG_LEVEL', 'ERROR') os.environ['LIGHTWOOD_LOG_LEVEL'] = os.environ.get('LIGHTWOOD_LOG_LEVEL', 'ERROR') os.environ['MINDSDB_STORAGE_PATH'] = mindsdb_config['paths']['predictors'] if telemetry_file_exists(mindsdb_config['storage_dir']): os.environ['CHECK_FOR_UPDATES'] = '0' print('\n x telemetry disabled! \n') elif os.getenv('CHECK_FOR_UPDATES', '1').lower() in [ '0', 'false', 'False' ] or mindsdb_config.get('cloud', False): disable_telemetry(mindsdb_config['storage_dir']) print('\n x telemetry disabled \n') else: print('\n ✓ telemetry enabled \n')
if __name__ == '__main__': mp.freeze_support() args = args_parse() config = Config(os.environ['MINDSDB_CONFIG_PATH']) telemetry_disabled = False storage_dir = config['storage_dir'] if is_telemetry_file_exists(storage_dir): os.environ['CHECK_FOR_UPDATES'] = '0' telemetry_disabled = True elif os.getenv('CHECK_FOR_UPDATES', '1').lower() in ['0', 'false', 'False']: disable_telemetry(storage_dir) telemetry_disabled = True if telemetry_disabled: print('\n ✓ telemetry disabled \n') if args.verbose is True: config['log']['level']['console'] = 'DEBUG' os.environ['DEFAULT_LOG_LEVEL'] = config['log']['level']['console'] os.environ['LIGHTWOOD_LOG_LEVEL'] = config['log']['level']['console'] config.set(['mindsdb_last_started_at'], str(datetime.datetime.now())) initialize_log(config) log = logging.getLogger('mindsdb.main')