From: Zack Cerza Date: Fri, 1 Apr 2022 18:33:25 +0000 (-0400) Subject: Remove references to teuth_bin_path X-Git-Tag: 1.2.0~186^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0282a3795887c28d3742c37f8d32d18925b0e0ca;p=teuthology.git Remove references to teuth_bin_path This effectively hardcoded the path to the virtualenv we'll use, which aside from being bad generally, also prevented us from supporting absolute-pathed virtualenvs. Signed-off-by: Zack Cerza --- diff --git a/scripts/dispatcher.py b/scripts/dispatcher.py index 4cb1abdea..15df103fd 100644 --- a/scripts/dispatcher.py +++ b/scripts/dispatcher.py @@ -1,6 +1,6 @@ """ usage: teuthology-dispatcher --help - teuthology-dispatcher --supervisor [-v] --bin-path BIN_PATH --job-config COFNFIG --archive-dir DIR + teuthology-dispatcher --supervisor [-v] --job-config COFNFIG --archive-dir DIR teuthology-dispatcher [-v] [--archive-dir DIR] [--exit-on-empty-queue] --log-dir LOG_DIR --tube TUBE Start a dispatcher for the specified tube. Grab jobs from a beanstalk @@ -19,7 +19,6 @@ standard arguments: -l, --log-dir LOG_DIR path in which to store logs -a DIR, --archive-dir DIR path to archive results in --supervisor run dispatcher in job supervisor mode - --bin-path BIN_PATH teuthology bin path --job-config CONFIG file descriptor of job's config file --exit-on-empty-queue if the queue is empty, exit """ diff --git a/teuthology/dispatcher/__init__.py b/teuthology/dispatcher/__init__.py index 9f7fa257e..9e513a72e 100644 --- a/teuthology/dispatcher/__init__.py +++ b/teuthology/dispatcher/__init__.py @@ -124,7 +124,7 @@ def main(args): keep_running = False try: - job_config, teuth_bin_path = prep_job( + job_config = prep_job( job_config, log_file_path, archive_dir, @@ -137,10 +137,9 @@ def main(args): job_config = lock_machines(job_config) run_args = [ - os.path.join(teuth_bin_path, 'teuthology-dispatcher'), + 'teuthology-dispatcher', '--supervisor', '-v', - '--bin-path', teuth_bin_path, '--archive-dir', archive_dir, ] diff --git a/teuthology/dispatcher/supervisor.py b/teuthology/dispatcher/supervisor.py index f52e37938..fb7cdf2ff 100644 --- a/teuthology/dispatcher/supervisor.py +++ b/teuthology/dispatcher/supervisor.py @@ -31,7 +31,6 @@ def main(args): verbose = args["--verbose"] archive_dir = args["--archive-dir"] - teuth_bin_path = args["--bin-path"] config_file_path = args["--job-config"] with open(config_file_path, 'r') as config_file: @@ -56,7 +55,6 @@ def main(args): try: return run_job( job_config, - teuth_bin_path, archive_dir, verbose ) @@ -64,12 +62,12 @@ def main(args): return 0 -def run_job(job_config, teuth_bin_path, archive_dir, verbose): +def run_job(job_config, archive_dir, verbose): safe_archive = safepath.munge(job_config['name']) if job_config.get('first_in_suite') or job_config.get('last_in_suite'): job_archive = os.path.join(archive_dir, safe_archive) args = [ - os.path.join(teuth_bin_path, 'teuthology-results'), + 'teuthology-results', '--archive-dir', job_archive, '--name', job_config['name'], ] @@ -100,9 +98,7 @@ def run_job(job_config, teuth_bin_path, archive_dir, verbose): log.info('Running job %s', job_config['job_id']) - arg = [ - os.path.join(teuth_bin_path, 'teuthology'), - ] + arg = ['teuthology'] # The following is for compatibility with older schedulers, from before we # started merging the contents of job_config['config'] into job_config # itself. diff --git a/teuthology/test/test_worker.py b/teuthology/test/test_worker.py index ae92e2441..e32cdf6b8 100644 --- a/teuthology/test/test_worker.py +++ b/teuthology/test/test_worker.py @@ -85,10 +85,10 @@ class TestWorker(object): m_p.returncode = 0 m_popen.return_value = m_p m_t_config.results_server = True - worker.run_job(config, "teuth/bin/path", "archive/dir", verbose=False) + worker.run_job(config, "archive/dir", verbose=False) m_run_watchdog.assert_called_with(m_p, config) expected_args = [ - 'teuth/bin/path/teuthology', + 'teuthology', '-v', '--lock', '--block', @@ -135,7 +135,7 @@ class TestWorker(object): m_p.returncode = 1 m_popen.return_value = m_p m_t_config.results_server = False - worker.run_job(config, "teuth/bin/path", "archive/dir", verbose=False) + worker.run_job(config, "archive/dir", verbose=False) m_symlink_log.assert_called_with(config["worker_log"], config["archive_path"]) @patch("teuthology.worker.report.try_push_job_info") @@ -195,7 +195,7 @@ class TestWorker(object): m_fetch_qa_suite.return_value = '/suite/path' m_isdir.return_value = True m_teuth_config.teuthology_path = None - got_config, teuth_bin_path = worker.prep_job( + got_config = worker.prep_job( config, log_file_path, archive_dir, @@ -208,7 +208,6 @@ class TestWorker(object): ) assert got_config['teuthology_branch'] == 'master' assert m_fetch_teuthology.called_once_with_args(branch='master') - assert teuth_bin_path == '/teuth/path/virtualenv/bin' assert m_fetch_qa_suite.called_once_with_args(branch='master') assert got_config['suite_path'] == '/suite/path' @@ -255,7 +254,7 @@ class TestWorker(object): ) m_connection.reserve.side_effect = jobs m_connect.return_value = m_connection - m_prep_job.return_value = (dict(), '/bin/path') + m_prep_job.return_value = dict() worker.main(self.ctx) # There should be one reserve call per item in the jobs list expected_reserve_calls = [ diff --git a/teuthology/worker.py b/teuthology/worker.py index be5d6c650..70cb72f62 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -114,14 +114,13 @@ def main(ctx): keep_running = False try: - job_config, teuth_bin_path = prep_job( + job_config = prep_job( job_config, log_file_path, ctx.archive_dir, ) run_job( job_config, - teuth_bin_path, ctx.archive_dir, ctx.verbose, ) @@ -163,11 +162,6 @@ def prep_job(job_config, log_file_path, archive_dir): log.info('Using teuthology sha1 %s', teuthology_sha1) try: - if teuth_config.teuthology_path is not None: - teuth_path = teuth_config.teuthology_path - else: - teuth_path = fetch_teuthology(branch=teuthology_branch, - commit=teuthology_sha1) # For the teuthology tasks, we look for suite_branch, and if we # don't get that, we look for branch, and fall back to 'master'. # last-in-suite jobs don't have suite_branch or branch set. @@ -196,14 +190,10 @@ def prep_job(job_config, log_file_path, archive_dir): ) raise SkipJob() - teuth_bin_path = os.path.join(teuth_path, 'virtualenv', 'bin') - if not os.path.isdir(teuth_bin_path): - raise RuntimeError("teuthology branch %s at %s not bootstrapped!" % - (teuthology_branch, teuth_bin_path)) - return job_config, teuth_bin_path + return job_config -def run_job(job_config, teuth_bin_path, archive_dir, verbose): +def run_job(job_config, archive_dir, verbose): safe_archive = safepath.munge(job_config['name']) if job_config.get('first_in_suite') or job_config.get('last_in_suite'): if teuth_config.results_server: @@ -215,7 +205,7 @@ def run_job(job_config, teuth_bin_path, archive_dir, verbose): suite_archive_dir = os.path.join(archive_dir, safe_archive) safepath.makedirs('/', suite_archive_dir) args = [ - os.path.join(teuth_bin_path, 'teuthology-results'), + 'teuthology-results', '--archive-dir', suite_archive_dir, '--name', job_config['name'], ] @@ -244,9 +234,7 @@ def run_job(job_config, teuth_bin_path, archive_dir, verbose): log.info('Running job %s', job_config['job_id']) suite_path = job_config['suite_path'] - arg = [ - os.path.join(teuth_bin_path, 'teuthology'), - ] + arg = ['teuthology'] # The following is for compatibility with older schedulers, from before we # started merging the contents of job_config['config'] into job_config # itself.