diff --git a/apps/cli/executables/pexable/carta_envoy/carta_envoy/connect.py b/apps/cli/executables/pexable/carta_envoy/carta_envoy/connect.py index bd3b82db5bd1437c7adfa632695362d08cbfa1b9..024db47cbb060ffe6221472ce48a897837a899fc 100644 --- a/apps/cli/executables/pexable/carta_envoy/carta_envoy/connect.py +++ b/apps/cli/executables/pexable/carta_envoy/carta_envoy/connect.py @@ -289,12 +289,14 @@ class NotificationConnect: self.logger.info("Not sending notification because no user email supplied") return - self.logger.info("Removing carta url from workflow_metadata!") - send_remove_url_message = ( - f"{self.settings['workflow_url']}/workflows/carta/requests/{self.settings['wf_request_id']}/url" - ) - payload = {"carta_url": ""} - requests.post(send_remove_url_message, json=payload) + # If this is a WS CARTA request, remove the url from the metadata on session expired + if self.settings["send_ready"] == "true": + self.logger.info("Removing carta url from workflow_metadata!") + send_remove_url_message = ( + f"{self.settings['workflow_url']}/workflows/carta/requests/{self.settings['wf_request_id']}/url" + ) + payload = {"carta_url": ""} + requests.post(send_remove_url_message, json=payload) self.logger.info("Sending session expired notification!") requests.post( diff --git a/apps/cli/executables/pexable/carta_envoy/test/test_connect.py b/apps/cli/executables/pexable/carta_envoy/test/test_connect.py index 6b0e34c8c611503c405cfc459b7bc2f2e922a8ce..53ce0f895cb9d306d8c829c56f2f016f8e6b9e73 100644 --- a/apps/cli/executables/pexable/carta_envoy/test/test_connect.py +++ b/apps/cli/executables/pexable/carta_envoy/test/test_connect.py @@ -46,6 +46,7 @@ test_settings = { "workflow_url": "http://workflow:3456", "capability_url": "http://capability:3457", "wf_request_id": "-1", + "send_ready": "true", } redis_connect = RedisConnect(settings=test_settings) @@ -201,7 +202,7 @@ class TestNotificationConnect: class TestWorkflowConnect: - """Test sending CARTA URL to Workspaces systesm""" + """Test sending CARTA URL to Workspaces system""" def test_send_carta_url(self): with patch(CARTA_POST) as mocked_post: diff --git a/shared/workspaces/workspaces/workflow/message_architect.py b/shared/workspaces/workspaces/workflow/message_architect.py index bd8fe88c91aa44240a747a25a6d274858d109a06..70fb8971c71c823022b726c1973c24eed2f96535 100644 --- a/shared/workspaces/workspaces/workflow/message_architect.py +++ b/shared/workspaces/workspaces/workflow/message_architect.py @@ -78,7 +78,7 @@ workflow_msg_templates = DictView( "type": "qa-complete", }, "qa_abandon": { - "type": "qa-abandon" + "type": "qa-abandon", }, "aod_pass": { "type": "aod-pass", @@ -115,7 +115,7 @@ archive_msg_templates = DictView( "message": "seci complete", "status": "complete", }, - "qa_failed": { + "do_not_calibrate": { "logData": { "status": "FAIL", "type": "calibration", @@ -150,7 +150,7 @@ class WorkflowMessageArchitect(MessageArchitectIF): return {**service_templates["ws"], **workflow_msg_templates[msg_type]} def compose_message(self, msg_type: str) -> DictView: - if any(item in msg_type for item in ["qa_, carta"]): + if any(item in msg_type for item in ["qa_", "carta"]): service = "capability" else: service = "workflow" diff --git a/shared/workspaces/workspaces/workflow/services/workflow_service.py b/shared/workspaces/workspaces/workflow/services/workflow_service.py index de921790f7b16cca1f30d64368a4e77d7d15f29f..d64b0b3fb55c8d2efbfd55f0bf15c8ea8c28826e 100644 --- a/shared/workspaces/workspaces/workflow/services/workflow_service.py +++ b/shared/workspaces/workspaces/workflow/services/workflow_service.py @@ -252,9 +252,9 @@ class WorkflowService(WorkflowServiceIF): argument_json = json.loads(request.argument) - if request.workflow_name == 'std_calibration': + if request.workflow_name == "std_calibration": return argument_json["metadata"]["sdm_id"] - elif request.workflow_name == 'std_cms_imaging': + elif request.workflow_name == "std_cms_imaging": return argument_json["sdmId"] else: return None @@ -278,7 +278,7 @@ class WorkflowService(WorkflowServiceIF): logger.info(f"SENDING 'DO NOT CALIBRATE' MESSAGE to AAT for request #{request_id}!") dnc_msg = ArchiveMessageArchitect( routing_key="qa-script.fail", request=wf_request, sdm_id=sdm_id - ).compose_message("qa_failed") + ).compose_message("do_not_calibrate") self.archive_messenger.send_message(**dnc_msg) def execute(self, request: WorkflowRequest):