feat(cli): expose new cluster SDK parameters#378
Conversation
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
| response = await show_loading_status( | ||
| "Loading storage volumes...", | ||
| config.client.beta.clusters.storage.list(project_id=project_id or omit), | ||
| ) |
| cluster_id=cluster_id, | ||
| mode=safe_modes or omit, | ||
| order_by=order_by or omit, | ||
| page_size=page_size if page_size is not None else omit, |
|
|
||
| async def list( | ||
| after: AfterParameter = None, | ||
| project_id: Annotated[Optional[str], Parameter(help="Project ID to filter clusters by")] = None, |
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
blainekasten
left a comment
There was a problem hiding this comment.
@cursoragent let's not add add_ons and cluster_config to the cli yet. This needs more thought.
|
Done.
Verified: .venv/bin/python -m ruff check ...
.venv/bin/python -m pytest tests/cli/test_beta_clusters.pyResult: |
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
| shared_volume_name: SharedVolumeNameParameter = None, | ||
| shared_volume_region: SharedVolumeRegionParameter = None, | ||
| shared_volume_size_tib: SharedVolumeSizeTibParameter = None, | ||
| shared_volume_lifecycle_independent: SharedVolumeLifecycleIndependentParameter = None, |
There was a problem hiding this comment.
@cursoragent Drop these parameters since the cli has a helper flow or users can attach the volume id for a previously created one
| num_capacity_pool_gpus: NumCapacityPoolGpusParameter = None, | ||
| num_preemptible_gpus: NumPreemptibleGpusParameter = None, | ||
| num_reserved_gpus: NumReservedGpusParameter = None, | ||
| oidc_config: OidcConfigParameter = None, |
| gpu_type: GpuTypeParameter = None, | ||
| cluster_type: ClusterTypeParameter = None, | ||
| volume: VolumeParameter = None, | ||
| acceptance_tests_params: AcceptanceTestsParamsParameter = None, |
There was a problem hiding this comment.
Done.
- Removed
--shared-volume-name - Removed
--shared-volume-region - Removed
--shared-volume-size-tib - Removed
--shared-volume-lifecycle-independent - Removed non-interactive inline
shared_volumerequest mapping - Kept the interactive helper flow / existing
--volumepath - Pushed commit:
7b02fa7d fix(cli): drop inline shared volume create flags
Verified:
.venv/bin/python -m ruff check ...
.venv/bin/python -m ruff format --check src/together/lib/cli/api/beta/clusters/create.py tests/cli/test_beta_clusters.py
.venv/bin/pyright --pythonpath .venv/bin/python src/together/lib/cli/api/beta/clusters/_json_params.py src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py
.venv/bin/python -m pytest tests/cli/test_beta_clusters.pyResult: 26 passed
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
| is_lifecycle_independent = input( | ||
| "Clusters: Keep storage volume after cluster deletion? [y/N] " | ||
| ).strip().lower() in ("y", "yes") | ||
| params["shared_volume"] = _shared_volume( |
There was a problem hiding this comment.
@cursoragent I don't think we need this helper function. Seems like we can revert back to just instantiating a SharedVolume, right?
There was a problem hiding this comment.
Done.
- Removed
_shared_volume - Reverted interactive storage helper flow to direct
SharedVolume(...) - Removed the extra lifecycle-independent prompt tied to that helper
- Pushed commit:
2aa68755 fix(cli): inline cluster shared volume creation
Verified:
.venv/bin/python -m ruff check ...
.venv/bin/python -m ruff format --check src/together/lib/cli/api/beta/clusters/create.py tests/cli/test_beta_clusters.py
.venv/bin/pyright --pythonpath .venv/bin/python src/together/lib/cli/api/beta/clusters/_json_params.py src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py
.venv/bin/python -m pytest tests/cli/test_beta_clusters.pyResult: 26 passed
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
| try: | ||
| return json.loads(value) | ||
| except json.JSONDecodeError as exc: | ||
| raise ValueError(f"{parameter_name} must be valid JSON") from exc |
There was a problem hiding this comment.
@cursoragent I don't think anything in this file is still being used. Can you check and if it's not just remove this file?
There was a problem hiding this comment.
Done.
- Confirmed
_json_params.pyhad no remaining external references - Deleted
src/together/lib/cli/api/beta/clusters/_json_params.py - Confirmed no
_json_params,parse_json_object, orparse_json_arrayrefs remain - Pushed commit:
0a2316ce fix(cli): remove unused JSON param helpers
Verified:
.venv/bin/python -m ruff check src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py src/together/lib/cli/api/beta/clusters/list.py src/together/lib/cli/api/beta/clusters/storage/create.py src/together/lib/cli/api/beta/clusters/storage/update.py src/together/lib/cli/api/beta/clusters/storage/list.py src/together/lib/cli/api/beta/clusters/remediations/list.py tests/cli/test_beta_clusters.py
.venv/bin/python -m ruff format --check src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py tests/cli/test_beta_clusters.py
.venv/bin/pyright --pythonpath .venv/bin/python src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py
.venv/bin/python -m pytest tests/cli/test_beta_clusters.pyResult: 26 passed
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
| VolumeParameter = Annotated[Optional[str], Parameter(help="Storage volume ID to use for the cluster")] | ||
| AutoScaleParameter = Annotated[Optional[bool], Parameter(help="Enable cluster auto-scaling")] | ||
| AutoScaleMaxGpusParameter = Annotated[Optional[int], Parameter(help="Maximum GPUs for auto-scaling")] | ||
| AutoScaledParameter = Annotated[Optional[bool], Parameter(help="Enable workload-based GPU auto-scaling")] |
There was a problem hiding this comment.
@cursoragent This field was marked as deprecated. We shouldn't add it. Remove it
There was a problem hiding this comment.
Done.
- Removed deprecated
auto_scaled/--auto-scaledfrom cluster create - Removed its request mapping
- Confirmed no
auto_scaleddiff remains - Pushed commit:
935060d9 fix(cli): omit deprecated auto-scaled flag
Verified:
.venv/bin/python -m ruff check ...
.venv/bin/python -m ruff format --check src/together/lib/cli/api/beta/clusters/create.py tests/cli/test_beta_clusters.py
.venv/bin/pyright --pythonpath .venv/bin/python src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py
.venv/bin/python -m pytest tests/cli/test_beta_clusters.pyResult: 26 passed
Co-authored-by: Blaine Kasten <blainekasten@gmail.com>


Summary
Testing
python3 -m ruff check src/together/lib/cli/api/beta/clusters/_json_params.py src/together/lib/cli/api/beta/clusters/create.py src/together/lib/cli/api/beta/clusters/update.py src/together/lib/cli/api/beta/clusters/list.py src/together/lib/cli/api/beta/clusters/storage/create.py src/together/lib/cli/api/beta/clusters/storage/update.py src/together/lib/cli/api/beta/clusters/storage/list.py src/together/lib/cli/api/beta/clusters/remediations/list.py tests/cli/test_beta_clusters.pypython3 -m pytest tests/cli/test_beta_clusters.pyTarget base branch:
next(do not retarget tomain).Requested reviewers: @blainekasten,
stainless-app[bot](incoming commit author).