From cbb4083ff3be36b425e152e341f703a06a20d888 Mon Sep 17 00:00:00 2001 From: sujata-m Date: Mon, 23 Dec 2024 14:02:31 +0530 Subject: [PATCH 1/2] Fixed task 1564 and 1566 - [1564](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/1564/) - Added a package object in response which contains custom package name and version - [1566](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/1566/) - Updated readme for env variable details --- README.md | 3 ++- src/service/osw_formatter_service.py | 23 +++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ad33ff2..17e1dcb 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,14 @@ The project is built on Python with FastAPI framework. All the regular nuances f - Connecting this to cloud will need the following in the `.env` file ```bash +PROVIDER=Azure QUEUECONNECTION=xxx STORAGECONNECTION=xxx FORMATTER_TOPIC=xxx FORMATTER_SUBSCRIPTION=xxx FORMATTER_UPLOAD_TOPIC=xxx CONTAINER_NAME=xxx -MAX_CONCURRENT_MESSAGES=xx +MAX_CONCURRENT_MESSAGES=xx # Optional if not passed defaults to 2 ``` The application connect with the `STORAGECONNECTION` string provided in `.env` file and validates downloaded zipfile using `python-osw-validation` package. diff --git a/src/service/osw_formatter_service.py b/src/service/osw_formatter_service.py index b9d9ff8..239c673 100644 --- a/src/service/osw_formatter_service.py +++ b/src/service/osw_formatter_service.py @@ -17,6 +17,7 @@ ) from python_ms_core.core.queue.models.queue_message import QueueMessage import threading +import osm_osw_reformatter logging.basicConfig() logger = logging.getLogger("OSW_FORMATTER") @@ -173,11 +174,18 @@ def send_status(self, result: ValidationResult, upload_message: OSWValidationMes upload_message.data.message = result.validation_message if upload_url: upload_message.data.formatted_url = upload_url + + resp_data = upload_message.data.to_json() + resp_data['package'] = { + 'python-ms-core': Core.__version__, + 'osm-osw-reformatter': osm_osw_reformatter.__version__ + + } data = QueueMessage.data_from( { - "messageId": upload_message.message_id, - "messageType": upload_message.message_type, - "data": upload_message.data.to_json(), + 'messageId': upload_message.message_id, + 'messageType': upload_message.message_type, + 'data': resp_data } ) try: @@ -252,10 +260,17 @@ def process_on_demand_format(self, request: OSWOnDemandRequest): def send_on_demand_response(self, response: OSWOnDemandResponse): logger.info(f"Sending response for {response.data.jobId}") + resp_data = asdict(response.data) + resp_data['package'] = { + 'python-ms-core': Core.__version__, + 'osm-osw-reformatter': osm_osw_reformatter.__version__ + + } + data = QueueMessage.data_from({ "messageId": response.messageId, "messageType": response.messageType, - 'data': asdict(response.data) + 'data': resp_data }) publishing_topic_name = self._settings.event_bus.formatter_topic or "" publishing_topic = self.core.get_topic(topic_name=publishing_topic_name) From 6bbefde0f82b362caae42c929b1e8fd7158917fa Mon Sep 17 00:00:00 2001 From: sujata-m Date: Wed, 18 Jun 2025 10:14:25 +0530 Subject: [PATCH 2/2] Fixed task 1654 and 2040 - Fixed [1654](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/1654) - Added functionality to retain the ext tags - Fixed [2040](https://dev.azure.com/TDEI-UW/TDEI/_workitems/edit/2040) - Removing the width tag if the width is not float or integer --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 58f1ab5..1eea4f3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,5 +3,5 @@ pydantic==1.10.4 python-ms-core==0.0.23 uvicorn==0.20.0 html_testRunner==1.2.1 -osm-osw-reformatter==0.2.6 +osm-osw-reformatter==0.2.8 numpy==1.26.4 \ No newline at end of file