]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Remove references to teuth_bin_path
authorZack Cerza <zack@redhat.com>
Fri, 1 Apr 2022 18:33:25 +0000 (14:33 -0400)
committerZack Cerza <zack@redhat.com>
Tue, 12 Apr 2022 23:32:38 +0000 (17:32 -0600)
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 <zack@redhat.com>
scripts/dispatcher.py
teuthology/dispatcher/__init__.py
teuthology/dispatcher/supervisor.py
teuthology/test/test_worker.py
teuthology/worker.py

index 4cb1abdea665803c62ecc5d0ef19fd2fa77f1e07..15df103fd3936ded3ed277eaafe7e0a4d1486a86 100644 (file)
@@ -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
 """
index 9f7fa257e40ea2519cb698c6ce8bdc3ba7dbe255..9e513a72e90841c8d17b615b9a11470e88e0a423 100644 (file)
@@ -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,
         ]
 
index f52e37938f297de6fa3d5df17b4956ad82b67a3c..fb7cdf2ffff4672121aff7bb75b5861856c3a39e 100644 (file)
@@ -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.
index ae92e2441a626d9231e273d212efa9d4015e9224..e32cdf6b8be43c9a85c95e22a7e74c509ec46a1d 100644 (file)
@@ -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 = [
index be5d6c6501fe57c707881af47c063316c3b0bd4c..70cb72f621511686854038d15dc9225b9d488a03 100644 (file)
@@ -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.