Decouple argument parser from sys.argv
This commit is contained in:
parent
3843ce1350
commit
6ff52227ef
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ from collections import OrderedDict
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments(args):
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Produce detailed power usage data for a list of jobids.')
|
description='Produce detailed power usage data for a list of jobids.')
|
||||||
parser.add_argument('-v', '--verbose', action='store_true',
|
parser.add_argument('-v', '--verbose', action='store_true',
|
||||||
|
@ -13,7 +13,7 @@ def parse_arguments():
|
||||||
nargs='+',
|
nargs='+',
|
||||||
help='Job ID such as "2260215" or "2260215.hawk-pbs5"')
|
help='Job ID such as "2260215" or "2260215.hawk-pbs5"')
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser.parse_args(args)
|
||||||
|
|
||||||
def parse_jobid(s):
|
def parse_jobid(s):
|
||||||
import re
|
import re
|
||||||
|
@ -204,8 +204,8 @@ class App:
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = parse_arguments()
|
import sys
|
||||||
config.interval = 5
|
config = parse_arguments(sys.argv[1:])
|
||||||
|
|
||||||
main = App(config)
|
main = App(config)
|
||||||
main.run_all()
|
main.run_all()
|
||||||
|
|
Loading…
Reference in a new issue