perf: [PRODUCT-576] refactor sf nodes to use GET v1/nodes/list?names=... #180
Conversation
Changed Files
|
|
Cursor Agent can help with this pull request. Just |
Co-authored-by: danieltaox <danieltaox@gmail.com>
def202f to
09878ca
Compare
sf nodes get/show, fix sf nodes extend, improve performance of sf nodes
… is passed (#184) Co-authored-by: danieltaox <danieltaox@gmail.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: GitHub Actions <github-actions[bot]@users.noreply.github.com>
…194) Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Without the duration and name the command will fail when users try to copy paste it. nodes/create: highlight --user-data-file in examples
sf nodes get/show, fix sf nodes extend, improve performance of sf nodessf nodes to use GET v1/nodes/list?names=...
There was a problem hiding this comment.
Greptile Summary
This PR implements a significant refactoring of the SFCompute CLI to optimize node operations and expand VM management capabilities. The core change involves moving from client-side filtering (fetching all nodes, then filtering locally) to server-side filtering using the API's names parameter (GET v1/nodes/list?names=...). This optimization is applied across multiple node commands including set, release, and extend.
The PR also introduces a new sf nodes get command that allows users to retrieve detailed information about specific nodes by name, leveraging the same API filtering for efficient data retrieval. The extend functionality has been made more resilient by fixing assumptions about extension timing and improving error handling for auto-reserved nodes.
Expanding the VM management suite, the PR adds comprehensive VM image management commands (sf vm images list/upload/show) behind the custom-vm-images feature flag, along with new VM operations like sf vm logs, sf vm replace, and sf vm script. The VM module has been restructured from a monolithic 477-line file into a modular directory structure with separate files for each command.
Additional enhancements include cloud-init user data support in node creation, multipart upload functionality for VM images with progress tracking and retry mechanisms, and various UI improvements like better error handling and more informative output formatting. The schema has been updated to remove admin-specific endpoints while adding new VM image management endpoints.
Confidence score: 2/5
- This PR contains several critical issues including potential runtime crashes and broken functionality that require immediate attention before merging
- Score lowered due to a critical bug in
src/lib/nodes/release.tsthat removes ID-based node lookup, potential runtime crash insrc/lib/vm/list.ts, and magic numbers that should be extracted as constants - Pay close attention to
src/lib/nodes/release.ts,src/lib/vm/list.ts, andsrc/lib/vm/image/upload.ts
Context used:
Rule - Extract magic numbers into named constants at the top of files with documentation comments explaining their purpose and units. (link)
23 files reviewed, 12 comments
sf nodes to use GET v1/nodes/list?names=... sf nodes to use GET v1/nodes/list?names=...
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Refactor
sf nodes set,release,extendto use API filtering and addsf nodes getfor efficient node retrieval.Also fixes
sf extendwhich erroneously assumes users will always extend fromNOW. Makes the code forsf extendmore resilient in general.Adds
sf nodes show/get.