Skip to content

Commit

Permalink
Fix get_dataset_size for datasets with null file_size column
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mvdbeek committed Oct 15, 2023
1 parent 64830ed commit 1b637fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tpv/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 1b637fe

Please sign in to comment.