]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
For non-scheduled jobs, check out the suite repo. 307/head
authorZack Cerza <zack.cerza@inktank.com>
Wed, 6 Aug 2014 22:50:13 +0000 (16:50 -0600)
committerZack Cerza <zack.cerza@inktank.com>
Thu, 7 Aug 2014 17:13:42 +0000 (11:13 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/run.py
teuthology/worker.py

index 672cdf5ec456665fc13a004f0117a8b59dcaa54f..373bffe267dead4f56672f0d857febfe48c8417c 100644 (file)
@@ -12,6 +12,7 @@ from .misc import get_user
 from .misc import read_config
 from .nuke import nuke
 from .run_tasks import run_tasks
+from .repo_utils import fetch_qa_suite
 from .results import email_results
 
 
@@ -65,6 +66,25 @@ def write_initial_metadata(ctx):
             yaml.safe_dump(info, f, default_flow_style=False)
 
 
+def fetch_tasks_if_needed(job_config):
+    """
+    Fetch the suite repo (and include it in sys.path) so that we can use its
+    tasks.
+    """
+    # Any scheduled job will already have the suite checked out and its
+    # $PYTHONPATH set. We can check for this by looking for 'suite_path'
+    # in its config.
+    suite_path = job_config.get('suite_path')
+    if suite_path:
+        return
+
+    ceph_branch = job_config.get('branch', 'master')
+    suite_branch = job_config.get('suite_branch', ceph_branch)
+    suite_path = fetch_qa_suite(suite_branch)
+    sys.path.insert(1, suite_path)
+    job_config['suite_path'] = suite_path
+
+
 def main(ctx):
     set_up_logging(ctx)
     log = logging.getLogger(__name__)
@@ -148,6 +168,8 @@ def main(ctx):
 
     ctx.config['tasks'][:0] = init_tasks
 
+    fetch_tasks_if_needed(ctx.config)
+
     try:
         run_tasks(tasks=ctx.config['tasks'], ctx=ctx)
     finally:
index 31faacdd817b510ca2157ab66c81f8f0b3abbd3e..95945a77b82f97ec92b755a8d7ba03196f9b0009 100644 (file)
@@ -119,7 +119,7 @@ def main(ctx):
             # last-in-suite jobs don't have suite_branch or branch set.
             ceph_branch = job_config.get('branch', 'master')
             suite_branch = job_config.get('suite_branch', ceph_branch)
-            suite_path = fetch_qa_suite(suite_branch)
+            job_config['suite_path'] = fetch_qa_suite(suite_branch)
         except BranchNotFoundError:
             log.exception(
                 "Branch not found; throwing job away")
@@ -159,7 +159,7 @@ def main(ctx):
             log.info('Creating archive dir %s', archive_path_full)
             safepath.makedirs(ctx.archive_dir, safe_archive)
             log.info('Running job %d', job.jid)
-            run_job(job_config, teuth_bin_path, suite_path)
+            run_job(job_config, teuth_bin_path)
         job.delete()
 
 
@@ -218,7 +218,8 @@ def run_with_watchdog(process, job_config):
         report.try_push_job_info(job_info, dict(status='dead'))
 
 
-def run_job(job_config, teuth_bin_path, suite_path):
+def run_job(job_config, teuth_bin_path):
+    suite_path = job_config['suite_path']
     arg = [
         os.path.join(teuth_bin_path, 'teuthology'),
     ]