Exemplo n.º 1
0
 def check_rd_existence(self):
     if os.path.exists(self.args.result_dir):
         self.logger.info("Found old results: {}".format(
             self.args.result_dir))
         # ask for overwrite (if not -y/--force-yes)
         if not self.args.force_yes:
             # ask user
             ui = input(
                 "Do you want to overwrite '{}'? (y/n/default: y)".format(
                     self.args.result_dir))
             if "n" in ui or "N" in ui:
                 return
         # delte old results
         self.logger.info("Overwriting old results: {}".format(
             self.args.result_dir))
         shutil.rmtree(self.args.result_dir)
         # also clean prometheus data (if present, rquires sudo)
         if not self.args.no_prometheus:
             try:
                 pm_path = get_prometheus_path()
                 self.logger.info(
                     "Removing Prometheus data: {}".format(pm_path))
                 subprocess.call(["./clean.sh"], cwd=pm_path)
             except BaseException as ex:
                 self.logger.warning(
                     "Couldn't remove Prometheus data: {}".format(ex))
Exemplo n.º 2
0
 def stop_prometheus_monitoring(self):
     try:
         pm_path = get_prometheus_path()
         self.logger.info("Stopping Prometheus 'docker-compose down in:' {}"
                          .format(pm_path))
         subprocess.call(["docker-compose", "down"], cwd=pm_path)
     except BaseException as ex:
         self.logger.warning("Couldn't stop Prometheus. Skipping it. ({})"
                             .format(ex))