Skip to content

Commit

Permalink
fix(metahyper): Print useful information in logs for exception occuring
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiebergman committed Jan 27, 2024
1 parent 8a0ebd8 commit a3df344
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions neps/metahyper/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
import shutil
import time
import traceback
import warnings
from abc import ABC, abstractmethod
from contextlib import contextmanager
Expand Down Expand Up @@ -383,10 +384,15 @@ def _evaluate_config(
)
directory_params.append(previous_pipeline_directory)

result = evaluation_fn(
*directory_params,
**config,
)
try:
result = evaluation_fn(
*directory_params,
**config,
)
except Exception as e:
tb = traceback.format_exc()
logger.exception(f"{type(e).__name__}: {e}\n{tb}")
raise e

# Ensuring the result have the correct format that can be exploited by other functions
if isinstance(result, dict):
Expand Down

0 comments on commit a3df344

Please sign in to comment.