diff --git a/cli/runners/all_pairs_cflr_tool_runner.py b/cli/runners/all_pairs_cflr_tool_runner.py index b161d21..cb8b96d 100644 --- a/cli/runners/all_pairs_cflr_tool_runner.py +++ b/cli/runners/all_pairs_cflr_tool_runner.py @@ -1,6 +1,7 @@ import re import shlex import subprocess +import traceback from abc import ABC, abstractmethod from dataclasses import dataclass from pathlib import Path @@ -67,7 +68,24 @@ def run(self) -> CflrToolRunResult: stdout=subprocess.PIPE, text=True, ) - return self.parse_results(process) + return self.safe_parse_results(process) + + def safe_parse_results(self, process: subprocess.CompletedProcess[str]) -> CflrToolRunResult: + try: + return self.parse_results(process) + except Exception: + print( + " Failed to parse results\n" + " (interpreting as incompatible CFL-r tool error)" + ) + print("=====") + print("stdout:\n" + process.stdout) + print("=====") + print("stderr:\n" + process.stderr) + print("=====") + traceback.print_exc() + print("=====") + raise IncompatibleCflrToolError() @abstractmethod def parse_results(self, process: subprocess.CompletedProcess[str]) -> CflrToolRunResult: diff --git a/cli/runners/gigascale_algo_all_pairs_cflr_tool_runner.py b/cli/runners/gigascale_algo_all_pairs_cflr_tool_runner.py index 1189e7a..d0d01ed 100644 --- a/cli/runners/gigascale_algo_all_pairs_cflr_tool_runner.py +++ b/cli/runners/gigascale_algo_all_pairs_cflr_tool_runner.py @@ -44,7 +44,7 @@ def run(self) -> CflrToolRunResult: expect eof """ ) - return self.parse_results(process) + return self.safe_parse_results(process) def parse_results(self, process: subprocess.CompletedProcess[str]) -> CflrToolRunResult: # parses a table like this: