|
45 | 45 | NodeRequirements,
|
46 | 46 | TrustedExecutionEnvironment,
|
47 | 47 | )
|
48 |
| -from aleph_message.models.execution.volume import PersistentVolumeSizeMib |
| 48 | +from aleph_message.models.execution.volume import PersistentVolume |
49 | 49 | from aleph_message.models.item_hash import ItemHash
|
| 50 | +from aleph_message.utils import Gigabytes |
50 | 51 | from click import echo
|
51 | 52 | from rich import box
|
52 | 53 | from rich.console import Console
|
|
71 | 72 | filter_only_valid_messages,
|
72 | 73 | find_sevctl_or_exit,
|
73 | 74 | found_gpus_by_model,
|
| 75 | + get_field_constraints, |
74 | 76 | get_or_prompt_volumes,
|
75 | 77 | setup_logging,
|
76 | 78 | str_to_datetime,
|
|
91 | 93 | metavar_valid_chains = f"[{'|'.join(hold_chains)}]"
|
92 | 94 | super_token_chains = get_chains_with_super_token()
|
93 | 95 | metavar_valid_payg_chains = f"[{'|'.join(super_token_chains)}]"
|
| 96 | +_, max_rootfs_size = get_field_constraints(PersistentVolume, "size_mib", Gigabytes(2048), 0) |
94 | 97 |
|
95 | 98 |
|
96 | 99 | @app.command()
|
@@ -118,9 +121,7 @@ async def create(
|
118 | 121 | compute_units: Annotated[Optional[int], typer.Option(help=help_strings.COMPUTE_UNITS)] = None,
|
119 | 122 | vcpus: Annotated[Optional[int], typer.Option(help=help_strings.VCPUS)] = None,
|
120 | 123 | memory: Annotated[Optional[int], typer.Option(help=help_strings.MEMORY)] = None,
|
121 |
| - rootfs_size: Annotated[ |
122 |
| - Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=PersistentVolumeSizeMib.le) |
123 |
| - ] = None, |
| 124 | + rootfs_size: Annotated[Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=max_rootfs_size)] = None, |
124 | 125 | timeout_seconds: Annotated[float, typer.Option(help=help_strings.TIMEOUT_SECONDS)] = settings.DEFAULT_VM_TIMEOUT,
|
125 | 126 | ssh_pubkey_file: Annotated[Path, typer.Option(help=help_strings.SSH_PUBKEY_FILE)] = Path(
|
126 | 127 | "~/.ssh/id_rsa.pub"
|
@@ -341,7 +342,7 @@ async def create(
|
341 | 342 | disk_size_info = f"Rootfs Size: {round(disk_size/1024, 2)} GiB (defaulted to included storage in tier)"
|
342 | 343 | if not isinstance(rootfs_size, int):
|
343 | 344 | rootfs_size = validated_int_prompt(
|
344 |
| - "Custom Rootfs Size (MiB)", min_value=disk_size, max_value=PersistentVolumeSizeMib.le, default=disk_size |
| 345 | + "Custom Rootfs Size (MiB)", min_value=disk_size, max_value=max_rootfs_size, default=disk_size |
345 | 346 | )
|
346 | 347 | if rootfs_size > disk_size:
|
347 | 348 | disk_size = rootfs_size
|
@@ -1197,7 +1198,6 @@ async def confidential_init_session(
|
1197 | 1198 |
|
1198 | 1199 | # Generate sessions certificate files
|
1199 | 1200 | if not ((session_dir / "vm_godh.b64").exists() and keep_session):
|
1200 |
| - |
1201 | 1201 | code, platform_file = await client.get_certificates()
|
1202 | 1202 | if code != 200:
|
1203 | 1203 | echo(
|
@@ -1367,9 +1367,7 @@ async def confidential_create(
|
1367 | 1367 | compute_units: Annotated[Optional[int], typer.Option(help=help_strings.COMPUTE_UNITS)] = None,
|
1368 | 1368 | vcpus: Annotated[Optional[int], typer.Option(help=help_strings.VCPUS)] = None,
|
1369 | 1369 | memory: Annotated[Optional[int], typer.Option(help=help_strings.MEMORY)] = None,
|
1370 |
| - rootfs_size: Annotated[ |
1371 |
| - Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=PersistentVolumeSizeMib.le) |
1372 |
| - ] = None, |
| 1370 | + rootfs_size: Annotated[Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=max_rootfs_size)] = None, |
1373 | 1371 | timeout_seconds: Annotated[float, typer.Option(help=help_strings.TIMEOUT_SECONDS)] = settings.DEFAULT_VM_TIMEOUT,
|
1374 | 1372 | ssh_pubkey_file: Annotated[Path, typer.Option(help=help_strings.SSH_PUBKEY_FILE)] = Path(
|
1375 | 1373 | "~/.ssh/id_rsa.pub"
|
@@ -1515,9 +1513,7 @@ async def gpu_create(
|
1515 | 1513 | compute_units: Annotated[Optional[int], typer.Option(help=help_strings.COMPUTE_UNITS)] = None,
|
1516 | 1514 | vcpus: Annotated[Optional[int], typer.Option(help=help_strings.VCPUS)] = None,
|
1517 | 1515 | memory: Annotated[Optional[int], typer.Option(help=help_strings.MEMORY)] = None,
|
1518 |
| - rootfs_size: Annotated[ |
1519 |
| - Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=PersistentVolumeSizeMib.le) |
1520 |
| - ] = None, |
| 1516 | + rootfs_size: Annotated[Optional[int], typer.Option(help=help_strings.ROOTFS_SIZE, max=max_rootfs_size)] = None, |
1521 | 1517 | premium: Annotated[Optional[bool], typer.Option(help=help_strings.GPU_PREMIUM_OPTION)] = None,
|
1522 | 1518 | timeout_seconds: Annotated[float, typer.Option(help=help_strings.TIMEOUT_SECONDS)] = settings.DEFAULT_VM_TIMEOUT,
|
1523 | 1519 | ssh_pubkey_file: Annotated[Path, typer.Option(help=help_strings.SSH_PUBKEY_FILE)] = Path(
|
|
0 commit comments