forked from hail-is/hail
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[batch] Update IP Fee pricing for February 2024 price increase (hail-…
…is#14190) Fixes hail-is#13784 Here's the GCP documentation: https://cloud.google.com/vpc/pricing-announce-external-ips We were previously billing the same IP-Fee for both spot and regular instances. I changed it so we're billing for each instance type accordingly. Following hail-is#13542, I hard coded the new resource rates.
- Loading branch information
Showing
5 changed files
with
75 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import os | ||
import asyncio | ||
from gear import Database, transaction, Transaction | ||
|
||
|
||
async def main(): | ||
cloud = os.environ['HAIL_CLOUD'] | ||
if cloud != 'gcp': | ||
return | ||
|
||
db = Database() | ||
await db.async_init() | ||
try: | ||
@transaction(db) | ||
async def insert(tx: Transaction): | ||
await tx.execute_many( | ||
''' | ||
INSERT INTO latest_product_versions (product, version) | ||
VALUES (%s, %s); | ||
''', | ||
[('ip-fee/preemptible/1024', '1'), | ||
('ip-fee/nonpreemptible/1024', '1')] | ||
) | ||
|
||
# https://cloud.google.com/vpc/pricing-announce-external-ips | ||
# from hailtop.utils import rate_instance_hour_to_fraction_msec | ||
# spot_ip_fee = rate_instance_hour_to_fraction_msec(0.0025, 1024) | ||
spot_ip_fee = 6.781684027777778e-13 | ||
# standard_ip_fee = rate_instance_hour_to_fraction_msec(0.005, 1024) | ||
standard_ip_fee = 1.3563368055555557e-12 | ||
|
||
await tx.execute_many( | ||
''' | ||
INSERT INTO resources (resource, rate) | ||
VALUES (%s, %s); | ||
''', | ||
[('ip-fee/preemptible/1024/1', spot_ip_fee), | ||
('ip-fee/nonpreemptible/1024/1', standard_ip_fee)] | ||
) | ||
|
||
await tx.execute_update(''' | ||
UPDATE resources | ||
SET deduped_resource_id = resource_id | ||
WHERE resource = 'ip-fee/preemptible/1024/1' OR resource = 'ip-fee/nonpreemptible/1024/1'; | ||
''') | ||
|
||
await insert() | ||
finally: | ||
await db.async_close() | ||
|
||
|
||
asyncio.run(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters