From 93809eef5a840d774f74dacd98ecb91f2455e6a2 Mon Sep 17 00:00:00 2001 From: J Boddey Date: Wed, 10 Jul 2024 18:45:57 +0100 Subject: [PATCH] Add exception handling to timestamp parsing (#598) * Change exception logic on cert upload * Fix error logic * Add exception handling to timestamp parse --- framework/python/src/test_orc/test_orchestrator.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/framework/python/src/test_orc/test_orchestrator.py b/framework/python/src/test_orc/test_orchestrator.py index cb23c3a9c..d38f888a1 100644 --- a/framework/python/src/test_orc/test_orchestrator.py +++ b/framework/python/src/test_orc/test_orchestrator.py @@ -229,10 +229,18 @@ def _find_oldest_test(self, completed_tests_dir): oldest_timestamp = None oldest_directory = None for completed_test in os.listdir(completed_tests_dir): - timestamp = datetime.strptime(str(completed_test), "%Y-%m-%dT%H:%M:%S") + try: + timestamp = datetime.strptime(str(completed_test), "%Y-%m-%dT%H:%M:%S") + + # Occurs when time does not match format + except ValueError as e: + LOGGER.error(e) + continue + if oldest_timestamp is None or timestamp < oldest_timestamp: oldest_timestamp = timestamp oldest_directory = completed_test + if oldest_directory: return oldest_timestamp, os.path.join(completed_tests_dir, oldest_directory)