diff --git a/utils/notification_service.py b/utils/notification_service.py index 9a542eb881..03bf9a43db 100644 --- a/utils/notification_service.py +++ b/utils/notification_service.py @@ -160,15 +160,18 @@ if __name__ == "__main__": results[job] = {"failed": 0, "success": 0, "time_spent": "", "failures": ""} for key, file_path in file_dict.items(): - with open(file_path.replace("[]", "stats")) as f: - failed, success, time_spent = handle_test_results(f.read()) - results[job]["failed"] += failed - results[job]["success"] += success - results[job]["time_spent"] += time_spent[1:-1] + ", " - with open(file_path.replace("[]", "summary_short")) as f: - for line in f: - if re.search("FAILED", line): - results[job]["failures"] += line + try: + with open(file_path.replace("[]", "stats")) as f: + failed, success, time_spent = handle_test_results(f.read()) + results[job]["failed"] += failed + results[job]["success"] += success + results[job]["time_spent"] += time_spent[1:-1] + ", " + with open(file_path.replace("[]", "summary_short")) as f: + for line in f: + if re.search("FAILED", line): + results[job]["failures"] += line + except FileNotFoundError: + print("Artifact was not found, job was probably canceled.") # Remove the trailing ", " results[job]["time_spent"] = results[job]["time_spent"][:-2]