-
Notifications
You must be signed in to change notification settings - Fork 0
/
awsbatch.py
50 lines (38 loc) · 1.32 KB
/
awsbatch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
"""
Wrapper for AWS Batch.
"""
import argparse
import sys
# Constants
DEFAULT_COMPUTE_ENVIRONMENT = "default"
DEFAULT_COMPUTE_ENVIRONMENT_WITH_SCRATCH = "default-with-scratch"
DEFAULT_QUEUE = "default"
def submit(args):
"submit a job"
print("hello from the submit function!")
def list_jobs(args):
"list jobs"
pass
def no_subcommand(args): # pylint: disable=unused-argument
"if user did not specify a subcommand"
print("You did not specify a subcommand.")
print("Try `awsbatch --help` for help.")
sys.exit(1)
def main():
"Do the work."
description = ["Interact with the AWS Batch Service",
"See full documentation at https://bit.ly/AWSBatchAtHutch"]
parser = argparse.ArgumentParser("\n".join(description))
parser.set_defaults(func=no_subcommand)
# subcommands: submit, list, log, create-def, terminate
subparsers = parser.add_subparsers(help='additional help',
title='subcommands',
description='submit, list, log create-def, terminate')
parser_submit = subparsers.add_parser('submit', help='submit help')
parser_submit.set_defaults(func=submit)
# add arguments---
args = parser.parse_args()
args.func(args)
if __name__ == "__main__":
main()