From b0c3f64c59b5766104bdb07f3d50cc0bbdad3420 Mon Sep 17 00:00:00 2001 From: Bruno Grego Date: Tue, 16 Dec 2025 16:42:17 +0000 Subject: [PATCH] Fix save_output function --- task-runner/task_runner/task_request_handler.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/task-runner/task_runner/task_request_handler.py b/task-runner/task_runner/task_request_handler.py index d5d7c049..0a55b799 100644 --- a/task-runner/task_runner/task_request_handler.py +++ b/task-runner/task_runner/task_request_handler.py @@ -200,9 +200,9 @@ def save_output( ) -> bool: output_size_bytes = self._pack_output(output_filename=output_filename) - if output_size_bytes == 0: - return False - + # NOTE: This event is published even if the output size is 0, to + # inform the BE that the task has finished. The TaskOutputUploadFailed + # event is only published if an exception occurs during upload. self._publish_event( events.TaskOutputUploaded( id=self.task_id, @@ -212,6 +212,9 @@ def save_output( force=force, ) + if output_size_bytes == 0: + return False + # Remove the request JSON file to prevent multiple uploads # after a successful task data upload if os.path.exists(self.request_path):