diff --git a/CheckInGUI/PythonFiles/Data/DBSender.py b/CheckInGUI/PythonFiles/Data/DBSender.py index 29d6adaa..96f757d7 100644 --- a/CheckInGUI/PythonFiles/Data/DBSender.py +++ b/CheckInGUI/PythonFiles/Data/DBSender.py @@ -94,7 +94,11 @@ def get_usernames(self): # Whether or not DB has passing results def get_previous_test_results(self, full_id): - r = requests.post('{}/get_previous_test_results.py'.format(self.db_url), data={'full_id': str(full_id)}) + try: + r = requests.post('{}/get_previous_test_results.py'.format(self.db_url), data={'full_id': str(full_id)}, timeout=10) + except requests.exceptions.RequestException as e: + logger.error("get_previous_test_results.py request failed (%s); treating board as having no prior results.", e) + return [], [] lines = r.text.split('\n') try: @@ -104,9 +108,10 @@ def get_previous_test_results(self, full_id): end2 = lines.index("End2") begin3 = lines.index("Begin3") + 1 end3 = lines.index("End3") - except: - logger.error("There was an issue with the web API script `get_previous_test_results.py`. There is likely a syntax error in an associated web API script.") + except ValueError: + logger.error("There was an issue with the web API script `get_previous_test_results.py` (no Begin/End markers in response); treating board as having no prior results.") logger.debug(r.text) + return [], [] tests_run = [] outcomes = [] diff --git a/CheckInGUI/PythonFiles/Data/DataHolder.py b/CheckInGUI/PythonFiles/Data/DataHolder.py index 3f693dd9..70626a04 100644 --- a/CheckInGUI/PythonFiles/Data/DataHolder.py +++ b/CheckInGUI/PythonFiles/Data/DataHolder.py @@ -170,6 +170,8 @@ def send_to_DB(self): info_dict = {"full_id":self.get_full_ID(),"tester": self.data_dict['user_ID'], "test_type": test_name, "successful": self.data_dict["inspection_pass"], "comments": self.data_dict['comments']} logger.debug(info_dict) + os.makedirs("{}/JSONFiles".format(PythonFiles.__path__[0]), exist_ok=True) + with open("{}/JSONFiles/storage.json".format(PythonFiles.__path__[0]), "w") as outfile: json.dump(info_dict, outfile) diff --git a/Configs/WM_cfg.yaml b/Configs/WM_cfg.yaml index e6b47afa..0036e6c8 100644 --- a/Configs/WM_cfg.yaml +++ b/Configs/WM_cfg.yaml @@ -1,7 +1,7 @@ --- DBInfo: admin: FactoryInserter - baseURL: http://128.186.110.114/Factory/mbDB + baseURL: http://phy-k619lf-a.hep.fsu.edu/Factory/mbDB inserter: FactoryInserter name: mbdb reader: FactoryReadUser