From 4eab1e38183f6512de8d6792339e2337dd0cec4a Mon Sep 17 00:00:00 2001 From: Claire Peters Date: Wed, 13 Dec 2023 10:22:21 -0800 Subject: [PATCH 1/2] handle nese quota rounding --- coldfront/core/allocation/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coldfront/core/allocation/models.py b/coldfront/core/allocation/models.py index 53f5b21de..8c510d821 100644 --- a/coldfront/core/allocation/models.py +++ b/coldfront/core/allocation/models.py @@ -203,7 +203,10 @@ def size(self): if self.size_exact: if 'TB' in self.get_parent_resource.quantity_label: divisor = 1099511627776 - return self.size_exact/divisor + size = self.size_exact/divisor + if 'nesetape' in self.get_parent_resource.name: + size = round(size, -1) + return size return None except TypeError: return None From c226522970cf8c17a372473ddc3acdae1c978142 Mon Sep 17 00:00:00 2001 From: Claire Peters Date: Wed, 13 Dec 2023 10:56:10 -0800 Subject: [PATCH 2/2] change tb value calculation in nese pipeline --- coldfront/plugins/fasrc/utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/coldfront/plugins/fasrc/utils.py b/coldfront/plugins/fasrc/utils.py index 1f8666657..dc2cb7af0 100644 --- a/coldfront/plugins/fasrc/utils.py +++ b/coldfront/plugins/fasrc/utils.py @@ -83,7 +83,9 @@ def produce_query_statement(self, vol_type, volumes=None): d = query_dict[vol_type] if not volumes: - volumes = [r.name.split('/')[0] for r in Resource.objects.filter(resource_type__name='Storage')] + volumes = [ + r.name.split('/')[0] for r in Resource.objects.filter(resource_type__name='Storage') + ] volumes = '|'.join(volumes) where = f"(e.{d['server']} =~ '.*({volumes}).*')" statement = { @@ -145,7 +147,7 @@ def _standardize_nesefile(self): data['storage_type'] = 'tape' data['byte_allocation'] = data['mib_capacity'] * 1048576 data['byte_usage'] = data['mib_used'] * 1048576 - data['tb_allocation'] = data['mib_capacity'] / 953674.3164 + data['tb_allocation'] = round((data['mib_capacity'] / 953674.3164), -1) data['tb_usage'] = data['mib_used'] / 953674.3164 data['fs_path'] = None data = data[[