예제 #1
0
def init():
    config = load_wr_config()

    wr = WebRecRecorder(config)

    gevent.spawn(wr.msg_listen_loop)

    wr.init_app(None)
    wr.app.wr = wr

    return wr.app
예제 #2
0
def init():
    init_logging(debug=True)

    config = load_wr_config()

    wr = WebRecRecorder(config)

    spawn_once(wr.msg_listen_loop)

    wr.init_app()
    wr.app.wr = wr

    return wr.app
예제 #3
0
def init():
    init_logging()

    config = load_wr_config()

    wr = WebRecRecorder(config)

    spawn_once(wr.msg_listen_loop)

    wr.init_app()
    wr.app.wr = wr

    return wr.app
예제 #4
0
def init():
    init_logging(debug=literal_eval(os.environ.get('WR_DEBUG', 'True')))

    config = load_wr_config()

    wr = WebRecRecorder(config)

    spawn_once(wr.msg_listen_loop)

    wr.init_app()
    wr.app.wr = wr

    return wr.app
    def auto_load_warcs(self):
        manager = init_manager_for_cli()
        create_user(manager,
                    email='test@localhost',
                    username='******',
                    passwd='LocalUser1',
                    role='public-archivist',
                    name='local')

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceLoader(manager, indexer, '@INIT')

        files = list(self.get_archive_files(self.inputs))

        uploader.multifile_upload('local', files)

        local_info=dict(user='******',
                        coll='collection',
                        rec='*',
                        type='replay-coll',
                        browser='',
                        reqid='@INIT')

        browser_redis = redis.StrictRedis.from_url(os.environ['REDIS_BROWSER_URL'])
        browser_redis.hmset('ip:127.0.0.1', local_info)
        browser_redis.hset('req:@INIT', 'ip', '127.0.0.1')

        self.save_cache();
예제 #6
0
    def auto_load_warcs(self, argres):
        manager = init_manager_for_cli()

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceUploader(manager, indexer, '@INIT')

        files = list(self.get_archive_files(argres.inputs))

        uploader.multifile_upload('local', files)
def init():
    init_logging()

    config = load_wr_config()

    wr = WebRecRecorder(config)

    if postfork:

        @postfork
        def listen_loop():
            if uwsgi.mule_id() == 0:
                gevent.spawn(wr.msg_listen_loop)
    else:
        gevent.spawn(wr.msg_listen_loop)

    wr.init_app(None)
    wr.app.wr = wr

    return wr.app
    def auto_load_warcs(self):
        manager = init_manager_for_cli()

        create_user(manager,
                    email='test@localhost',
                    username='******',
                    passwd='LocalUser1',
                    role='public-archivist',
                    name='local')

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceLoader(manager, indexer, '@INIT')

        files = list(self.get_archive_files(self.inputs))

        uploader.multifile_upload('local', files)
예제 #9
0
    def auto_load_warcs(self):
        manager, user = self._init_user_manager()

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceImporter(manager.redis,
                                   manager.config,
                                   user,
                                   indexer, '@INIT', create_coll=True,
                                   cache_dir=self.cache_dir)

        files = list(self.get_archive_files(self.inputs))

        uploader.multifile_upload(user, files)

        self._init_browser_redis(user, uploader.the_collection)

        self.save_cache(manager, user)
예제 #10
0
    def __init__(self, argres):
        super(WebrecPlayerRunner, self).__init__(app_port=argres.port,
                                                 rec_port=-1,
                                                 debug=argres.debug)

        manager = init_manager_for_cli()

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceUploader(manager, indexer)

        for filename in self.get_archive_files(argres.inputs):
            with open(filename, 'rb') as stream:
                uploader.handle_upload(stream, filename, 'local', False)

        if not argres.no_browser:
            import webbrowser
            webbrowser.open_new(os.environ['APP_HOST'] + '/local/')
예제 #11
0
    def auto_load_warcs(self):
        manager, user = self._init_user_manager()

        indexer = WebRecRecorder.make_wr_indexer(manager.config)

        uploader = InplaceImporter(manager.redis,
                                   manager.config,
                                   user,
                                   indexer,
                                   '@INIT',
                                   create_coll=True,
                                   cache_dir=self.cache_dir)

        files = list(self.get_archive_files(self.inputs))

        uploader.multifile_upload(user, files)

        self._init_browser_redis(user, uploader.the_collection)

        self.save_cache(manager, user)