taolib.remote.probe#

远端探测接口(uname -> conda 检查 -> 探测命令)。

该模块提供兼容接口 probe_remote,并暴露默认命令常量。 更可扩展的用法可以直接使用 RemoteProberRemoteProbeCommandsRemoteProbeRunOptions

Attributes#

Classes#

RemoteProbeCommands

远端探测使用的命令集合。

RemoteProbeReport

远端探测结果。

RemoteProbeRunOptions

远端命令执行选项与错误处理策略。

RemoteProber

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

Functions#

probe_remote(...)

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

Module Contents#

taolib.remote.probe.DEFAULT_CONDA_ACTIVATE_CMD[源代码]#
taolib.remote.probe.DEFAULT_ENCODING[源代码]#
taolib.remote.probe.DEFAULT_PROBE_CMD[源代码]#
taolib.remote.probe.DEFAULT_TOOLS_ENV_CMD[源代码]#
class taolib.remote.probe.RemoteProbeCommands[源代码]#

远端探测使用的命令集合。

命令分为两类: - prefix 命令:tools_env_cmd、conda_activate_cmd,会在同一执行上下文中叠加生效; - 常规命令:uname_cmd、check_conda_cmd、probe_cmd,会在远端依次运行。

tools_env_cmd: str#
conda_activate_cmd: str#
probe_cmd: str#
check_conda_cmd: str = 'command -v conda'#
uname_cmd: str = 'uname -a'#
class taolib.remote.probe.RemoteProbeReport[源代码]#

远端探测结果。

语义约定: - conda_available=False 时,不会尝试执行 probe_cmd(probe_attempted=False, probe_ok=None)。 - conda_available=True 且 probe_attempted=True 时,probe_ok 表示探测命令退出状态是否成功。

uname: str#
conda_available: bool#
probe_attempted: bool#
probe_ok: bool | None#
class taolib.remote.probe.RemoteProbeRunOptions[源代码]#

远端命令执行选项与错误处理策略。

encoding 与 run_kwargs 会被合并用于 Connection.run(...)。 raise_on_* 用于控制缺少 conda 或 probe 失败时,是返回结构化结果还是抛出异常。

encoding: str#
run_kwargs: collections.abc.Mapping[str, Any] | None = None#
raise_on_conda_missing: bool = False#
raise_on_probe_failure: bool = False#
merged_run_kwargs() dict[str, Any][源代码]#
class taolib.remote.probe.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.probe_remote(ssh_config: collections.abc.Mapping[str, Any], *, tools_env_cmd: str = DEFAULT_TOOLS_ENV_CMD, conda_activate_cmd: str = DEFAULT_CONDA_ACTIVATE_CMD, probe_cmd: str = DEFAULT_PROBE_CMD, encoding: str = DEFAULT_ENCODING, check_conda_cmd: str = 'command -v conda', uname_cmd: str = 'uname -a', connection_factory: taolib.remote.connection.ConnectionFactory | None = None, run_kwargs: collections.abc.Mapping[str, Any] | None = None, raise_on_conda_missing: bool = False, raise_on_probe_failure: bool = False) taolib.remote.probe_models.RemoteProbeReport[源代码]#

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