|
7 | 7 | from aiohttp import web |
8 | 8 | from models_library.groups import GroupID |
9 | 9 | from models_library.rabbitmq_messages import ( |
| 10 | + ComputationalPipelineStatusMessage, |
10 | 11 | EventRabbitMessage, |
11 | 12 | LoggerRabbitMessage, |
12 | 13 | ProgressRabbitMessageNode, |
@@ -97,6 +98,27 @@ async def _progress_message_parser(app: web.Application, data: bytes) -> bool: |
97 | 98 | return True |
98 | 99 |
|
99 | 100 |
|
| 101 | +async def _computational_pipeline_status_message_parser( |
| 102 | + app: web.Application, data: bytes |
| 103 | +) -> bool: |
| 104 | + rabbit_message = ComputationalPipelineStatusMessage.model_validate_json(data) |
| 105 | + try: |
| 106 | + project = await _projects_service.get_project_for_user( |
| 107 | + app, |
| 108 | + f"{rabbit_message.project_id}", |
| 109 | + rabbit_message.user_id, |
| 110 | + include_state=True, |
| 111 | + ) |
| 112 | + await _projects_service.notify_project_state_update(app, project) |
| 113 | + except ProjectNotFoundError: |
| 114 | + _logger.warning( |
| 115 | + "Project %s not found for user %s", |
| 116 | + rabbit_message.project_id, |
| 117 | + rabbit_message.user_id, |
| 118 | + ) |
| 119 | + return True |
| 120 | + |
| 121 | + |
100 | 122 | async def _log_message_parser(app: web.Application, data: bytes) -> bool: |
101 | 123 | rabbit_message = LoggerRabbitMessage.model_validate_json(data) |
102 | 124 | await send_message_to_user( |
@@ -171,6 +193,11 @@ async def _osparc_credits_message_parser(app: web.Application, data: bytes) -> b |
171 | 193 | _osparc_credits_message_parser, |
172 | 194 | {"topics": []}, |
173 | 195 | ), |
| 196 | + SubcribeArgumentsTuple( |
| 197 | + ComputationalPipelineStatusMessage.get_channel_name(), |
| 198 | + _computational_pipeline_status_message_parser, |
| 199 | + {"topics": []}, |
| 200 | + ), |
174 | 201 | ) |
175 | 202 |
|
176 | 203 |
|
|
0 commit comments