def main(): aio.init_asyncio() args = _create_parser().parse_args() conf = json.decode_file(args.conf) common.json_schema_repo.validate('hat://monitor/main.yaml#', conf) logging.config.dictConfig(conf['log']) with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_main(conf, args.ui_path))
def test_init_asyncio_without_libuv(monkeypatch): def invalid_import(*args, **kwargs): raise ModuleNotFoundError platform = sys.platform with monkeypatch.context() as ctx: ctx.setattr(sys, 'platform', 'win32') ctx.setattr(builtins, '__import__', invalid_import) if platform == 'win32': aio.init_asyncio() else: with pytest.raises(AttributeError): aio.init_asyncio()
def main(): """Main""" aio.init_asyncio() args = create_parser().parse_args() conf = json.decode_file(args.conf) json_schema_repo = json.SchemaRepository( hat.gui.common.json_schema_repo, *args.additional_json_schemas_paths) json_schema_repo.validate('hat://gui/main.yaml#', conf) for adapter_conf in conf['adapters']: module = importlib.import_module(adapter_conf['module']) json_schema_id = module.json_schema_id if json_schema_id: json_schema_repo.validate(json_schema_id, adapter_conf) logging.config.dictConfig(conf['log']) with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_main(conf, args.ui_path, json_schema_repo))
def main(): """Main""" aio.init_asyncio() args = _create_parser().parse_args() conf = json.decode_file(args.conf) json_schema_repo = json.SchemaRepository( hat.event.common.json_schema_repo, *args.additional_json_schemas_paths) json_schema_repo.validate('hat://event/main.yaml#', conf) sub_confs = ([conf['backend_engine']['backend']] + conf['module_engine']['modules']) for sub_conf in sub_confs: module = importlib.import_module(sub_conf['module']) json_schema_id = module.json_schema_id if json_schema_id: json_schema_repo.validate(json_schema_id, sub_conf) logging.config.dictConfig(conf['log']) with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_main(conf))
def main(): aio.init_asyncio() args = _create_parser().parse_args() with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio(async_main(args))
def server(json_schema_repo, addr, ui_pem_path, ui_path): """Server main entry point""" aio.init_asyncio() with contextlib.suppress(asyncio.CancelledError): aio.run_asyncio( opcut.server.run(json_schema_repo, addr, ui_pem_path, ui_path))
def pytest_configure(config): aio.init_asyncio() duktape.default_duktape_path = (Path(__file__).parent.parent / duktape_lib_path)