88from process_report import util
99from process_report .settings import invoice_settings
1010
11+ # List of service invoices processed by pipeline. Change if new services are added.
12+ S3_SERVICE_INVOICE_LIST = [
13+ "ocp-test {invoice_month}.csv" ,
14+ "ocp-prod {invoice_month}.csv" ,
15+ "academic {invoice_month}.csv" ,
16+ "NERC OpenStack {invoice_month}.csv" ,
17+ "NERC Storage {invoice_month}.csv" ,
18+ ]
19+
1120
1221@functools .lru_cache
1322def get_rates_info ():
@@ -22,14 +31,15 @@ def get_csv_invoice_filepath_list(self) -> list[str]:
2231 if invoice_settings .fetch_from_s3 :
2332 s3_bucket = util .get_invoice_bucket ()
2433
25- for obj in s3_bucket .objects .filter (
26- Prefix = invoice_settings .invoice_path_template .format (
34+ for invoice_name_template in S3_SERVICE_INVOICE_LIST :
35+ local_name = invoice_name_template .format (
36+ invoice_month = invoice_settings .invoice_month
37+ )
38+ s3_name = (invoice_settings .invoice_path_template + local_name ).format (
2739 invoice_month = invoice_settings .invoice_month
2840 )
29- ):
30- local_name = obj .key .split ("/" )[- 1 ]
3141 csv_invoice_filepath_list .append (local_name )
32- s3_bucket .download_file (obj . key , local_name )
42+ s3_bucket .download_file (s3_name , local_name )
3343 else :
3444 invoice_dir_path = invoice_settings .invoice_path_template .format (
3545 invoice_month = invoice_settings .invoice_month
0 commit comments