xref: /aosp_15_r20/external/pytorch/torch/distributed/elastic/multiprocessing/subprocess_handler/handlers.py (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1#!/usr/bin/env python3
2# mypy: allow-untyped-defs
3
4# Copyright (c) Facebook, Inc. and its affiliates.
5# All rights reserved.
6#
7# This source code is licensed under the BSD-style license found in the
8# LICENSE file in the root directory of this source tree.
9from typing import Dict, Tuple
10
11from torch.distributed.elastic.multiprocessing.subprocess_handler.subprocess_handler import (
12    SubprocessHandler,
13)
14
15
16__all__ = ["get_subprocess_handler"]
17
18
19def get_subprocess_handler(
20    entrypoint: str,
21    args: Tuple,
22    env: Dict[str, str],
23    stdout: str,
24    stderr: str,
25    local_rank_id: int,
26):
27    return SubprocessHandler(
28        entrypoint=entrypoint,
29        args=args,
30        env=env,
31        stdout=stdout,
32        stderr=stderr,
33        local_rank_id=local_rank_id,
34    )
35