Ejemplo n.º 1
0
def main():
    """
    The entry point for the Template service.
    This will load the configuration files and start a Tornado webservice
    with one or more sub processes.

    NOTES:
    tornado.options.parse_command_line(final=True)
    Allows you to run the service with custom options.

    Examples:
        Change the logging level to debug:
            + python template --logging=DEBUG
            + python template --logging=debug

        Configure custom syslog server:
            + python template --syslog_host=54.77.151.169
    """
    koi.load_config(CONF_DIR)
    app = koi.make_application(
        __version__,
        options.service_type,
        APPLICATION_URLS)
    server = koi.make_server(app)

    # Forks multiple sub-processes, one for each core
    server.start(int(options.processes))

    tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 2
0
def main():
    """
    The entry point for the service.
    This will load the configuration files and start a Tornado webservice
    with one or more sub processes.

    NOTES:
    tornado.options.parse_command_line(final=True)
    Allows you to run the service with custom options.

    Examples:
        Change the logging level to debug:
            + python repository --logging=DEBUG
            + python repository --logging=debug

        Configure custom syslog server:
            + python repository --syslog_host=54.77.151.169
    """
    koi.load_config(CONF_DIR)
    app = koi.make_application(
        __version__,
        options.service_type,
        APPLICATION_URLS)
    server = koi.make_server(app)

    audit.configure_logging()

    # Forks multiple sub-processes, one for each core
    server.start(int(options.processes))

    tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 3
0
def cli(files):
    options.logging = None
    load_config(CONF_DIR)
    # why do we care separating the protocol base url and the port?
    db_uri = '{}:{}'.format(options.url_registry_db, options.db_port)
    for fixture in files:
        print 'loading fixture file {}'.format(fixture.name)
        for dbname, docs in json.load(fixture).iteritems():
            print '\tloading docs into database "{}"'.format(dbname)
            load_docs(dbname, docs, db_uri)
Ejemplo n.º 4
0
def cli(email, password):
    options.logging = None
    load_config(CONF_DIR)

    func = partial(perch.User.create_admin, email, password)
    try:
        IOLoop.instance().run_sync(func)
    except ValidationError as exc:
        raise click.ClickException(exc.args[0])
    except socket.error:
        raise click.ClickException('Unable to connect to CouchDB')
Ejemplo n.º 5
0
def cli(files):
    options.logging = None
    load_config(CONF_DIR)
    # why do we care separating the protocol base url and the port?
    db_uri = '{}:{}'.format(
        options.url_registry_db, options.db_port)
    for fixture in files:
        print 'loading fixture file {}'.format(fixture.name)
        for dbname, docs in json.load(fixture).iteritems():
            print '\tloading docs into database "{}"'.format(dbname)
            load_docs(dbname, docs, db_uri)
Ejemplo n.º 6
0
def cli(files, repository):
    """
    Takes a list of files or a directory, and loads any ttl or xml files to the given repository.
    If repository namespace does not already exist, create the namespace before loading the data
    :param files
    :param repository: repository id / namespace in blazegraph
    """
    koi.load_config(CONF_DIR)
    for fixture in files:
        if os.path.isdir(fixture):
            IOLoop.current().run_sync(partial(db.load_directory, fixture, repository))
        else:
            IOLoop.current().run_sync(partial(db.load_data, fixture, repository))
Ejemplo n.º 7
0
def cli(files, repository):
    """
    Takes a list of files or a directory, and loads any ttl or xml files to the given repository.
    If repository namespace does not already exist, create the namespace before loading the data
    :param files
    :param repository: repository id / namespace in blazegraph
    """
    koi.load_config(CONF_DIR)
    for fixture in files:
        if os.path.isdir(fixture):
            IOLoop.current().run_sync(
                partial(db.load_directory, fixture, repository))
        else:
            IOLoop.current().run_sync(
                partial(db.load_data, fixture, repository))
Ejemplo n.º 8
0
def main():
    """
    The entry point for the Index service.
    This will load the configuration files and start a Tornado webservice
    with one or more sub processes.

    NOTES:
    tornado.options.parse_command_line(final=True)
    Allows you to run the service with custom options.

    Examples:
        Change the logging level to debug:
            + python index --logging=DEBUG
            + python index --logging=debug

        Configure custom syslog server:
            + python index --syslog_host=54.77.151.169
    """
    koi.load_config(CONF_DIR)

    db = DbInterface(
        options.url_index_db,
        options.index_db_port,
        options.index_db_path,
        options.index_schema)

    if options.poll_repositories:
        start_background_process(db)

    app = koi.make_application(
        __version__,
        options.service_type,
        APPLICATION_URLS,
        {'database': db})

    server = koi.make_server(app, CONF_DIR)

    # Forks multiple sub-processes, one for each core
    server.start(int(options.processes))

    tornado.ioloop.IOLoop.instance().start()
Ejemplo n.º 9
0
def cli(dbname):
    options.logging = None
    load_config(CONF_DIR)
    db_uri = '{}:{}'.format(
        options.url_registry_db, options.db_port)
    create_db(dbname, db_uri)
Ejemplo n.º 10
0
    configure_syslog()
    log_config()
    io_loop = IOLoop.current()

    scheduler = Scheduler()
    with RepositoryStore(repository_dict) as repositorystore:
        manager = Manager(database, repositorystore, scheduler)

        repositorystore.start()
        manager.start()

        if notification:
            notification.connect_with(scheduler)
            notification.start()

        io_loop.start()


if __name__ == '__main__':
    # Load application config
    CONF_DIR = os.path.join(os.path.dirname(__file__), '../config')
    koi.load_config(CONF_DIR)

    db = db.DbInterface(options.url_index_db, options.index_db_port,
                        options.index_db_path, options.index_schema)

    repository_dict = dict()
    notification_q = Queue.Queue()
    notification = Notification(notification_q)
    main(db, repository_dict, notification)
Ejemplo n.º 11
0
    scheduler = Scheduler()
    with RepositoryStore(repository_dict) as repositorystore:
        manager = Manager(database, repositorystore, scheduler)

        repositorystore.start()
        manager.start()

        if notification:
            notification.connect_with(scheduler)
            notification.start()

        io_loop.start()


if __name__ == '__main__':
    # Load application config
    CONF_DIR = os.path.join(os.path.dirname(__file__), '../config')
    koi.load_config(CONF_DIR)

    db = db.DbInterface(
        options.url_index_db,
        options.index_db_port,
        options.index_db_path,
        options.index_schema)

    repository_dict = dict()
    notification_q = Queue.Queue()
    notification = Notification(notification_q)
    main(db, repository_dict, notification)
Ejemplo n.º 12
0
def cli(dbname):
    options.logging = None
    load_config(CONF_DIR)
    db_uri = '{}:{}'.format(options.url_registry_db, options.db_port)
    create_db(dbname, db_uri)