def run(config, output): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config) # Config logger config_logging(settings.LOG_LEVEL) # set up orchestration orch = Orchestrator(settings) for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info('Launching orchestrator') orch.run() logger.info('Orchestrator finished') results = orch.results results_writer_register[settings.RESULTS_FORMAT](results, output) logger.info('Saved results to file %s' % os.path.abspath(output))
def run(config_file, output, config_override): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved config_override : dict, optional Configuration parameters overriding parameters in the file """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config_file) if config_override: for k, v in config_override.items(): try: v = eval(v) except NameError: pass settings.set(k, v) # Config logger config_logging(settings.LOG_LEVEL if "LOG_LEVEL" in settings else "INFO") # Validate settings _validate_settings(settings, freeze=True) # set up orchestration orch = Orchestrator(settings) for sig in ( signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGABRT, ): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info("Launching orchestrator") orch.run() logger.info("Orchestrator finished") results = orch.results RESULTS_WRITER[settings.RESULTS_FORMAT](results, output) logger.info("Saved results to file %s" % os.path.abspath(output))
def run(config_file, output, config_override): """ Run function. It starts the simulator. experiments Parameters ---------- config : str Path of the configuration file output : str The file name where results will be saved config_override : dict, optional Configuration parameters overriding parameters in the file """ # Read settings from file and save them in icarus.conf.settings settings = Settings() settings.read_from(config_file) if config_override: for k, v in config_override.items(): try: v = eval(v) except NameError: pass settings.set(k, v) # Config logger config_logging(settings.LOG_LEVEL if 'LOG_LEVEL' in settings else 'INFO') # Validate settings _validate_settings(settings, freeze=True) # set up orchestration orch = Orchestrator(settings) for sig in (signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGQUIT, signal.SIGABRT): signal.signal(sig, functools.partial(handler, settings, orch, output)) logger.info('Launching orchestrator') orch.run() logger.info('Orchestrator finished') results = orch.results RESULTS_WRITER[settings.RESULTS_FORMAT](results, output) logger.info('Saved results to file %s' % os.path.abspath(output))