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()
finally:
lock.release()
+ return dest_path
+
def fetch_qa_suite(branch):
"""
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")
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()
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'),
]
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))