taolib.remote.probe_runner#

远端探测执行器。

默认流程: 1. 连接远端并执行 uname_cmd,验证连接并提取基础信息; 2. 在 prefix( tools_env_cmd + conda_activate_cmd ) 的叠加上下文中:

  • 执行 check_conda_cmd 判断 conda 是否可用;

  • conda 可用时执行 probe_cmd。

Classes#

RemoteProber

远端探测执行器(可注入连接工厂,便于测试与扩展)。

Functions#

validate_ssh_config_minimal(→ None)

校验最小可用 SSH 配置。

run_remote_handling_interrupt(...)

执行远端命令并尽可能将 Windows 下的中断异常归一化为 KeyboardInterrupt。

probe_remote(...)

兼容接口:连接远端并执行探测命令,返回结构化结果。

Module Contents#

taolib.remote.probe_runner.validate_ssh_config_minimal(ssh_config: collections.abc.Mapping[str, Any]) None[源代码]#

校验最小可用 SSH 配置。

该校验仅保证能建立最基础的 SSH 连接: - host: 非空字符串 - user: 非空字符串

taolib.remote.probe_runner.run_remote_handling_interrupt(connection: taolib.remote.connection.ConnectionLike, command: str, **kwargs: Any) taolib.remote.connection.RunResult[源代码]#

执行远端命令并尽可能将 Windows 下的中断异常归一化为 KeyboardInterrupt。

某些 Windows 终端场景下,中断可能以 ValueError: I/O operation on closed file 形式抛出。 为保持调用侧统一处理逻辑,这里将其映射为 KeyboardInterrupt。

class taolib.remote.probe_runner.RemoteProber[源代码]#

远端探测执行器(可注入连接工厂,便于测试与扩展)。

connection_factory: taolib.remote.connection.ConnectionFactory | None = None[源代码]#
commands: taolib.remote.probe_models.RemoteProbeCommands[源代码]#
options: taolib.remote.probe_models.RemoteProbeRunOptions[源代码]#
probe(ssh_config: collections.abc.Mapping[str, Any]) taolib.remote.probe_models.RemoteProbeReport[源代码]#
taolib.remote.probe_runner.probe_remote(ssh_config: collections.abc.Mapping[str, Any], *, tools_env_cmd: str, conda_activate_cmd: str, probe_cmd: str, encoding: str, check_conda_cmd: str, uname_cmd: str, connection_factory: taolib.remote.connection.ConnectionFactory | None, run_kwargs: collections.abc.Mapping[str, Any] | None, raise_on_conda_missing: bool, raise_on_probe_failure: bool) taolib.remote.probe_models.RemoteProbeReport[源代码]#

兼容接口:连接远端并执行探测命令,返回结构化结果。

该函数保持既有 taolib.remote.probe.probe_remote 形态不变。 更推荐的扩展方式是直接使用 RemoteProber,并通过 RemoteProbeCommands/RemoteProbeRunOptions 注入自定义行为。