Skip to content

Commit

Permalink
Add exception handling to timestamp parsing (#598)
Browse files Browse the repository at this point in the history
* Change exception logic on cert upload

* Fix error logic

* Add exception handling to timestamp parse
  • Loading branch information
jboddey authored Jul 10, 2024
1 parent aadd95f commit fc5d90b
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion framework/python/src/test_orc/test_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fc5d90b

Please sign in to comment.