]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Speed up teuthology-kill.
authorSandon Van Ness <sandon@inktank.com>
Mon, 18 Aug 2014 18:25:24 +0000 (11:25 -0700)
committerSandon Van Ness <sandon@inktank.com>
Mon, 18 Aug 2014 18:25:24 +0000 (11:25 -0700)
Read less information when its not needed for killing runs.

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
teuthology/kill.py
teuthology/report.py

index 41f71ff86f3f679c5baaf0e878efad9de44688ff..5a241356dd413875e76e796ee606759eb50eff92 100755 (executable)
@@ -92,7 +92,7 @@ def find_run_info(serializer, run_name):
             continue
         job_num += 1
         beanstalk.print_progress(job_num, job_total, 'Reading Job: ')
-        job_info = serializer.job_info(run_name, job_id)
+        job_info = serializer.job_info(run_name, job_id, simple=True)
         for key in job_info.keys():
             if key in run_info_fields and key not in run_info:
                 run_info[key] = job_info[key]
index 95ed0b34d25ea7a9b88db0bed98c5c4fdee4067c..ceaad59bfe56359d45c71abafd9c955f5bc27f51 100644 (file)
@@ -72,18 +72,24 @@ class ResultsSerializer(object):
         self.archive_base = archive_base or config.archive_base
         self.log = log or init_logging()
 
-    def job_info(self, run_name, job_id, pretty=False):
+
+    def job_info(self, run_name, job_id, pretty=False, simple=False):
         """
         Given a run name and job id, merge the job's YAML files together.
 
         :param run_name: The name of the run.
         :param job_id:   The job's id.
+        :param simple(bool): Read less data for speed.
         :returns:        A dict.
         """
         job_archive_dir = os.path.join(self.archive_base,
                                        run_name,
                                        job_id)
         job_info = {}
+
+        if simple:
+            self.yamls = ('orig.config.yaml', 'info.yaml')
+
         for yaml_name in self.yamls:
             yaml_path = os.path.join(job_archive_dir, yaml_name)
             if not os.path.exists(yaml_path):
@@ -93,14 +99,18 @@ class ResultsSerializer(object):
                 if partial_info is not None:
                     job_info.update(partial_info)
 
+        if 'job_id' not in job_info:
+            job_info['job_id'] = job_id
+
+        if simple:
+            return job_info
+
         log_path = os.path.join(job_archive_dir, 'teuthology.log')
         if os.path.exists(log_path):
             mtime = int(os.path.getmtime(log_path))
             mtime_dt = datetime.fromtimestamp(mtime)
             job_info['updated'] = str(mtime_dt)
 
-        if 'job_id' not in job_info:
-            job_info['job_id'] = job_id
 
         return job_info