示例#1
0
 def import_with_suite_thread(self):
     self.show_log(timeOpt.get_time() + ": import Experience data.")
     self.copy_data(self.exper_entry.get(), setting.exper_data_path)
     self.show_log(timeOpt.get_time() + ": import Capacity data.")
     self.copy_data(self.capa_entry.get(), setting.capa_data_path)
     self.show_log(timeOpt.get_time() + ": import CPE data.")
     self.copy_data(self.cpe_entry.get(), setting.cpe_data_path)
示例#2
0
 def reset(self):
     self.ratChoice.current(0)
     self.thre_entry.delete(0, END)
     self.cpe_entry.delete(0, END)
     self.exper_entry.delete(0, END)
     self.capa_entry.delete(0, END)
     self.show_log(timeOpt.get_time() + ": reset configure.")
示例#3
0
 def run(self):
     self.THREAD_FLAG = True
     status = self.check()
     if status == 0:
         self.show_log(timeOpt.get_time() +
                       ": Please import the specified data.")
         tk.messagebox.showwarning(
             "WARNING",
             message="Please import the specified data!\nExperience data "
             "& Performance Evaluation Threshold & Capacity data & CPE data\nor\nCPE "
             "data")
     else:
         self.analysis_button['state'] = DISABLED
         self.export_button['state'] = DISABLED
         try:
             uiThread.UiThread(self.cpe_analysis, [status])
         except Exception as e:
             self.show_log(timeOpt.get_time() + ": Analysis failed!\n" +
                           str(e))
             tk.messagebox.showerror("ERROR",
                                     message='Analysis failed!\n' + str(e))
示例#4
0
 def export_result(self):
     if os.path.exists(os.path.join(setting.data_path, 'result.zip')):
         dest = self.open_dir()
         success = self.copy_file(
             os.path.join(setting.data_path, 'result.zip'), dest)
         if success:
             tk.messagebox.showinfo("Success",
                                    message="Finish Export data!")
         else:
             tk.messagebox.showinfo("ERROR", message="Failed Export data!")
     else:
         self.show_log(timeOpt.get_time() + ": No result to export.")
         tk.messagebox.showerror("ERROR", message='No result to export!')
示例#5
0
 def cpe_analysis(self, status):
     try:
         uiThread.UiThread(self.check_health)
         if status[0] == 3:
             self.import_cpe_thread()
             self.xg_pre()
         elif status[0] == 2:
             compress.empty_folder(setting.post_eva_path)
             self.import_with_suite_thread()
             self.xg_pre()
             post_evaluate.main(True)
         compress.compress_result()
         self.analysis_button['state'] = NORMAL
         self.export_button['state'] = NORMAL
         self.show_log(timeOpt.get_time() +
                       ": click Export button to export the data.")
         self.THREAD_FLAG = False
     except Exception as e:
         self.THREAD_FLAG = False
         self.show_log(timeOpt.get_time() + ": Analysis failed!\n" + str(e))
         tk.messagebox.showerror("ERROR",
                                 message='Analysis failed!\n' + str(e))
         self.analysis_button['state'] = NORMAL
         self.export_button['state'] = NORMAL
示例#6
0
    def xg_pre(self):
        self.show_log(timeOpt.get_time() + ": Begin analyzing.")
        start = time.time()
        compress.decompress_cpe_data()
        end = time.time()
        result = end - start
        self.show_log(timeOpt.get_time() + ": Finish unzip cpe file.")
        self.show_log("1. unzip cpe file cost time:" + str(result) + "s")

        start = time.time()
        extract_data.extract_data()
        end = time.time()
        result = end - start
        self.show_log(timeOpt.get_time() + ": Finish extract cpe data.")
        self.show_log("2. extract cpe data cost time:" + str(result) + "s")

        start = time.time()
        day_extract.day_extract()
        end = time.time()
        result = end - start
        self.show_log(timeOpt.get_time() + ": Finish build cpe day data.")
        self.show_log("3. build cpe day data cost time:" + str(result) + "s")

        start = time.time()
        feature_build.run()
        end = time.time()
        result = end - start
        self.show_log(timeOpt.get_time() + ": Finish build cpe features data.")
        self.show_log("4. build cpe features data cost time:" + str(result) +
                      "s")

        start = time.time()
        PotXGBoost.get_xgboost_predict_result()
        end = time.time()
        result = end - start
        self.show_log(timeOpt.get_time() +
                      ": Finish predict Potentially inactive CPE.")
        self.show_log("5. predict Potentially inactive CPE cost time:" +
                      str(result) + "s")
示例#7
0
 def check_health(self):
     while self.THREAD_FLAG:
         time.sleep(60 * 5)
         self.show_log(timeOpt.get_time() + ": The tool is running ....")
     self.show_log(timeOpt.get_time() + ": The tool is stopped")
示例#8
0
 def import_cpe_thread(self):
     self.show_log(timeOpt.get_time() + ": import CPE data.")
     self.copy_data(self.cpe_entry.get(), setting.cpe_data_path)