diff --git a/ci/jobgenerator.py b/ci/jobgenerator.py index 60dc00b..2fa3e24 100755 --- a/ci/jobgenerator.py +++ b/ci/jobgenerator.py @@ -29,6 +29,7 @@ timer = TimerMetrics() class Generator: + @timer.run("Clone the metadata") def clone_metadata(self): """Clone the metadata repository using the values set in the env vars @@ -149,6 +150,7 @@ class Generator: return server + @timer.run("Load configuration files") def load_config(self, job_type, data=None): """Return a template that is a result of loading the data @@ -230,6 +232,7 @@ class Generator: if not name in server.views[view]: view.add_job(name) + @timer.run("Master function loop") def create_jenkins_jobs(self): """Interface with Jenkins to create the jobs required diff --git a/ci/timer_metrics.py b/ci/timer_metrics.py index 6ff50e1..9f0c86f 100755 --- a/ci/timer_metrics.py +++ b/ci/timer_metrics.py @@ -107,12 +107,24 @@ class TimerMetrics: """ self.start(label) + # Pause all other timers + paused = [] + for timer in self.data: + if not timer == label and self.data[timer]["running"]: + self.stop(timer) + paused.append(timer) + def wrap(func): def run_function(*args, **kwargs): try: return func(*args, **kwargs) finally: self.stop(label) + + # Unpause other timers + for timer in paused: + self.start(timer) + return run_function return wrap