• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2
3# Copyright (c) Facebook, Inc. and its affiliates.
4# All rights reserved.
5#
6# This source code is licensed under the BSD-style license found in the
7# LICENSE file in the root directory of this source tree.
8
9import argparse
10import os
11
12
13if __name__ == "__main__":
14    parser = argparse.ArgumentParser(description="test binary, raises a RuntimeError")
15    parser.add_argument("--raises", type=bool, default=False)
16    parser.add_argument("msg", type=str)
17    args = parser.parse_args()
18
19    rank = int(os.environ["RANK"])
20
21    if args.raises:
22        raise RuntimeError(f"raised from {rank}")
23    else:
24        print(f"{args.msg} from {rank}")
25