Skip to content

Commit

Permalink
feat: improve audit columns pearson (#184)
Browse files Browse the repository at this point in the history
* feat: improve audit columns

* fix: order of decorator to work
  • Loading branch information
johanseto committed Jul 3, 2024
1 parent f95f96b commit 3aec238
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions eox_nelp/pearson_vue/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@
from eox_nelp.signals.utils import get_completed_and_graded

try:
from eox_audit_model.decorators import audit_method
from eox_audit_model.decorators import audit_method, rename_function
except ImportError:
def audit_method(action): # pylint: disable=unused-argument
"""Identity audit_method"""
return lambda x: x

def rename_function(name): # pylint: disable=unused-argument
"""Identity rename_function"""
return lambda x: x


logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -491,9 +495,11 @@ def audit_pearson_error(failed_step_pipeline="", exception_dict=None, **kwargs):
if not failed_step_pipeline:
failed_step_pipeline = exception_dict.get("pipe_function")

audit_action = f"Pearson Vue Exception~{exception_dict['exception_type']}"
exception_title = ' '.join(word.capitalize() for word in exception_dict['exception_type'].split('-'))
audit_action = f"Pearson Vue Exception: {exception_title}"

@audit_method(action=audit_action)
@rename_function(name=failed_step_pipeline)
def raise_audit_pearson_exception(exception_dict, failed_step_pipeline):
raise PearsonBaseError.from_dict(exception_dict)

Expand Down

0 comments on commit 3aec238

Please sign in to comment.