def main(): # init conf and logging conf = cfg.CONF conf.register_cli_opts(config.OPTS) conf.register_cli_opts(OPTS) conf.register_opts(config.OPTS) conf.register_opts(OPTS) conf() logging.setup('spectrometer') LOG.info('Logging enabled') runtime_storage_inst = runtime_storage.get_runtime_storage( cfg.CONF.runtime_storage_uri) filename = cfg.CONF.file if cfg.CONF.reverse: if filename: fd = open(filename, 'r') else: fd = sys.stdin import_data(runtime_storage_inst, fd) else: if filename: fd = open(filename, 'w') else: fd = sys.stdout export_data(runtime_storage_inst, fd)
def main(): # init conf and logging conf = cfg.CONF conf.register_cli_opts(config.OPTS) conf.register_cli_opts(OPTS) conf.register_opts(config.OPTS) conf.register_opts(OPTS) conf() logging.setup('spectrometer') LOG.info('Logging enabled') runtime_storage_inst = runtime_storage.get_runtime_storage( cfg.CONF.runtime_storage_uri) filename = cfg.CONF.file if cfg.CONF.reverse: if filename: fd = open(filename, 'r') else: fd = sys.stdin import_data(runtime_storage_inst, fd) else: if filename: fd = open(filename, 'w') else: fd = sys.stdout export_data(runtime_storage_inst, fd)
def main(): # init conf and logging conf = cfg.CONF conf.register_cli_opts(config.OPTS) conf.register_opts(config.OPTS) conf() logging.setup('spectrometer') LOG.info('Logging enabled') runtime_storage_inst = runtime_storage.get_runtime_storage( cfg.CONF.runtime_storage_uri) default_data = utils.read_json_from_uri(cfg.CONF.default_data_uri) if not default_data: LOG.critical('Unable to load default data') return not 0 default_data_processor.process(runtime_storage_inst, default_data, cfg.CONF.sources_root, cfg.CONF.force_update) process_program_list(runtime_storage_inst, cfg.CONF.program_list_uri) update_pids(runtime_storage_inst) record_processor_inst = record_processor.RecordProcessor( runtime_storage_inst) update_records(runtime_storage_inst, record_processor_inst) apply_corrections(cfg.CONF.corrections_uri, runtime_storage_inst) # long operation should be the last update_members(runtime_storage_inst, record_processor_inst) runtime_storage_inst.set_by_key('runtime_storage_update_time', utils.date_to_timestamp('now'))
def main(): # init conf and logging conf = cfg.CONF conf.register_cli_opts(config.OPTS) conf.register_opts(config.OPTS) conf() logging.setup('spectrometer') LOG.info('Logging enabled') runtime_storage_inst = runtime_storage.get_runtime_storage( cfg.CONF.runtime_storage_uri) default_data = utils.read_json_from_uri(cfg.CONF.default_data_uri) if not default_data: LOG.critical('Unable to load default data') return not 0 default_data_processor.process(runtime_storage_inst, default_data, cfg.CONF.sources_root, cfg.CONF.force_update) process_program_list(runtime_storage_inst, cfg.CONF.program_list_uri) update_pids(runtime_storage_inst) record_processor_inst = record_processor.RecordProcessor( runtime_storage_inst) update_records(runtime_storage_inst, record_processor_inst) apply_corrections(cfg.CONF.corrections_uri, runtime_storage_inst) # long operation should be the last update_members(runtime_storage_inst, record_processor_inst) runtime_storage_inst.set_by_key('runtime_storage_update_time', utils.date_to_timestamp('now'))
app.config.from_object(__name__) app.config.from_envvar('DASHBOARD_CONF', silent=True) app.register_blueprint(reports.blueprint) app.register_blueprint(kpi.blueprint) LOG = logging.getLogger(__name__) conf = cfg.CONF conf.register_opts(config.OPTS) conf_file = os.getenv('SPECTROMETER_CONF') if conf_file and os.path.isfile(conf_file): conf(default_config_files=[conf_file]) app.config['DEBUG'] = cfg.CONF.debug logging.setup('dashboard') LOG.info('Spectrometer.dashboard is configured via "%s"', conf_file) # Handlers --------- @app.route('/') @decorators.templated() def overview(): pass @app.route('/widget') def widget(): return flask.render_template('widget.html')
app.config.from_object(__name__) app.config.from_envvar("DASHBOARD_CONF", silent=True) app.register_blueprint(reports.blueprint) app.register_blueprint(kpi.blueprint) LOG = logging.getLogger(__name__) conf = cfg.CONF conf.register_opts(config.OPTS) conf_file = os.getenv("SPECTROMETER_CONF") if conf_file and os.path.isfile(conf_file): conf(default_config_files=[conf_file]) app.config["DEBUG"] = cfg.CONF.debug logging.setup("dashboard") LOG.info('Spectrometer.dashboard is configured via "%s"', conf_file) # Handlers --------- @app.route("/") @decorators.templated() def overview(): pass @app.route("/widget") def widget(): return flask.render_template("widget.html")