From b6b10b665bf75356f05ee5f517a39018ea2ab12c Mon Sep 17 00:00:00 2001 From: CaptainOfHacks <39195263+CaptainOfHacks@users.noreply.github.com> Date: Mon, 25 Sep 2023 22:28:26 +0300 Subject: [PATCH] wip --- dags/operators/DagBatchPipelineOperator.py | 2 +- dags/pipelines/notice_processor_pipelines.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dags/operators/DagBatchPipelineOperator.py b/dags/operators/DagBatchPipelineOperator.py index cab07c58..f8780118 100644 --- a/dags/operators/DagBatchPipelineOperator.py +++ b/dags/operators/DagBatchPipelineOperator.py @@ -82,7 +82,7 @@ def single_notice_processor(self, notice_id: str, notice_repository: NoticeRepos print("ERROR MESSAGE: ", error_message) except Exception as exception_error_message: error_message = str(exception_error_message) - if error_message: + if error_message is not None: notice_normalised_metadata = notice.normalised_metadata if notice else None log_notice_error(message=error_message, notice_id=notice_id, domain_action=pipeline_name, notice_form_number=notice_normalised_metadata.form_number if notice_normalised_metadata else None, diff --git a/dags/pipelines/notice_processor_pipelines.py b/dags/pipelines/notice_processor_pipelines.py index a8d57ece..be8d0230 100644 --- a/dags/pipelines/notice_processor_pipelines.py +++ b/dags/pipelines/notice_processor_pipelines.py @@ -17,8 +17,11 @@ def notice_normalisation_pipeline(notice: Notice, mongodb_client: MongoClient = indexed_notice = index_notice(notice=notice) try: normalised_notice = normalise_notice(notice=indexed_notice) + normalised_notice.update_status_to(new_status=NoticeStatus.NORMALISED_METADATA) + print("Notice normalisation pipeline succes: ", normalised_notice.ted_id) return NoticePipelineOutput(notice=normalised_notice) except Exception as error_message: + print("Notice normalisation pipeline error: ", normalised_notice.ted_id) return NoticePipelineOutput(notice=indexed_notice, processed=False, store_result=True, error_message=str(error_message))