From 868b9f103edf79be2fef14a3e948c0dbea4d6ff3 Mon Sep 17 00:00:00 2001
From: Vermaas <vermaas@astron.nl>
Date: Tue, 4 Feb 2025 17:05:13 +0100
Subject: [PATCH] adapted the functionality based on review

---
 .../services/specification/input_validation.py             | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/atdb/taskdatabase/services/specification/input_validation.py b/atdb/taskdatabase/services/specification/input_validation.py
index 070c5392..4acbff89 100644
--- a/atdb/taskdatabase/services/specification/input_validation.py
+++ b/atdb/taskdatabase/services/specification/input_validation.py
@@ -88,6 +88,10 @@ def recalculate_size(data):
     Operators or ATDB could have removed files from the inputs json blob.
     If that has happened, the task.size_to_process needs to be recalculated
     """
+    if not data:
+        # tasks without inputs should just return
+        return None
+
     logger.info(f'recalculate_size')
     new_size = sum([e["size"] for e in data])
     return new_size
@@ -116,4 +120,5 @@ def validate_inputs(task):
 
     # --- recalculate sizes ---
     size_to_process = recalculate_size(task.inputs)
-    task.size_to_process = size_to_process
\ No newline at end of file
+    if size_to_process:
+        task.size_to_process = size_to_process
\ No newline at end of file
-- 
GitLab