Skip to content

Commit

Permalink
fix: add kwargs
Browse files Browse the repository at this point in the history
Dont run the audit pipeline in error pipeline.

feat: add
  • Loading branch information
johanseto committed Jul 10, 2024
1 parent abbc564 commit 8505e35
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
21 changes: 11 additions & 10 deletions eox_nelp/pearson_vue/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,13 +616,7 @@ def get_enrollment_from_id(enrollment_id, enrollment=None, **kwargs): # pylint:
return {}


def save_audit_pipeline(
pipeline_backend,
last_step,
cdd_import=None,
ead_import=None,
**kwargs
): # pylint: disable=unused-argument
def save_audit_pipeline(pipeline_backend, last_step, cdd_import=None, ead_import=None, **kwargs):
"""This is not a pipe step, could be but its no the intention because inside a pipeline could
be more than one import. so this is a helper for pipelines.
Expand All @@ -635,14 +629,20 @@ def save_audit_pipeline(

@audit_method(action=f"Pearson Vue Pipeline Execution: {pipeline_backend}")
@rename_function(name=f"audit_pipeline_{camel_to_snake(pipeline_backend)}")
def executed_pipeline(pipeline_backend, last_step, cdd_import, ead_import):
def executed_pipeline(
pipeline_backend,
last_step,
cdd_import,
ead_import,
**kwargs
): # pylint: disable=unused-argument
logger.info(
"Pipeline %s executed until last step %s",
"Pipeline %s executed until last step: %s",
pipeline_backend,
last_step,
)
logger.info(
"Succesfull imports. cdd: %s. ead: %s",
"Succesfull imports. cdd_import: %s. ead_import: %s",
cdd_import,
ead_import,
)
Expand All @@ -652,4 +652,5 @@ def executed_pipeline(pipeline_backend, last_step, cdd_import, ead_import):
last_step=last_step,
cdd_import=cdd_import,
ead_import=ead_import,
**kwargs
)
1 change: 1 addition & 0 deletions eox_nelp/pearson_vue/rti_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ def handle_error(self, exception, failed_step_pipeline):
exception_dict=exception.to_dict(),
course_id=self.backend_data.get("course_id"),
user_id=self.backend_data.get("user_id"),
use_audit_pipeline=False,
)

def get_pipeline(self):
Expand Down
8 changes: 4 additions & 4 deletions eox_nelp/pearson_vue/tests/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,9 +1251,9 @@ def test_audit_succesfull_cdd(self):
cdd_import = {}
log_info = [
f"INFO:{pipeline.__name__}:"
f"Pipeline {pipeline_backend} executed until last step {last_step}",
f"Pipeline {pipeline_backend} executed until last step: {last_step}",
f"INFO:{pipeline.__name__}:"
f"Succesfull imports. cdd: {cdd_import}. ead: {None}",
f"Succesfull imports. cdd_import: {cdd_import}. ead_import: {None}",
]

with self.assertLogs(pipeline.__name__, level="INFO") as logs:
Expand All @@ -1276,9 +1276,9 @@ def test_audit_succesfull_ead(self):
ead_import = {}
log_info = [
f"INFO:{pipeline.__name__}:"
f"Pipeline {pipeline_backend} executed until last step {last_step}",
f"Pipeline {pipeline_backend} executed until last step: {last_step}",
f"INFO:{pipeline.__name__}:"
f"Succesfull imports. cdd: {None}. ead: {ead_import}",
f"Succesfull imports. cdd_import: {None}. ead_import: {ead_import}",
]

with self.assertLogs(pipeline.__name__, level="INFO") as logs:
Expand Down
1 change: 1 addition & 0 deletions eox_nelp/pearson_vue/tests/test_rti_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ def test_launch_validation_error_pipeline(self, pearson_error, rti_error_handler
exception_dict=pearson_error.to_dict(),
user_id=None,
course_id=None,
use_audit_pipeline=False,
)
audit_pipeline_mock.assert_not_called()

Expand Down

0 comments on commit 8505e35

Please sign in to comment.