import sys
from indra.tools.reading.submit_reading_pipeline_aws import wait_for_complete

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print("Missing argument. Must specify queue.")
        print("Usage: python wait_for_complete.py QUEUE")
        sys.exit(1)
    wait_for_complete(sys.argv[-1])

@@ -4,16 +4,52 @@
 ort sys%0A
+from argparse import ArgumentParser%0A
 from ind
@@ -154,196 +154,2210 @@
     
-if len(sys.argv) != 2:%0A        print(%22Missing argument. Must specify queue.%22)%0A        print(%22Usage: python
+parser = ArgumentParser(%0A        'wait_for_complete.py',%0A        usage='%25(prog)s %5B-h%5D queue_name %5Boptions%5D',%0A        description=('Wait for a set of batch jobs to complete, and monitor '%0A                     'them as they run.'),%0A        epilog=('Jobs can also be monitored, terminated, and otherwise '%0A                'managed on the AWS website. However this tool will also tag '%0A                'the instances, and should be run whenever a job is submitted '%0A                'to AWS.')%0A        )%0A    parser.add_argument(%0A        dest='queue_name',%0A        help=('The name of the queue to watch and wait for completion. If no '%0A              'jobs are specified, this will wait until all jobs in the queue '%0A              'are completed (either SUCCEEDED or FAILED).')%0A        )%0A    parser.add_argument(%0A        '--watch', '-w',%0A        dest='job_list',%0A        metavar='JOB_ID',%0A        nargs='+',%0A        help=('Specify particular jobs using their job ids, as reported by '%0A              'the submit command. Many ids may be specified.')%0A        )%0A    parser.add_argument(%0A        '--prefix', '-p',%0A        dest='job_name_prefix',%0A        help='Specify a prefix for the name of the jobs to watch and
  wait
-_for_complete.py QUEUE%22)%0A        sys.exit(1)%0A    wait_for_complete(sys.argv%5B-1%5D
+ for.'%0A        )%0A    parser.add_argument(%0A        '--interval', '-i',%0A        dest='poll_interval',%0A        type=int,%0A        help='The time interval to wait between job status checks, in seconds.'%0A        )%0A    parser.add_argument(%0A        '--timeout', '-T',%0A        metavar='TIMEOUT',%0A        help=('If the logs are not updated for %25(metavar)s seconds, '%0A              'print a warning. If %60--kill_on_log_timeout%60 flag is set, then '%0A              'the offending jobs will be automatically terminated.')%0A        )%0A    parser.add_argument(%0A        '--kill_on_timeout', '-K',%0A        action='store_true',%0A        help='If a log times out, terminate the offending job.'%0A        )%0A    args = parser.parse_args()%0A%0A    job_list = None%0A    if args.job_list is not None:%0A        job_list = %5B%7B'jobId': jid%7D for jid in args.job_list%5D%0A%0A    wait_for_complete(args.queue_name, job_list, args.job_name_prefix,%0A                      args.poll_interval, args.timeout,%0A                      args.kill_on_timeout
 )%0A

Add proper parser to wait_for_complete.