Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
Preserve parse-server probe auth errors
jinzhenjdbb477db881f
diff --git a/mineru/doclib/background/parse_server_health.py b/mineru/doclib/background/parse_server_health.pyindex eb48955d..ac0d8f6d 100644--- a/mineru/doclib/background/parse_server_health.py+++ b/mineru/doclib/background/parse_server_health.py@@ -31,26 +31,34 @@ DEFAULT_MANAGED_URL = "http://127.0.0.1:16580"MANAGED_PARSE_SERVER_ENV = "MINERU_MANAGED_PARSE_SERVER"+@dataclass+class ProbeResult:+ healthy: bool = False+ tiers: list[Tier] = field(default_factory=list)+ error_code: str | None = None+ error_msg: str | None = None+++@dataclass+class ProbeState:+ url: str | None = None+ probe: ProbeResult = field(default_factory=ProbeResult)+ last_probe_at: int | None = None+ last_success_at: int | None = None+ last_failure_at: int | None = None++@dataclassclass ParseServerHealth:- local_healthy: bool = False+ local: ProbeState = field(default_factory=ProbeState)+ remote: ProbeState = field(default_factory=ProbeState)local_starting: bool = Falselocal_started_at: float = 0.0- local_supported_tiers: list[Tier] = field(default_factory=list)local_mode: str = "disabled"self_hosted_url: str | None = Nonemanaged_url: str = DEFAULT_MANAGED_URLmanaged_tier: Tier | None = Nonerunning_managed_tier: Tier | None = None- local_last_probe_at: int | None = None- local_last_success_at: int | None = None- local_last_failure_at: int | None = None- remote_healthy: bool = False- remote_url: str | None = None- remote_last_probe_at: int | None = None- remote_last_success_at: int | None = None- remote_last_failure_at: int | None = None- remote_supported_tiers: list[Tier] = field(default_factory=list)restart_count: int = 0managed_proc: subprocess.Popen | None = None@@ -271,39 +279,46 @@ class ParseServerHealthCheck:if health.local_mode != "disabled":url = self._local_url(health)if url:- healthy, tiers = await self._probe(url)+ api_key = None+ if health.local_mode == "self_hosted":+ api_key = (await self.config_svc.get("parse_server.local.self_hosted_api_key")) or None+ probe = await self._probe(url, api_key=api_key)now_ms = int(time.time() * 1000)- health.local_last_probe_at = now_ms- health.local_healthy = healthy- health.local_supported_tiers = tiers- if healthy:- health.local_last_success_at = now_ms+ health.local.url = url+ health.local.probe = probe+ health.local.last_probe_at = now_ms+ if probe.healthy:+ health.local.last_success_at = now_mshealth.local_starting = Falseelse:- health.local_last_failure_at = now_ms+ health.local.last_failure_at = now_ms+ else:+ health.local = ProbeState()+ else:+ health.local = ProbeState()# probe remoteremote_url = cast(str, await self.config_svc.get("parse_server.remote.url"))- health.remote_url = remote_url- healthy, tiers = await self._probe(remote_url)+ remote_api_key = (await self.config_svc.get("parse_server.remote.api_key")) or None+ probe = await self._probe(remote_url, api_key=remote_api_key)now_ms = int(time.time() * 1000)- health.remote_last_probe_at = now_ms- health.remote_healthy = healthy- health.remote_supported_tiers = tiers- if healthy:- health.remote_last_success_at = now_ms+ health.remote.url = remote_url+ health.remote.probe = probe+ health.remote.last_probe_at = now_ms+ if probe.healthy:+ health.remote.last_success_at = now_mselse:- health.remote_last_failure_at = now_ms+ health.remote.last_failure_at = now_ms# managed mode: restart if crashed (skip if still starting — give it 30s)- if health.local_mode == "managed" and not health.local_healthy:+ if health.local_mode == "managed" and not health.local.probe.healthy:if health.local_starting:elapsed = asyncio.get_event_loop().time() - health.local_started_atif elapsed < self.startup_grace_sec:continue # still loading models, don't restartlogger.warning("Managed parse-server is unhealthy, attempting restart")await self._try_restart_managed(health)- elif health.local_mode == "managed" and health.local_healthy:+ elif health.local_mode == "managed" and health.local.probe.healthy:await self._try_restart_managed_for_tier_change(health, desired_managed_tier)await asyncio.sleep(self.interval_sec)@@ -365,13 +380,14 @@ class ParseServerHealthCheck:except Exception as exc:logger.error(f"Failed to restart managed parse-server: {exc}")- async def _probe(self, base_url: str) -> tuple[bool, list[Tier]]:+ async def _probe(self, base_url: str, *, api_key: str | None = None) -> ProbeResult:+ headers = {"Authorization": f"Bearer {api_key}"} if api_key else Nonetry:async with httpx.AsyncClient(timeout=self.probe_timeout_sec,trust_env=should_trust_env_for_url(base_url),) as client:- resp = await client.get(f"{base_url}/v1/tiers")+ resp = await client.get(f"{base_url}/v1/tiers", headers=headers)if resp.status_code == 200:data = resp.json()tiers: list[Tier] = []@@ -379,10 +395,18 @@ class ParseServerHealthCheck:tier_id = t.get("id")if tier_id in TIERS:tiers.append(cast(Tier, tier_id))- return True, tiers- except Exception:- pass- return False, []+ return ProbeResult(healthy=True, tiers=tiers)+ error_code, error_msg = _probe_error(resp)+ return ProbeResult(error_code=error_code, error_msg=error_msg)+ except httpx.TimeoutException as exc:+ return ProbeResult(error_code="parse_server_unavailable", error_msg=str(exc) or "Parse-server probe timed out.")+ except httpx.TransportError as exc:+ return ProbeResult(+ error_code="parse_server_unavailable",+ error_msg=str(exc) or "Parse-server probe transport failed.",+ )+ except Exception as exc:+ return ProbeResult(error_code="parse_server_unavailable", error_msg=str(exc) or "Parse-server probe failed.")@staticmethoddef _local_url(health: ParseServerHealth) -> str | None:@@ -397,3 +421,36 @@ class ParseServerHealthCheck:health = get_health()stop_managed_parse_server(health.managed_proc, timeout_sec=self.stop_timeout_sec, reason="health check stop")health.managed_proc = None+++def _probe_error(resp: httpx.Response) -> tuple[str, str]:+ data: dict[str, object] = {}+ try:+ loaded = resp.json()+ if isinstance(loaded, dict):+ data = loaded+ except Exception:+ data = {}++ error = data.get("error")+ if isinstance(error, dict):+ code = str(error.get("code") or "http_error")+ message = str(error.get("message") or error)+ return code, message++ remote_message = _remote_auth_message(data)+ if resp.status_code == 401 or remote_message is not None:+ return "invalid_api_key", remote_message or "API key invalid or remote authentication failed."++ text = resp.text[:500]+ return "http_error", f"HTTP {resp.status_code}: {text}"+++def _remote_auth_message(data: dict[str, object]) -> str | None:+ msg_code = data.get("msgCode")+ msg = data.get("msg")+ if msg_code == "A0202":+ return str(msg or "user authenticate failed")+ if isinstance(msg, str) and "authenticate failed" in msg.lower():+ return msg+ return Nonediff --git a/mineru/doclib/server.py b/mineru/doclib/server.pyindex cd5581cc..32a1f303 100644--- a/mineru/doclib/server.py+++ b/mineru/doclib/server.py@@ -1495,7 +1495,7 @@ def _parse_server_status(return ParseServerStatus(local=LocalParseServerStatus(mode=local_mode,- healthy=health.local_healthy,+ healthy=health.local.probe.healthy,starting=health.local_starting,started_at=health.local_started_at or None,url=local_url,@@ -1506,19 +1506,23 @@ def _parse_server_status(self_hosted_url=self_hosted_url,restart_count=getattr(health, "restart_count", 0),max_restart_attempts=3,- last_probe_at=health.local_last_probe_at,- last_success_at=health.local_last_success_at,- last_failure_at=health.local_last_failure_at,- supported_tiers=health.local_supported_tiers,+ last_probe_at=health.local.last_probe_at,+ last_success_at=health.local.last_success_at,+ last_failure_at=health.local.last_failure_at,+ supported_tiers=health.local.probe.tiers,+ error_code=health.local.probe.error_code,+ error_msg=health.local.probe.error_msg,),remote=RemoteParseServerStatus(- healthy=health.remote_healthy,+ healthy=health.remote.probe.healthy,url=remote_url,port=_port_from_url(remote_url),- last_probe_at=health.remote_last_probe_at,- last_success_at=health.remote_last_success_at,- last_failure_at=health.remote_last_failure_at,- supported_tiers=health.remote_supported_tiers,+ last_probe_at=health.remote.last_probe_at,+ last_success_at=health.remote.last_success_at,+ last_failure_at=health.remote.last_failure_at,+ supported_tiers=health.remote.probe.tiers,+ error_code=health.remote.probe.error_code,+ error_msg=health.remote.probe.error_msg,),)diff --git a/mineru/doclib/services/parse_svc.py b/mineru/doclib/services/parse_svc.pyindex 630b6805..f94b1334 100644--- a/mineru/doclib/services/parse_svc.py+++ b/mineru/doclib/services/parse_svc.py@@ -58,8 +58,8 @@ def _now_ms() -> int:class ParseFailure(MineruError):"""Raised when a parse cannot be completed. Carries an error code for the parses row."""- def __init__(self, code: str, message: str) -> None:- super().__init__(code, message)+ def __init__(self, code: str, message: str, param: str | None = None) -> None:+ super().__init__(code, message, param)self.message = message@@ -1108,9 +1108,9 @@ class ParseService:health = get_health()if via == "remote":- supported = health.remote_supported_tiers+ supported = health.remote.probe.tierselse:- supported = health.local_supported_tiers+ supported = health.local.probe.tiersif not supported:raise ParseFailure("engine_unavailable", "Parse-server health status unknown, cannot validate tier")@@ -1131,10 +1131,16 @@ class ParseService:if privacy == "remote":url = cast(str, await self.config_svc.get("parse_server.remote.url"))api_key = (await self.config_svc.get("parse_server.remote.api_key")) or None- if not health.remote_healthy:+ if not health.remote.probe.healthy:+ if health.remote.probe.error_code == "invalid_api_key":+ raise ParseFailure(+ "invalid_api_key",+ _probe_error_message("Remote parse-server authentication failed", health.remote.probe.error_msg),+ "parse_server.remote.api_key",+ )# try fallback to locallocal_mode = (await self.config_svc.get("parse_server.local.mode")) or "disabled"- if local_mode != "disabled" and health.local_healthy:+ if local_mode != "disabled" and health.local.probe.healthy:local_url = _local_parse_server_url(local_mode, health)if local_url:return local_url, api_key, "local"@@ -1150,7 +1156,13 @@ class ParseService:if local_url is None:raise ParseFailure("engine_unavailable", "Local parse-server URL not configured.")- if not health.local_healthy:+ if not health.local.probe.healthy:+ if local_mode == "self_hosted" and health.local.probe.error_code == "invalid_api_key":+ raise ParseFailure(+ "invalid_api_key",+ _probe_error_message("Local self-hosted parse-server authentication failed", health.local.probe.error_msg),+ "parse_server.local.self_hosted_api_key",+ )raise ParseFailure("engine_unavailable", "Local parse-server is not ready. Please wait or check server status.")api_key = (await self.config_svc.get("parse_server.local.self_hosted_api_key")) or None@@ -1389,12 +1401,25 @@ def _resolve_default_tier(remote: bool = False) -> Tier:from ..background.parse_server_health import get_healthhealth = get_health()- supported = health.remote_supported_tiers if remote else health.local_supported_tiers+ probe = health.remote.probe if remote else health.local.probe+ supported = probe.tiersselected = select_default_quality_tier(supported)if selected is not None:return selected+ if remote and probe.error_code == "invalid_api_key":+ raise ParseFailure(+ "invalid_api_key",+ _probe_error_message("Remote parse-server authentication failed", probe.error_msg),+ "parse_server.remote.api_key",+ )+ if not remote and health.local_mode == "self_hosted" and probe.error_code == "invalid_api_key":+ raise ParseFailure(+ "invalid_api_key",+ _probe_error_message("Local self-hosted parse-server authentication failed", probe.error_msg),+ "parse_server.local.self_hosted_api_key",+ )actions = ["start a local parse-server"]- if not remote and health.remote_healthy and select_default_quality_tier(health.remote_supported_tiers) is not None:+ if not remote and health.remote.probe.healthy and select_default_quality_tier(health.remote.probe.tiers) is not None:actions.append("use --remote")actions.append("explicitly pass --tier flash for text-only preview")raise ParseFailure(@@ -1408,7 +1433,7 @@ def _resolve_parsing_rule_default_tier(remote: bool = False) -> Tier:from ..background.parse_server_health import get_healthhealth = get_health()- supported = health.remote_supported_tiers if remote else health.local_supported_tiers+ supported = health.remote.probe.tiers if remote else health.local.probe.tiersreturn select_parsing_rule_tier(supported)@@ -1420,6 +1445,12 @@ def _format_action_list(actions: list[str]) -> str:return f"{', '.join(actions[:-1])}, or {actions[-1]}"+def _probe_error_message(prefix: str, error_msg: str | None) -> str:+ if error_msg:+ return f"{prefix}: {error_msg}"+ return prefix++def _json_file_exists_by_batch(data_dir: str, sha256: str, tier: Tier, batch: ParseRow) -> bool:"""Check that the JSON result file for a parses batch row actually exists on disk."""json_path = parse_batch_json_path(data_dir, sha256, tier, batch["page_range"], batch["done_at"])diff --git a/mineru/doclib/types.py b/mineru/doclib/types.pyindex f9071442..7120d0bc 100644--- a/mineru/doclib/types.py+++ b/mineru/doclib/types.py@@ -488,6 +488,8 @@ class LocalParseServerStatus(DoclibModel):last_success_at: int | None = Nonelast_failure_at: int | None = Nonesupported_tiers: list[Tier] = Field(default_factory=list)+ error_code: str | None = None+ error_msg: str | None = Noneclass RemoteParseServerStatus(DoclibModel):@@ -498,6 +500,8 @@ class RemoteParseServerStatus(DoclibModel):last_success_at: int | None = Nonelast_failure_at: int | None = Nonesupported_tiers: list[Tier] = Field(default_factory=list)+ error_code: str | None = None+ error_msg: str | None = Noneclass ParseServerStatus(DoclibModel):diff --git a/tests/unittest/test_doclib_cache_semantics.py b/tests/unittest/test_doclib_cache_semantics.pyindex 07237cc6..b1162135 100644--- a/tests/unittest/test_doclib_cache_semantics.py+++ b/tests/unittest/test_doclib_cache_semantics.py@@ -21,6 +21,8 @@ from mineru.doclib.background.ingest import IngestWorkerPoolfrom mineru.doclib.background.parse_server_health import (ParseServerHealth,ParseServerHealthCheck,+ ProbeResult,+ ProbeState,api_server_args_for_tier,select_available_managed_port,start_managed_parse_server,@@ -345,10 +347,8 @@ def test_managed_parse_server_port_selection_tries_configured_range(monkeypatch:def test_default_tier_error_mentions_remote_when_remote_is_healthy(monkeypatch: pytest.MonkeyPatch) -> None:health = ParseServerHealth(- local_healthy=False,- local_supported_tiers=["flash"],- remote_healthy=True,- remote_supported_tiers=["high", "xhigh"],+ local=ProbeState(probe=ProbeResult(tiers=["flash"])),+ remote=ProbeState(probe=ProbeResult(healthy=True, tiers=["high", "xhigh"])),)monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health", lambda: health)@@ -363,10 +363,8 @@ def test_default_tier_error_mentions_remote_when_remote_is_healthy(monkeypatch:def test_default_tier_error_omits_remote_when_remote_is_unhealthy(monkeypatch: pytest.MonkeyPatch) -> None:health = ParseServerHealth(- local_healthy=False,- local_supported_tiers=["flash"],- remote_healthy=False,- remote_supported_tiers=[],+ local=ProbeState(probe=ProbeResult(tiers=["flash"])),+ remote=ProbeState(probe=ProbeResult()),)monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health", lambda: health)@@ -379,16 +377,45 @@ def test_default_tier_error_omits_remote_when_remote_is_unhealthy(monkeypatch: passert "--tier flash" in exc_info.value.message+def test_remote_default_tier_preserves_probe_invalid_api_key(monkeypatch: pytest.MonkeyPatch) -> None:+ health = ParseServerHealth(+ remote=ProbeState(probe=ProbeResult(error_code="invalid_api_key", error_msg="Invalid or missing API key")),+ )+ monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health", lambda: health)++ with pytest.raises(ParseFailure) as exc_info:+ _resolve_default_tier(remote=True)++ assert exc_info.value.code == "invalid_api_key"+ assert exc_info.value.message == "Remote parse-server authentication failed: Invalid or missing API key"+ assert exc_info.value.param == "parse_server.remote.api_key"+++def test_self_hosted_default_tier_preserves_probe_invalid_api_key(monkeypatch: pytest.MonkeyPatch) -> None:+ health = ParseServerHealth(+ local=ProbeState(probe=ProbeResult(error_code="invalid_api_key", error_msg="Invalid or missing API key")),+ local_mode="self_hosted",+ )+ monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health", lambda: health)++ with pytest.raises(ParseFailure) as exc_info:+ _resolve_default_tier(remote=False)++ assert exc_info.value.code == "invalid_api_key"+ assert exc_info.value.message == "Local self-hosted parse-server authentication failed: Invalid or missing API key"+ assert exc_info.value.param == "parse_server.local.self_hosted_api_key"++def test_parsing_rule_default_tier_allows_flash_fallback(monkeypatch: pytest.MonkeyPatch) -> None:- health = ParseServerHealth(local_supported_tiers=["medium", "xhigh"])+ health = ParseServerHealth(local=ProbeState(probe=ProbeResult(tiers=["medium", "xhigh"])))monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health", lambda: health)assert _resolve_parsing_rule_default_tier() == "xhigh"- health.local_supported_tiers = ["medium", "high", "xhigh"]+ health.local.probe = ProbeResult(tiers=["medium", "high", "xhigh"])assert _resolve_parsing_rule_default_tier() == "high"- health.local_supported_tiers = ["flash"]+ health.local.probe = ProbeResult(tiers=["flash"])assert _resolve_parsing_rule_default_tier() == "flash"@@ -429,17 +456,50 @@ def test_parse_server_health_probe_disables_env_proxy_for_local_urls(monkeypatchasync def __aexit__(self, *args: object) -> None:return None- async def get(self, url: str) -> _Response:+ async def get(self, url: str, headers: dict[str, str] | None = None) -> _Response:return _Response()monkeypatch.setattr("mineru.doclib.background.parse_server_health.httpx.AsyncClient", _AsyncClient)checker = ParseServerHealthCheck(None, interval_sec=1, probe_timeout_sec=2, startup_grace_sec=3, stop_timeout_sec=4)- assert asyncio.run(checker._probe("http://127.0.0.1:16580")) == (True, ["high"])- assert asyncio.run(checker._probe("https://staging.mineru.org.cn/api")) == (True, ["high"])+ assert asyncio.run(checker._probe("http://127.0.0.1:16580")) == ProbeResult(healthy=True, tiers=["high"])+ assert asyncio.run(checker._probe("https://staging.mineru.org.cn/api")) == ProbeResult(healthy=True, tiers=["high"])assert calls == [False, True]+def test_parse_server_health_probe_maps_auth_error_and_passes_api_key(monkeypatch: pytest.MonkeyPatch) -> None:+ seen_headers: list[dict[str, str] | None] = []++ class _Response:+ status_code = 401+ text = '{"error":{"code":"invalid_api_key","message":"Invalid or missing API key"}}'++ def json(self) -> dict[str, dict[str, str]]:+ return {"error": {"code": "invalid_api_key", "message": "Invalid or missing API key"}}++ class _AsyncClient:+ def __init__(self, *, timeout: int, trust_env: bool) -> None:+ return None++ async def __aenter__(self) -> "_AsyncClient":+ return self++ async def __aexit__(self, *args: object) -> None:+ return None++ async def get(self, url: str, headers: dict[str, str] | None = None) -> _Response:+ seen_headers.append(headers)+ return _Response()++ monkeypatch.setattr("mineru.doclib.background.parse_server_health.httpx.AsyncClient", _AsyncClient)+ checker = ParseServerHealthCheck(None, interval_sec=1, probe_timeout_sec=2, startup_grace_sec=3, stop_timeout_sec=4)++ result = asyncio.run(checker._probe("https://staging.mineru.org.cn/api", api_key="bad-key"))++ assert result == ProbeResult(error_code="invalid_api_key", error_msg="Invalid or missing API key")+ assert seen_headers == [{"Authorization": "Bearer bad-key"}]++def test_start_managed_parse_server_selects_port_and_writes_logs(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:parse_stdout_log_path = tmp_path / "doclib.parse-server.stdout.log"parse_stderr_log_path = tmp_path / "doclib.parse-server.stderr.log"@@ -892,7 +952,86 @@ def test_remote_api_target_prefers_config_api_key_over_env(monkeypatch: pytest.Mmonkeypatch.setenv("MINERU_API_KEY", "env-key")monkeypatch.setattr("mineru.doclib.background.parse_server_health.get_health",- lambda: SimpleNamespace(remote_healthy=True),+ lambda: ParseServerHealth(remote=ProbeState(probe=ProbeResult(healthy=True))),+ )++ asyncio.run(_run())+++def test_remote_api_target_preserves_probe_invalid_api_key(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:+ class _ConfigService:+ async def get(self, key: str) -> str:+ values = {+ "parse_server.remote.url": "https://mineru.net/api",+ "parse_server.remote.api_key": "bad-key",+ }+ return values[key]++ async def _run() -> None:+ db = DatabaseManager(str(tmp_path / "doclib.db"))+ await db.initialize()+ service = ParseService(+ db=db,+ fts=FTSManager(db),+ config_svc=_ConfigService(),+ data_dir=str(tmp_path / "data"),+ parse_lock_timeout_sec=1800,+ )++ with pytest.raises(ParseFailure) as exc_info:+ await service._resolve_api_target("remote", "high")++ assert exc_info.value.code == "invalid_api_key"+ assert exc_info.value.message == "Remote parse-server authentication failed: Invalid or missing API key"+ assert exc_info.value.param == "parse_server.remote.api_key"++ monkeypatch.setattr(+ "mineru.doclib.background.parse_server_health.get_health",+ lambda: ParseServerHealth(+ remote=ProbeState(probe=ProbeResult(error_code="invalid_api_key", error_msg="Invalid or missing API key"))+ ),+ )++ asyncio.run(_run())+++def test_self_hosted_api_target_preserves_probe_invalid_api_key(monkeypatch: pytest.MonkeyPatch, tmp_path: Path) -> None:+ class _ConfigService:+ async def get(self, key: str) -> str:+ values = {+ "parse_server.local.mode": "self_hosted",+ "parse_server.local.self_hosted_api_key": "bad-key",+ }+ return values[key]++ async def _run() -> None:+ db = DatabaseManager(str(tmp_path / "doclib.db"))+ await db.initialize()+ service = ParseService(+ db=db,+ fts=FTSManager(db),+ config_svc=_ConfigService(),+ data_dir=str(tmp_path / "data"),+ parse_lock_timeout_sec=1800,+ )++ with pytest.raises(ParseFailure) as exc_info:+ await service._resolve_api_target("local", "high")++ assert exc_info.value.code == "invalid_api_key"+ assert exc_info.value.message == "Local self-hosted parse-server authentication failed: Invalid or missing API key"+ assert exc_info.value.param == "parse_server.local.self_hosted_api_key"++ monkeypatch.setattr(+ "mineru.doclib.background.parse_server_health.get_health",+ lambda: ParseServerHealth(+ local=ProbeState(+ url="http://127.0.0.1:16580",+ probe=ProbeResult(error_code="invalid_api_key", error_msg="Invalid or missing API key"),+ ),+ local_mode="self_hosted",+ self_hosted_url="http://127.0.0.1:16580",+ ),)asyncio.run(_run())