]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Tweak fetch_teuthology_branch()
authorZack Cerza <zack@cerza.org>
Thu, 10 Jul 2014 07:29:45 +0000 (01:29 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 10 Jul 2014 22:35:37 +0000 (16:35 -0600)
Specifically, make it match fetch_qa_suite()'s behavior.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/worker.py

index ca7ebc5b2d0381b95e28a6cf87b7b8e857693475..2dac400e6da976236a1f4096a3f7e0b0c9c61124 100644 (file)
@@ -70,10 +70,15 @@ class filelock(object):
         self.fd = None
 
 
-def fetch_teuthology_branch(dest_path, branch='master'):
+def fetch_teuthology_branch(branch):
     """
     Make sure we have the correct teuthology branch checked out and up-to-date
+
+    :param branch: The branche we want
+    :returns:      The destination path
     """
+    src_base_path = teuth_config.src_base_path
+    dest_path = os.path.join(src_base_path, 'teuthology_' + branch)
     # only let one worker create/update the checkout at a time
     lock = filelock('%s.lock' % dest_path)
     lock.acquire()
@@ -101,6 +106,8 @@ def fetch_teuthology_branch(dest_path, branch='master'):
     finally:
         lock.release()
 
+    return dest_path
+
 
 def fetch_qa_suite(branch):
     """
@@ -182,14 +189,9 @@ def main(ctx):
         teuthology_branch = job_config.get('teuthology_branch', 'master')
         job_config['teuthology_branch'] = teuthology_branch
 
-        teuth_path = os.path.join(os.getenv("HOME"), 'src',
-                                  'teuthology_' + teuthology_branch)
-
         try:
-            fetch_teuthology_branch(dest_path=teuth_path,
-                                    branch=teuthology_branch)
+            teuth_path = fetch_teuthology_branch(branch=teuthology_branch)
             suite_path = fetch_qa_suite(job_config['suite_branch'])
-            job_config['suite_path'] = suite_path
         except BranchNotFoundError:
             log.exception(
                 "Branch not found; throwing job away")
@@ -229,7 +231,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)
+            run_job(job_config, teuth_bin_path, suite_path)
         job.delete()
 
 
@@ -288,7 +290,7 @@ 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):
+def run_job(job_config, teuth_bin_path, suite_path):
     arg = [
         os.path.join(teuth_bin_path, 'teuthology'),
     ]
@@ -322,8 +324,7 @@ def run_job(job_config, teuth_bin_path):
         yaml.safe_dump(data=job_config, stream=tmp)
         tmp.flush()
         arg.append(tmp.name)
-        p = subprocess.Popen(args=arg,
-                             environ=dict(PYTHONPATH=job_config['suite_path']))
+        p = subprocess.Popen(args=arg, environ=dict(PYTHONPATH=suite_path))
         log.info("Job archive: %s", job_config['archive_path'])
         log.info("Job PID: %s", str(p.pid))