From 6d937ce36c6b99625ce1f70439ab571d1ad6a87a Mon Sep 17 00:00:00 2001 From: burnout87 Date: Fri, 20 Oct 2023 12:14:04 +0200 Subject: [PATCH 1/2] adding job_id in body message --- .../flask_app/templates/matrix_message.html | 2 +- cdci_data_analysis/pytest_fixtures.py | 16 ++++++++++++++++ tests/test_matrix_messages.py | 2 +- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/cdci_data_analysis/flask_app/templates/matrix_message.html b/cdci_data_analysis/flask_app/templates/matrix_message.html index 52a1b9216..934996204 100644 --- a/cdci_data_analysis/flask_app/templates/matrix_message.html +++ b/cdci_data_analysis/flask_app/templates/matrix_message.html @@ -1,7 +1,7 @@ Dear User,

you receive this message because at {{ request.time_request | timestamp2isot }} ( {{ request.time_request | humanize_age }} ago ) you submitted a request -for a {{ request.product_type }} from the service provided by {{ oda_site.site_name }} available at the URL {{ oda_site.frontend_url }}.
+for a {{ request.product_type }} (job_id: {{ request.job_id[:8] }}) from the service provided by {{ oda_site.site_name }} available at the URL {{ oda_site.frontend_url }}.

{% if request.status == "submitted" %} The request has been submitted, and once products will be ready, you will receive a new message.
diff --git a/cdci_data_analysis/pytest_fixtures.py b/cdci_data_analysis/pytest_fixtures.py index 3f8119714..18a0d9f30 100644 --- a/cdci_data_analysis/pytest_fixtures.py +++ b/cdci_data_analysis/pytest_fixtures.py @@ -1148,6 +1148,22 @@ class DispatcherJobState: ], } + generalized_matrix_patterns = { + 'time_request_str': [ + r'(because at )([0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}.*?)( \()', + '(requested at )(.*? .*?)( job_id:)' + ], + 'token_exp_time_str': [ + '(and will be valid until )(.*? .*?)(.
)' + ], + 'products_url': [ + '(href=")(.*?)(">url)', + ], + 'job_id': [ + '(job_id: )(.*?)(\) from)' + ], + } + ignore_patterns = [ r'\( .*?ago \)', r'"token":.*?,', diff --git a/tests/test_matrix_messages.py b/tests/test_matrix_messages.py index 7fcf81b61..3b97cc9f3 100644 --- a/tests/test_matrix_messages.py +++ b/tests/test_matrix_messages.py @@ -178,7 +178,7 @@ def get_incident_report_matrix_message(**matrix_message_args): def adapt_html(html_content, patterns=None, **matrix_message_args,): if patterns is None: - patterns = DispatcherJobState.generalized_patterns + patterns = DispatcherJobState.generalized_matrix_patterns for arg, patterns in patterns.items(): if arg in matrix_message_args and matrix_message_args[arg] is not None: for pattern in patterns: From 03a8e6e84f52b5e59c13f2c4e57db86aa26304a7 Mon Sep 17 00:00:00 2001 From: burnout87 Date: Fri, 20 Oct 2023 12:15:02 +0200 Subject: [PATCH 2/2] adding job_id in body message of references msgs --- tests/reference_matrix_messages/done.html | 2 +- tests/reference_matrix_messages/failed.html | 2 +- tests/reference_matrix_messages/submitted-dummy.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/reference_matrix_messages/done.html b/tests/reference_matrix_messages/done.html index 1377225fb..63bb68b04 100644 --- a/tests/reference_matrix_messages/done.html +++ b/tests/reference_matrix_messages/done.html @@ -1,7 +1,7 @@ Dear User,

you receive this message because at 2021-08-19 17:24:51 ( 0.0 seconds ago ) you submitted a request -for a dummy from the service provided by University of Geneva available at the URL PRODUCTS_URL.
+for a dummy (job_id: ac3f746e) from the service provided by University of Geneva available at the URL PRODUCTS_URL.

The platform have finished processing your request.
diff --git a/tests/reference_matrix_messages/failed.html b/tests/reference_matrix_messages/failed.html index f33c98411..bb8d9eacd 100644 --- a/tests/reference_matrix_messages/failed.html +++ b/tests/reference_matrix_messages/failed.html @@ -1,7 +1,7 @@ Dear User,

you receive this message because at 2021-08-19 17:24:51 ( 0.0 seconds ago ) you submitted a request -for a dummy from the service provided by University of Geneva available at the URL PRODUCTS_URL.
+for a dummy (job_id: ac3f746e) from the service provided by University of Geneva available at the URL PRODUCTS_URL.

Your request has failed. Sorry for that! You will be further contacted by our team.
diff --git a/tests/reference_matrix_messages/submitted-dummy.html b/tests/reference_matrix_messages/submitted-dummy.html index bd5730e93..9847b415f 100644 --- a/tests/reference_matrix_messages/submitted-dummy.html +++ b/tests/reference_matrix_messages/submitted-dummy.html @@ -1,7 +1,7 @@ Dear User,

you receive this message because at 2021-08-19 17:24:51 ( 0.0 seconds ago ) you submitted a request -for a dummy from the service provided by University of Geneva available at the URL PRODUCTS_URL.
+for a dummy (job_id: ac3f746e) from the service provided by University of Geneva available at the URL PRODUCTS_URL.

The request has been submitted, and once products will be ready, you will receive a new message.