def __init__(self, name, port=6380): """ """ RedisService.__init__(self, name, port) self._name_app = name + '_cache' self.fetchthread = Thread(target=self.fetcher) self.fetchthread.start() self.lru_queue = 'cache:lru' logging.info('[Cache] Service is initialized.')
def start_local_catalog(self, isaggressive=False): settings = systemsettings() service = RedisService(settings.name, isaggressive=False) self.localcatalogserver = service.start() logging.info("Catalog service started as a background thread. Waiting on it...") timeout = settings.CATALOG_STARTUP_DELAY while timeout > 0: if service.ping(): return True logging.info("Waiting on the Server. Will timeout in %d secs.", timeout) time.sleep(1) timeout -= 1 self.localcatalogserver = None return False
valid_roles = ['MASTER', 'REPLICA', 'SLAVE'] role = args.role if role not in valid_roles: logging.error('Undefined role provided. Role must be one of: %s', str(valid_roles)) sys.exit(1) role = args.role if args.service == 'redis': if args.name is None: logging.error( 'ERROR. Service requires a application name with corresponding input (json) confile file' ) sys.exit() service = RedisService(args.name, isaggressive=True, role=args.role) elif args.service == 'cache': if args.name is None: logging.error( 'ERROR. Service requires a application name with corresponding input (json) confile file' ) sys.exit() service = CacheService(args.name) elif args.service == 'alluxio': if args.name is None: logging.error( 'ERROR. Service requires a application name with corresponding input (json) confile file' ) sys.exit() service = AlluxioService(args.name, role) else:
args = parser.parse_args() logging.info('\n\nOverlay Executor: service=`%s` cmd=`%s`', args.service, args.command) valid_roles = ['MASTER', 'REPLICA', 'SLAVE'] role = args.role if role not in valid_roles: logging.error('Undefined role provided. Role must be one of: %s', str(valid_roles)) sys.exit(1) role = args.role if args.service == 'redis': if args.name is None: logging.error('ERROR. Service requires a application name with corresponding input (json) confile file') sys.exit() service = RedisService(args.name, isaggressive=True, role=args.role) elif args.service == 'cache': if args.name is None: logging.error('ERROR. Service requires a application name with corresponding input (json) confile file') sys.exit() service = CacheService(args.name) elif args.service == 'alluxio': if args.name is None: logging.error('ERROR. Service requires a application name with corresponding input (json) confile file') sys.exit() service = AlluxioService(args.name, role) else: logging.error('Unrecognized Service. Quitting') sys.exit()