Skip to content

Commit

Permalink
Merge pull request #35 from awslabs/add-requested-resources
Browse files Browse the repository at this point in the history
Add requested cpus/gpus/memory to output
  • Loading branch information
wleepang authored Apr 30, 2024
2 parents 8071490 + 55b3787 commit ac56399
Show file tree
Hide file tree
Showing 3 changed files with 454 additions and 387 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
Loading

0 comments on commit ac56399

Please sign in to comment.