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/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 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)