]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Revert "teuthology/suite: merge base_config with other fragments"
authorAishwarya Mathuria <amathuri@redhat.com>
Thu, 12 Jun 2025 11:50:18 +0000 (17:20 +0530)
committerAishwarya Mathuria <amathuri@redhat.com>
Thu, 12 Jun 2025 11:50:18 +0000 (17:20 +0530)
This reverts commit d05aa26b35c50545ecebeb0467ec8a68adcc65fa.

teuthology/suite/merge.py
teuthology/suite/run.py
teuthology/suite/test/test_run_.py

index 0e109af02f6c31c81357922f3a897bf833502d29..f13058e47d0720e38477fb70ab9072ae3277308e 100644 (file)
@@ -5,7 +5,6 @@ import os
 from types import MappingProxyType
 import yaml
 
-from teuthology.config import JobConfig
 from teuthology.suite.build_matrix import combine_path
 from teuthology.suite.util import strip_fragment_path
 from teuthology.misc import deep_merge
@@ -116,7 +115,6 @@ def config_merge(configs, suite_name=None, **kwargs):
     the entire job (config) from the list.
     """
     seed = kwargs.setdefault('seed', 1)
-    base_config = kwargs.setdefault('base_config', JobConfig())
     if not isinstance(seed, int):
         log.debug("no valid seed input: using 1")
         seed = 1
@@ -130,7 +128,7 @@ def config_merge(configs, suite_name=None, **kwargs):
         if suite_name is not None:
             desc = combine_path(suite_name, desc)
 
-        yaml_complete_obj = copy.deepcopy(base_config.to_dict())
+        yaml_complete_obj = {}
         deep_merge(yaml_complete_obj, dict(TEUTHOLOGY_TEMPLATE))
         for path in paths:
             if path not in yaml_cache:
index e348c294ceacdc69ca55f0aa6c95c421f6714b7d..5fddb34892c749abe884a19ed1ab894b4e2b457c 100644 (file)
@@ -9,6 +9,7 @@ import time
 
 from humanfriendly import format_timespan
 
+from tempfile import NamedTemporaryFile
 from teuthology import repo_utils
 
 from teuthology.config import config, JobConfig
@@ -625,10 +626,17 @@ Note: If you still want to go ahead, use --job-threshold 0'''
             filter_out=self.args.filter_out,
             filter_all=self.args.filter_all,
             filter_fragments=self.args.filter_fragments,
-            base_config=self.base_config,
             seed=self.args.seed,
             suite_name=suite_name))
 
+        # create, but do not write, the temp file here, so it can be
+        # added to the args in collect_jobs, but not filled until
+        # any backtracking is done
+        base_yaml_path = NamedTemporaryFile(
+            prefix='schedule_suite_', delete=False
+        ).name
+        self.base_yaml_paths.insert(0, base_yaml_path)
+
         # compute job limit in respect of --sleep-before-teardown
         job_limit = self.args.limit or 0
         sleep_before_teardown = int(self.args.sleep_before_teardown or 0)
@@ -693,6 +701,9 @@ Note: If you still want to go ahead, use --job-threshold 0'''
                     dry_run=self.args.dry_run,
                 )
 
+        with open(base_yaml_path, 'w+b') as base_yaml:
+            base_yaml.write(str(self.base_config).encode())
+
         if jobs_to_schedule:
             self.write_rerun_memo()
 
@@ -704,6 +715,8 @@ Note: If you still want to go ahead, use --job-threshold 0'''
 
         self.schedule_jobs(jobs_missing_packages, jobs_to_schedule, name)
 
+        os.remove(base_yaml_path)
+
         count = len(jobs_to_schedule)
         missing_count = len(jobs_missing_packages)
         total_count = count
index c97e26e5c2826d493a64ffbc9fd9eef015cfc4bf..0fad56ddfaea7758aad54c7b105f7562bea9b14a 100644 (file)
@@ -1,4 +1,3 @@
-import logging
 import os
 import pytest
 import requests
@@ -15,7 +14,6 @@ from teuthology.exceptions import ScheduleFailError
 from teuthology.suite import run
 from teuthology.util.time import TIMESTAMP_FMT
 
-log = logging.getLogger(__name__)
 
 class TestRun(object):
     klass = run.Run
@@ -272,35 +270,14 @@ class TestScheduleSuite(object):
             [call('ceph_sha1', 'default', 'ubuntu', '14.04', 'machine_type')],
         )
         y = {
+          'teuthology': {
+            'fragments_dropped': [],
+            'meta': {},
+            'postmerge': []
+          },
           'field1': 'val1',
           'field2': 'val2'
         }
-        teuthology_keys = [
-          'branch',
-          'machine_type',
-          'name',
-          'os_type',
-          'os_version',
-          'overrides',
-          'priority',
-          'repo',
-          'seed',
-          'sha1',
-          'sleep_before_teardown',
-          'suite',
-          'suite_branch',
-          'suite_relpath',
-          'suite_repo',
-          'suite_sha1',
-          'tasks',
-          'teuthology_branch',
-          'teuthology_sha1',
-          'timestamp',
-          'user',
-          'teuthology',
-        ]
-        for t in teuthology_keys:
-            y[t] = ANY
         expected_job = dict(
             yaml=y,
             sha1='ceph_sha1',
@@ -310,23 +287,16 @@ class TestScheduleSuite(object):
                 '--description',
                 os.path.join(self.args.suite, build_matrix_desc),
                 '--',
+                ANY, # base config
                 '-'
             ],
-            stdin=ANY,
+            stdin=yaml.dump(y),
             desc=os.path.join(self.args.suite, build_matrix_desc),
         )
 
         m_schedule_jobs.assert_has_calls(
             [call([], [expected_job], runobj.name)],
         )
-        args = m_schedule_jobs.call_args.args
-        log.debug("args =\n%s", args)
-        jobargs  = args[1][0]
-        stdin_yaml = yaml.safe_load(jobargs['stdin'])
-        for k in y:
-            assert y[k] == stdin_yaml[k]
-        for k in teuthology_keys:
-            assert k in stdin_yaml
         m_write_rerun_memo.assert_called_once_with()
 
     @patch('teuthology.suite.util.find_git_parents')