Given a list of containers, each {"cpu": str, "memory": str} (Kubernetes quantities), return
{"cpu_millicores": int, "memory_bytes": int} with the totals.
CPU: "250m" is 250 millicores, "2" or "0.5" are cores (× 1000).
Memory: plain bytes "1000", binary suffixes Ki Mi Gi Ti (powers of 1024) and decimal suffixes
k M G T (powers of 1000). Round CPU to the nearest millicore.
Implement total_requests. Input: containers: list[dict]. Returns: dict[str, int].
def total_requests(containers: list[dict]) -> dict[str, int]:
return {"cpu_millicores": 0, "memory_bytes": 0}
Run executes the public tests. Submit grades against public and hidden tests.
Given a list of containers, each {"cpu": str, "memory": str} (Kubernetes quantities), return
{"cpu_millicores": int, "memory_bytes": int} with the totals.
CPU: "250m" is 250 millicores, "2" or "0.5" are cores (× 1000).
Memory: plain bytes "1000", binary suffixes Ki Mi Gi Ti (powers of 1024) and decimal suffixes
k M G T (powers of 1000). Round CPU to the nearest millicore.
Implement total_requests. Input: containers: list[dict]. Returns: dict[str, int].
def total_requests(containers: list[dict]) -> dict[str, int]:
return {"cpu_millicores": 0, "memory_bytes": 0}
Run executes the public tests. Submit grades against public and hidden tests.