]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move teuthology-worker's arg parsing to scripts/
authorZack Cerza <zack@cerza.org>
Tue, 8 Oct 2013 19:21:23 +0000 (14:21 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 00:09:34 +0000 (19:09 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
scripts/worker.py [new file with mode: 0644]
setup.py
teuthology/queue.py

diff --git a/scripts/worker.py b/scripts/worker.py
new file mode 100644 (file)
index 0000000..4e8feac
--- /dev/null
@@ -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()
index 3b0c4bfeb99aa3c6627ae9c3f4d6c6e8b0f5b15c..21f9bff9feb1898476c5f544d975237be78fac3f 100644 (file)
--- 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',
index 4c5451c1091b8bed065d530f1650198129a70bfc..2fae7d8b99d10304a4b6f206bfcc96edb2790468 100644 (file)
@@ -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