(self)
| 30 | self.log_file = "/tmp/tao_build.log" |
| 31 | |
| 32 | def report(self): |
| 33 | if len(self.durs) == 0: |
| 34 | return |
| 35 | lines = [] |
| 36 | # load previous info from file |
| 37 | if os.path.exists(self.log_file): |
| 38 | lines += open(self.log_file, "r").read().splitlines() |
| 39 | for name, sec, ts in self.durs: |
| 40 | lines.append("{}: {} - {:.2f} minutes".format(ts, name, sec * 1.0 / 60)) |
| 41 | # logger.info("****** Stage timing report: ******\n{}".format("\n".join(lines))) |
| 42 | # logger.info("**********************************") |
| 43 | # save to file |
| 44 | with open(self.log_file, "w") as of: |
| 45 | of.write("\n".join(lines)) |
| 46 | |
| 47 | def append(self, name, secs): |
| 48 | self.durs.append((name, secs, datetime.now().strftime("%Y-%m-%d %H:%M:%S"))) |
no test coverage detected