• 文档 >
  • 模块代码 >
  • torch >
  • torch.distributed >
  • torch.distributed.elastic.agent.server.健康检查服务器
快捷键

torch.distributed.elastic.agent.server.健康检查服务器的源代码

#!/usr/bin/env python3

版权所有(c)Facebook,Inc.及其关联公司
版权所有
#
此源代码遵循在源树根目录中的 LICENSE 文件中找到的 BSD 风格许可协议。
有关许可证文件,请参阅源树根目录。

来自 打字 导入 可调用

来自 torch.distributed.elastic.utils.日志 导入 获取日志记录器


日志 = 获取日志记录器(__name__)

__all__ = [健康检查服务器, 创建健康检查服务器]


[文档]class HealthCheckServer: ```python # 假设输入文本为: input_text = '"""' # 翻译函数(此处仅为示例,实际翻译功能需要调用真实的翻译 API) def translate_to_simplified_chinese(text): # 这里应该调用真实的翻译 API 进行翻译 # 由于示例中不使用真实的 API,以下为模拟翻译结果 return text # 输出翻译结果 translated_text = translate_to_simplified_chinese(input_text) print(translated_text) ``` 健康检查监控服务器界面,可扩展 通过在指定端口启动 tcp/http 服务器。 Args: alive_callback: Callable[[], int], 回调到代理最后进度时间 port: int, 启动 tcp/http 服务器的端口号 timeout: int, 判断代理是否存活/死亡的超时秒数 """ _alive_callback: 可调用函数[[], int] _port: 整数 _timeout: 整数 def __init__( self, alive_callback: Callable[[], int], port: int, timeout: int ) -> None: self._alive_callback = alive_callback self._port = 端口 self._timeout = 超时
[文档] def start(self) -> None: """ Pytorch 不支持的功能,无法启动任何健康检查服务器 """ log.warning("未启动健康检查服务器")
[文档] def stop(self) -> None: "源代码" 停止健康检查服务器的函数 "源代码" log.info('停止无操作的健康检查服务器。')
[文档]def create_healthcheck_server( alive_callback: Callable[[], int], port: int, timeout: int, ) -> 健康检查服务器: """ 创建健康检查服务器对象 """ 返回 HealthCheckServer(alive_callback, 端口, 超时)

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

查看 PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源,获取您的疑问解答

查看资源