diff --git a/csst_common/pipeline.py b/csst_common/pipeline.py index bc17d47c028881286fbad3c1dc7c339b113f988a..92f122c52e312157d3b4704b1107022d5ecb2ea7 100644 --- a/csst_common/pipeline.py +++ b/csst_common/pipeline.py @@ -54,6 +54,7 @@ class Pipeline: self.message = Message(os.path.join(self.dir_out, "msg.txt")) self.time_stamp = TimeStamp(os.path.join(self.dir_out, "time_stamp.txt")) self.exit_code = ExitCode(os.path.join(self.dir_out, "exit_code")) + self.error_trace = ErrorTrace(os.path.join(self.dir_out, "error_trace")) if dfs: self.dfs = DFS(n_try=5) @@ -101,6 +102,18 @@ class Pipeline: warnings.resetwarnings() +class ErrorTrace: + def __init__(self, file_path=""): + self.file_path = file_path + + def __repr__(self): + return f"< ErrorTrace [{self.file_path}] >" + + def write(self, s: str): + with open(self.file_path, "w+") as f: + f.write(s) + + class Message: def __init__(self, file_path=""): self.file_path = file_path