예제 #1
0
파일: snaps.py 프로젝트: vaizguy/snaps
    def restore_snapshot(self, file, version=None):

        if not file:
            self.logger.info("Please enter a valid filename.")
            return None

        s = Snapshot(file)
        s.restore(version)
예제 #2
0
파일: idxd.py 프로젝트: kats/idx
def run():
    log.info('start')
    print 'Start serving idxd...'
    idx = PfrIndex(config.IDX_FILENAME)
    snapshot_manager = Snapshot()
    if not idx.validate() and \
            not snapshot_manager.restore(PfrIndex) and \
            not idx.create():
        print "Please, close all connections to DB and try again."
        return -1

    Events = namedtuple("Events", "stop endupdate")
    events = Events(Event(), Event())
    __serve_forever( \
            __start_search_daemon(config.IDX_WEBSERVER_PORT, events), \
            __start_update_daemon((config.KANSO_FILENAME, config.KANSO_FILENAME2), events), \
            events)