| 336 | |
| 337 | |
| 338 | def load_trace(trace_dir: str, ignore_errors: bool = True) -> PipelineTrace: |
| 339 | try: |
| 340 | with open(os.path.join(trace_dir, TRACE_FILE_NAME), mode="rb") as f: |
| 341 | return pickle.load(f) # type: ignore |
| 342 | except FileNotFoundError: |
| 343 | # file not found return no trace |
| 344 | pass |
| 345 | except Exception as ex: |
| 346 | # we do not guarantee traces backward compat |
| 347 | if not ignore_errors: |
| 348 | raise |
| 349 | logger.warning(f"Error when loading trace at {trace_dir}: %s" % ex) |
| 350 | |
| 351 | return None |
| 352 | |
| 353 | |
| 354 | def get_trace_file_path(pipelines_dir: str, pipeline_name: str) -> str: |