def parse_args()

in torchx/apps/utils/process_monitor.py [0:0]


def parse_args(argv: List[str]) -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="monitors a process and terminates it when a condition is met"
    )
    parser.add_argument(
        "--timeout",
        type=float,
        help="timeout in seconds to wait before killing the process",
    )
    parser.add_argument(
        "--start_on_file",
        type=str,
        help="monitor specified fsspec path for existence and terminate process when the file is created",
    )
    parser.add_argument(
        "--exit_on_file",
        type=str,
        help="monitor specified fsspec path for existence and terminate process when the file is created",
    )
    parser.add_argument(
        "--poll_rate",
        type=float,
        default=5,
        help="seconds between polling the process and file for termination",
    )
    parser.add_argument(
        "--kill_timeout",
        type=float,
        default=60,
        help="seconds to wait after terminating the process before calling kill",
    )
    parser.add_argument(
        "entrypoint",
        type=str,
        help="program entrypoint",
    )
    parser.add_argument(
        "args",
        type=str,
        help="program args",
        nargs=argparse.REMAINDER,
    )
    return parser.parse_args(argv)