Ejemplo n.º 1
0
    def start(self):
        try:
            self.redis.ping()
        except ConnectionError as e:
            fatal("Redis error: %s" % e.message)

        self.running = True
        log.info("Listening.")

        # Clear any existing tick events
        self.redis.ltrim(self.tick_key, 0, 0)
        try:
            while self.running:
                self.process_one_event()
        except Exception as e:
            log.critical(traceback.format_exc())
        except BaseException as e:
            pass
        finally:
            self.save_snapshot()
Ejemplo n.º 2
0
    def start(self):
        try:
            self.redis.ping()
        except ConnectionError as e:
            fatal("Redis error: %s" % e.message)

        self.running = True
        log.info('Listening.')

        # Clear any existing tick events
        self.redis.ltrim(self.tick_key, 0, 0)
        try:
            while self.running:
                self.process_one_event()
        except Exception as e:
            log.critical(traceback.format_exc())
        except BaseException as e:
            pass
        finally:
            self.save_snapshot()
Ejemplo n.º 3
0
Archivo: cli.py Proyecto: vreon/figment
def run(args):
    if args.verbose or args.debug:
        log.setLevel(logging.DEBUG)

    try:
        zone = Zone.from_config(args.zone, args.world)

        if args.ticker:
            zone.start_ticker()
        else:
            zone.load_modules()
            zone.load_snapshot()
            zone.start()
    except (EOFError, KeyboardInterrupt):
        print()
    except Exception:
        if args.debug:
            import pdb
            import sys
            import traceback
            log.critical(traceback.format_exc())
            pdb.post_mortem(sys.exc_info()[2])
        else:
            raise
Ejemplo n.º 4
0
def fatal(message):
    log.critical(message)
    sys.exit(1)
Ejemplo n.º 5
0
def fatal(message):
    log.critical(message)
    sys.exit(1)