From: Zack Cerza Date: Tue, 8 Oct 2013 19:21:23 +0000 (-0500) Subject: Move teuthology-worker's arg parsing to scripts/ X-Git-Tag: 1.1.0~1826 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1bf3a3dadbe9f7c79f36090cd5eb776741b6b193;p=teuthology.git Move teuthology-worker's arg parsing to scripts/ Signed-off-by: Zack Cerza --- diff --git a/scripts/worker.py b/scripts/worker.py new file mode 100644 index 000000000..4e8feac61 --- /dev/null +++ b/scripts/worker.py @@ -0,0 +1,37 @@ +import argparse + +import teuthology.queue + + +def main(): + teuthology.queue.worker(parse_args()) + + +def parse_args(): + parser = argparse.ArgumentParser(description=""" +Grab jobs from a beanstalk queue and run the teuthology tests they +describe. One job is run at a time. +""") + parser.add_argument( + '-v', '--verbose', + action='store_true', default=None, + help='be more verbose', + ) + parser.add_argument( + '--archive-dir', + metavar='DIR', + help='path under which to archive results', + required=True, + ) + parser.add_argument( + '-l', '--log-dir', + help='path in which to store logs', + required=True, + ) + parser.add_argument( + '-t', '--tube', + help='which beanstalk tube to read jobs from', + required=True, + ) + + return parser.parse_args() diff --git a/setup.py b/setup.py index 3b0c4bfeb..21f9bff9f 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ setup( 'teuthology-nuke = scripts.nuke:main', 'teuthology-suite = scripts.suite:main', 'teuthology-ls = scripts.ls:main', - 'teuthology-worker = teuthology.queue:worker', + 'teuthology-worker = scripts.worker:main', 'teuthology-lock = teuthology.lock:main', 'teuthology-schedule = teuthology.run:schedule', 'teuthology-updatekeys = teuthology.lock:update_hostkeys', diff --git a/teuthology/queue.py b/teuthology/queue.py index 4c5451c10..2fae7d8b9 100644 --- a/teuthology/queue.py +++ b/teuthology/queue.py @@ -93,35 +93,7 @@ def fetch_teuthology_branch(path, branch='master'): finally: lock.release() -def worker(): - parser = argparse.ArgumentParser(description=""" -Grab jobs from a beanstalk queue and run the teuthology tests they -describe. One job is run at a time. -""") - parser.add_argument( - '-v', '--verbose', - action='store_true', default=None, - help='be more verbose', - ) - parser.add_argument( - '--archive-dir', - metavar='DIR', - help='path under which to archive results', - required=True, - ) - parser.add_argument( - '-l', '--log-dir', - help='path in which to store logs', - required=True, - ) - parser.add_argument( - '-t', '--tube', - help='which beanstalk tube to read jobs from', - required=True, - ) - - ctx = parser.parse_args() - +def worker(ctx): loglevel = logging.INFO if ctx.verbose: loglevel = logging.DEBUG