Skip to content

Commit

Permalink
New-PI credit is can now be fetched through nerc_rates
Browse files Browse the repository at this point in the history
  • Loading branch information
QuanMPhm committed Feb 4, 2025
1 parent ea023b7 commit 47db22e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions process_report/process_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,12 @@ def main():
required=False,
help="Name of csv file listing all prepay group debits. If not provided, defaults to fetching from S3",
)
parser.add_argument(
"--new-pi-credit-amount",
required=False,
type=int,
help="Amount of credit given to new PIs. If not provided, defaults to fetching from nerc-rates",
)
parser.add_argument(
"--BU-subsidy-amount",
required=False,
Expand All @@ -216,6 +222,9 @@ def main():
prepay_debits_filepath = args.prepay_debits or util.fetch_s3(
PREPAY_DEBITS_S3_FILEPATH
)
new_pi_credit_amount = args.new_pi_credit_amount or int(
util.fetch_nerc_rates("New PI Credit", invoice_month)
)
bu_subsidy_amount = args.BU_subsidy_amount or int(
util.fetch_nerc_rates("BU Subsidy", invoice_month)
)
Expand Down Expand Up @@ -269,6 +278,7 @@ def main():
invoice_month,
data=validate_billable_pi_proc.data,
old_pi_filepath=old_pi_file,
initial_credit_amount=new_pi_credit_amount,
limit_new_pi_credit_to_partners=(
util.fetch_nerc_rates(
"Limit New PI Credit to MGHPCC Partners", invoice_month
Expand Down
4 changes: 2 additions & 2 deletions process_report/processors/new_pi_credit_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ class NewPICreditProcessor(discount_processor.DiscountProcessor):
"""

NEW_PI_CREDIT_CODE = "0002"
INITIAL_CREDIT_AMOUNT = 1000
EXCLUDE_SU_TYPES = ["OpenShift GPUA100SXM4", "OpenStack GPUA100SXM4"]
IS_DISCOUNT_BY_NERC = True

old_pi_filepath: str
initial_credit_amount: int
limit_new_pi_credit_to_partners: bool = False

@staticmethod
Expand Down Expand Up @@ -117,7 +117,7 @@ def get_initial_credit_amount(
return new_pi_credit_amount

new_pi_credit_amount = get_initial_credit_amount(
old_pi_df, self.invoice_month, self.INITIAL_CREDIT_AMOUNT
old_pi_df, self.invoice_month, self.initial_credit_amount
)
logger.info(
f"New PI Credit set at {new_pi_credit_amount} for {self.invoice_month}"
Expand Down

0 comments on commit 47db22e

Please sign in to comment.