Skip to content

Commit

Permalink
Add requested cpus/gpus/memory to output
Browse files Browse the repository at this point in the history
  • Loading branch information
mhemesath committed Apr 30, 2024
1 parent 8071490 commit a84952d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions omics/analyzer/omics-run-analyzer
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,7 @@ if __name__ == "__main__":
opts = docopt.docopt(__doc__)

try:
session = boto3.Session(
profile_name=opts["--profile"], region_name=opts["--region"]
)
session = boto3.Session(profile_name=opts["--profile"], region_name=opts["--region"])
pricing = session.client("pricing", region_name=PRICING_AWS_REGION)
pricing.describe_services(ServiceCode=OMICS_SERVICE_CODE)
except Exception as e:
Expand Down Expand Up @@ -433,6 +431,9 @@ if __name__ == "__main__":
"startTime",
"stopTime",
"runningSeconds",
"cpus",
"gpus",
"memory",
"sizeReserved",
"sizeMinimum",
"estimatedUSD",
Expand All @@ -451,8 +452,18 @@ if __name__ == "__main__":
"storageMaximumGiB",
"storageAverageGiB",
]

# Rename these headers for consistency
hrdrs_map = {
"cpus": "cpusRequested",
"gpus": "gpusRequested",
"memory": "memoryRequested",
}

formatted_headers = [hrdrs_map.get(h, h) for h in hdrs]

writer = csv.writer(out, lineterminator="\n")
writer.writerow(hdrs)
writer.writerow(formatted_headers)
for res in resources:
add_metrics(res, resources, pricing)
metrics = res.get("metrics", {})
Expand Down

0 comments on commit a84952d

Please sign in to comment.