From 1b637fe52737bdb74948a5deec4beb5d12962920 Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 15 Oct 2023 12:21:23 +0200 Subject: [PATCH] Fix get_dataset_size for datasets with null file_size column Fixes: ``` Oct 13 14:29:40 galaxy-vgp galaxyctl[2536822]: File "/cvmfs/main.galaxyproject.org/venv/lib/python3.8/site-packages/tpv/core/helpers.py", line 16, in get_dataset_size Oct 13 14:29:40 galaxy-vgp galaxyctl[2536822]: return float(dataset.file_size) Oct 13 14:29:40 galaxy-vgp galaxyctl[2536822]: TypeError: float() argument must be a string or a number, not 'NoneType' ``` There's an underlying bug as well where the job state is final but the file size is unset, but I would always consider it better to use one abstraction level above the database column. --- tpv/core/helpers.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tpv/core/helpers.py b/tpv/core/helpers.py index 898032e..3ddf504 100644 --- a/tpv/core/helpers.py +++ b/tpv/core/helpers.py @@ -13,7 +13,9 @@ def get_dataset_size(dataset): - return float(dataset.file_size) + # calculate_size would mark file_size column as dirty + # and may have unintended consequences + return float(dataset.get_size(calculate_size=False)) def sum_total(prev, current):