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()
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()
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)
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')
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)
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))
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))
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()
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)
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)
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)
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)