|
10 | 10 | import parse |
11 | 11 | import rich |
12 | 12 | import typer |
13 | | -from common_library.pydantic_type_adapters import ByteSizeAdapter |
14 | 13 | from mypy_boto3_ec2.service_resource import Instance, ServiceResourceInstancesCollection |
15 | 14 | from mypy_boto3_ec2.type_defs import TagTypeDef |
16 | | -from pydantic import ByteSize, ValidationError |
| 15 | +from pydantic import ByteSize, TypeAdapter, ValidationError |
17 | 16 | from rich.progress import track |
18 | 17 | from rich.style import Style |
19 | 18 | from rich.table import Column, Table |
@@ -144,7 +143,7 @@ def _print_dynamic_instances( |
144 | 143 | f"Up: {utils.timedelta_formatting(time_now - instance.ec2_instance.launch_time, color_code=True)}", |
145 | 144 | f"ExtIP: {instance.ec2_instance.public_ip_address}", |
146 | 145 | f"IntIP: {instance.ec2_instance.private_ip_address}", |
147 | | - f"/mnt/docker(free): {utils.color_encode_with_threshold(instance.disk_space.human_readable(), instance.disk_space, ByteSizeAdapter.validate_python('15Gib'))}", |
| 146 | + f"/mnt/docker(free): {utils.color_encode_with_threshold(instance.disk_space.human_readable(), instance.disk_space, TypeAdapter(ByteSize).validate_python('15Gib'))}", |
148 | 147 | ] |
149 | 148 | ), |
150 | 149 | service_table, |
@@ -193,7 +192,7 @@ def _print_computational_clusters( |
193 | 192 | f"UserID: {cluster.primary.user_id}", |
194 | 193 | f"WalletID: {cluster.primary.wallet_id}", |
195 | 194 | f"Heartbeat: {utils.timedelta_formatting(time_now - cluster.primary.last_heartbeat) if cluster.primary.last_heartbeat else 'n/a'}", |
196 | | - f"/mnt/docker(free): {utils.color_encode_with_threshold(cluster.primary.disk_space.human_readable(), cluster.primary.disk_space, ByteSizeAdapter.validate_python('15Gib'))}", |
| 195 | + f"/mnt/docker(free): {utils.color_encode_with_threshold(cluster.primary.disk_space.human_readable(), cluster.primary.disk_space, TypeAdapter(ByteSize).validate_python('15Gib'))}", |
197 | 196 | ] |
198 | 197 | ), |
199 | 198 | "\n".join( |
@@ -236,7 +235,7 @@ def _print_computational_clusters( |
236 | 235 | f"ExtIP: {worker.ec2_instance.public_ip_address}", |
237 | 236 | f"IntIP: {worker.ec2_instance.private_ip_address}", |
238 | 237 | f"DaskWorkerIP: {worker.dask_ip}", |
239 | | - f"/mnt/docker(free): {utils.color_encode_with_threshold(worker.disk_space.human_readable(), worker.disk_space, ByteSizeAdapter.validate_python('15Gib'))}", |
| 238 | + f"/mnt/docker(free): {utils.color_encode_with_threshold(worker.disk_space.human_readable(), worker.disk_space, TypeAdapter(ByteSize).validate_python('15Gib'))}", |
240 | 239 | "", |
241 | 240 | ] |
242 | 241 | ), |
|
0 commit comments