mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Summary: Improve the implementation and the unit test coverage of `RendezvousHandlerRegistry`. Test Plan: Run the existing and newly-introduced unit tests. Reviewed By: tierex Differential Revision: D27442325 fbshipit-source-id: 8519a2caacbe2e3ce5d9a02e87a910503dea27d7
24 lines
790 B
Python
24 lines
790 B
Python
# Copyright (c) Facebook, Inc. and its affiliates.
|
|
# All rights reserved.
|
|
#
|
|
# This source code is licensed under the BSD-style license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
from .api import RendezvousHandler, RendezvousParameters
|
|
from .api import rendezvous_handler_registry as handler_registry
|
|
|
|
|
|
def _create_etcd_handler(params: RendezvousParameters) -> RendezvousHandler:
|
|
from . import etcd_rendezvous
|
|
|
|
return etcd_rendezvous.create_rdzv_handler(params)
|
|
|
|
|
|
def _register_default_handlers() -> None:
|
|
handler_registry.register("etcd", _create_etcd_handler)
|
|
|
|
|
|
# The legacy function kept for backwards compatibility.
|
|
def get_rendezvous_handler(params: RendezvousParameters) -> RendezvousHandler:
|
|
return handler_registry.create_handler(params)
|