From f7ba2ccafe73b6ad07caf9ebfb2f609cc0760480 Mon Sep 17 00:00:00 2001 From: Martin Guitteny <“martin.guitteny@centralesupelec.fr”> Date: Fri, 10 Oct 2025 11:26:07 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8(summary)=20add=20egress=20manifest?= =?UTF-8?q?=20in=20summary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add the possibility of getting egress manifest by sending the worker id in the notification. This will allow us to get the starting time of the recording to be able to align perfectly the metadatas and the transcription. --- src/backend/core/recording/event/notification.py | 3 +++ src/summary/summary/api/route/tasks.py | 3 ++- src/summary/summary/core/celery_worker.py | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/backend/core/recording/event/notification.py b/src/backend/core/recording/event/notification.py index 49f0d02e..240b4797 100644 --- a/src/backend/core/recording/event/notification.py +++ b/src/backend/core/recording/event/notification.py @@ -132,6 +132,8 @@ class NotificationService: logger.error("No owner found for recording %s", recording.id) return False + worker_id = recording.worker_id + payload = { "filename": recording.key, "email": owner_access.user.email, @@ -143,6 +145,7 @@ class NotificationService: "recording_time": recording.created_at.astimezone( owner_access.user.timezone ).strftime("%H:%M"), + "worker_id": worker_id, } headers = { diff --git a/src/summary/summary/api/route/tasks.py b/src/summary/summary/api/route/tasks.py index 37895e9e..de998f56 100644 --- a/src/summary/summary/api/route/tasks.py +++ b/src/summary/summary/api/route/tasks.py @@ -25,7 +25,7 @@ class TaskCreation(BaseModel): room: Optional[str] recording_date: Optional[str] recording_time: Optional[str] - + worker_id: Optional[str] router = APIRouter(prefix="/tasks") @@ -42,6 +42,7 @@ async def create_task(request: TaskCreation): request.room, request.recording_date, request.recording_time, + request.worker_id, ], queue=settings.transcribe_queue, ) diff --git a/src/summary/summary/core/celery_worker.py b/src/summary/summary/core/celery_worker.py index 622da64c..e635903b 100644 --- a/src/summary/summary/core/celery_worker.py +++ b/src/summary/summary/core/celery_worker.py @@ -313,6 +313,7 @@ def process_audio_transcribe_summarize_v2( # noqa: PLR0915 room: Optional[str], recording_date: Optional[str], recording_time: Optional[str], + worker_id: Optional[str], ): """Process an audio file by transcribing it and generating a summary. @@ -398,15 +399,28 @@ def process_audio_transcribe_summarize_v2( # noqa: PLR0915 object_name=settings.metadata_file.format(filename=file), ) + file_manifest = "recordings/"+ worker_id + ".json" + manifest_obj = minio_client.get_object( + settings.aws_storage_bucket_name, + object_name=file_manifest, + ) + logger.info("Manifest file downloaded: %s", file_manifest) + logger.info("Downloading metadata file") try: metadata_bytes = metadata_obj.read() metadata_json = json.loads(metadata_bytes.decode("utf-8")) + manifest_bytes = manifest_obj.read() + manifest_json = json.loads(manifest_bytes.decode("utf-8")) finally: metadata_obj.close() metadata_obj.release_conn() + manifest_obj.close() + manifest_obj.release_conn() + logger.info("Metadata file successfully downloaded") + logger.debug("Manifest: %s", manifest_json) formatted_transcription = ( DEFAULT_EMPTY_TRANSCRIPTION if not getattr(transcription, "segments", None)