def setup_parser():
    # If logging the fact a timeout happened, ERROR is a more
    # reasonable default logging error than INFO.
    alert.DEFAULT_SEVERITY = logging.ERROR

    parser = alert.setup_parser()

    # Add a few timeout-specified flags, taken from 'man timeout.'
    parser.add_argument('-k', '--kill-after', type=int,
                        help=('Also send a KILL signal if COMMAND is still '
                              'running this long after the initial signal '
                              'was sent.'))
    parser.add_argument('-s', '--signal', type=int, default=15,
                        help=('The signal to be sent on timeout, as an int. '
                              'See "kill -l" for a list of signals.'))
    parser.add_argument('--cwd', default=None,
                        help=('The directory to change to before running cmd'))

    parser.add_argument('duration', type=int,
                        help=('How many seconds to let the command run.'))
    parser.add_argument('command',
                        help=('The command to run'))
    parser.add_argument('arg', nargs=argparse.REMAINDER,
                        help=('Arguments to the command'))

    return parser
Commit this item to the database
dataset/ETHPy150Open Khan/alertlib/timeout.py/setup_parser--crossover with--dataset/ETHPy150Open sahana/eden/modules/s3/s3import.py/S3ImportItem.commit