@@ -41,6 +41,7 @@ class InvoiceRow:
41
41
Project_Name : str = ""
42
42
Project_ID : str = ""
43
43
PI : str = ""
44
+ Cluster_Name : str = ""
44
45
Invoice_Email : str = ""
45
46
Invoice_Address : str = ""
46
47
Institution : str = ""
@@ -190,7 +191,7 @@ def upload_to_s3(s3_endpoint, s3_bucket, file_location, invoice_month):
190
191
logger .info (f"Uploaded to { secondary_location } ." )
191
192
192
193
def handle (self , * args , ** options ):
193
- def process_invoice_row (allocation , attrs , su_name , rate ):
194
+ def process_invoice_row (allocation , attrs , su_name , rate , cluster_name ):
194
195
"""Calculate the value and write the bill using the writer."""
195
196
time = 0
196
197
for attribute in attrs :
@@ -211,6 +212,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
211
212
attributes .ALLOCATION_PROJECT_ID
212
213
),
213
214
PI = allocation .project .pi .email ,
215
+ Cluster_Name = cluster_name ,
214
216
Institution_Specific_Code = allocation .get_attribute (
215
217
attributes .ALLOCATION_INSTITUTION_SPECIFIC_CODE
216
218
)
@@ -273,6 +275,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
273
275
csv_invoice_writer .writerow (InvoiceRow .get_headers ())
274
276
275
277
for allocation in openstack_allocations :
278
+ resource_name = allocation .resources .first ().resource_type .name .lower ()
276
279
allocation_str = (
277
280
f'{ allocation .pk } of project "{ allocation .project .title } "'
278
281
)
@@ -284,9 +287,11 @@ def process_invoice_row(allocation, attrs, su_name, rate):
284
287
[attributes .QUOTA_VOLUMES_GB , attributes .QUOTA_OBJECT_GB ],
285
288
"OpenStack Storage" ,
286
289
openstack_storage_rate ,
290
+ resource_name ,
287
291
)
288
292
289
293
for allocation in openshift_allocations :
294
+ resource_name = allocation .resources .first ().resource_type .name .lower ()
290
295
allocation_str = (
291
296
f'{ allocation .pk } of project "{ allocation .project .title } "'
292
297
)
@@ -301,6 +306,7 @@ def process_invoice_row(allocation, attrs, su_name, rate):
301
306
],
302
307
"OpenShift Storage" ,
303
308
openshift_storage_rate ,
309
+ resource_name ,
304
310
)
305
311
306
312
if options ["upload_to_s3" ]:
0 commit comments