Skip to content

Commit 7b5027f

Browse files
committed
refactor: enhance describe and get commands for improved resource detail retrieval and filtering
1 parent 9f7db0c commit 7b5027f

File tree

4 files changed

+378
-150
lines changed

4 files changed

+378
-150
lines changed

README.md

Lines changed: 42 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# SGS - SNUCSE GPU Service CLI
22

3-
[![Go Version](https://img.shields.io/badge/Go-1.25+-00ADD8?style=flat&logo=go)](https://go.dev)
43
[![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
54

65
A command line interface for SNUCSE GPU Service. It provides a VM-like experience for GPU computing on Kubernetes, abstracting away Kubernetes complexity.
@@ -11,29 +10,6 @@ A command line interface for SNUCSE GPU Service. It provides a VM-like experienc
1110
- **Simple Interface**: Only three concepts - nodes, volumes, and sessions
1211
- **Workspace Management**: Namespace-based workspace isolation and resource quota management, shared with multiple users
1312

14-
## Project Structure
15-
16-
```text
17-
sgs-cli/
18-
├── cmd/
19-
│ └── sgs/ # Application entry point
20-
│ └── main.go
21-
├── internal/ # Private application code
22-
│ ├── cleanup/ # Interrupt handling and cleanup registry
23-
│ ├── client/ # Kubernetes client with retry logic
24-
│ ├── cmd/ # CLI commands (Cobra)
25-
│ ├── node/ # Node operations
26-
│ ├── session/ # Session operations
27-
│ ├── sgs/ # Shared configuration and constants
28-
│ ├── user/ # User identity from OIDC tokens
29-
│ ├── volume/ # Volume and session management
30-
│ └── workspace/ # Workspace operations
31-
├── go.mod
32-
├── go.sum
33-
├── Makefile
34-
└── README.md
35-
```
36-
3713
## Configuration
3814

3915
SGS CLI downloads configuration files to `~/.sgs/` on first run or when `sgs fetch` is executed:
@@ -46,7 +22,6 @@ The configuration is automatically refreshed if more than 7 days have passed sin
4622

4723
## Prerequisites
4824

49-
- Go 1.25 or higher
5025
- Access to SNUCSE GPU Service
5126

5227
## Installation
@@ -75,6 +50,8 @@ Download binaries directly from [GitHub Releases](https://github.com/bacchus-snu
7550

7651
### From Source
7752

53+
Requires Go 1.25 or higher.
54+
7855
```bash
7956
git clone https://github.com/bacchus-snu/sgs-cli.git
8057
cd sgs-cli
@@ -144,44 +121,63 @@ sgs create volume ferrari/os-volume --image pytorch/pytorch:2.0.0-cuda11.7-cudnn
144121
# Create a data volume (storage only)
145122
sgs create volume ferrari/data-vol --size 100Gi
146123

147-
# Copy a volume (same or different node)
124+
# Copy entire volume (same or different node)
148125
sgs cp ferrari/os-volume porsche/os-volume
149126

127+
# Copy files/directories between volumes
128+
sgs cp ferrari/data:/datasets/mnist porsche/data:/datasets/
129+
150130
# Delete a volume
151131
sgs delete volume ferrari/os-volume
152132
```
153133

154134
### Session Management
155135

156-
Sessions run on OS volumes. Two types exist:
136+
Sessions run on OS volumes. Only one session can run per OS volume at a time.
157137

158-
- **Edit session (0)**: Interactive shell, no GPU, limited resources
159-
- **Run session (1+)**: GPU workloads with specified command, may be shutdown under low GPU utilization
138+
- **Edit mode** (default): Interactive shell for code editing, minimal GPU access
139+
- **Run mode** (`--run`): GPU workloads with specified resources and command
160140

161141
```bash
162142
# Start an edit session (interactive shell)
163143
sgs create session ferrari/os-volume
164144

165-
# Start an edit session with mounted data volume
166-
sgs create session ferrari/os-volume --mount ferrari/data-vol:/data
145+
# Start and attach to session immediately
146+
sgs create session ferrari/os-volume --attach
167147

168-
# Start a run session with GPU (auto-assign session number)
169-
sgs create session ferrari/os-volume --gpu 2 --command "python train.py"
148+
# Start with mounted data volume
149+
sgs create session ferrari/os-volume --mount ferrari/data-vol:/data
170150

171-
# Start a run session with specific session number
172-
sgs create session ferrari/os-volume/3 --gpu 1 --command "python train.py"
151+
# Start a run session with GPU (--gpu-num and --gpu-mem required)
152+
sgs create session ferrari/os-volume --run --gpu-num 2 --gpu-mem 16384 --command "python train.py"
173153

174-
# View session logs (session number optional, defaults to 0)
154+
# View session logs
175155
sgs logs ferrari/os-volume
176-
sgs logs ferrari/os-volume/1
156+
sgs logs ferrari/os-volume -f # Follow logs
177157

178-
# Delete the edit session (session 0)
158+
# Delete session
179159
sgs delete session ferrari/os-volume
180-
181-
# Delete a specific run session
182-
sgs delete session ferrari/os-volume/1
183160
```
184161

162+
### Command Aliases
163+
164+
| Command | Aliases |
165+
|----------|-----------|
166+
| describe | des, desc |
167+
| create | cr |
168+
| delete | del |
169+
| attach | at |
170+
| fetch | fet |
171+
| logs | log |
172+
| version | ver |
173+
174+
| Resource | Aliases |
175+
|-----------|-----------|
176+
| node | no |
177+
| session | se |
178+
| volume | vo, vol |
179+
| workspace | ws |
180+
185181
## Concepts
186182

187183
### Nodes
@@ -197,10 +193,12 @@ Persistent storage that behaves like VM disks. Two types:
197193

198194
### Sessions
199195

200-
Running pods on OS volumes. Named as `<node>/<volume>/<number>`:
196+
Running pods on OS volumes. Named as `<node>/<volume>`.
197+
198+
- **Edit mode**: Interactive shell for development (default)
199+
- **Run mode**: GPU workloads with command (`--run` flag)
201200

202-
- Session 0: Edit mode (interactive shell, no GPU)
203-
- Session 1+: Run mode (GPU workloads with command)
201+
Note: Only one session can run per OS volume at a time.
204202

205203
### Workspaces
206204

internal/cmd/describe.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,27 @@ func runDescribe(cmd *cobra.Command, args []string) {
5555
getAll(ctx, k8sClient, true)
5656
case "nodes", "node", "no":
5757
if name == "" {
58-
getNodes(ctx, k8sClient, true)
58+
describeNodes(ctx, k8sClient)
5959
} else {
60-
getNode(ctx, k8sClient, name, true)
60+
describeNode(ctx, k8sClient, name, true)
6161
}
6262
case "volumes", "volume", "vo", "vol":
6363
if name == "" {
64-
getVolumes(ctx, k8sClient, true)
64+
describeVolumes(ctx, k8sClient)
6565
} else {
66-
getVolume(ctx, k8sClient, name, true)
66+
describeVolume(ctx, k8sClient, name, true)
6767
}
6868
case "sessions", "session", "se":
6969
if name == "" {
70-
getSessions(ctx, k8sClient, true)
70+
describeSessions(ctx, k8sClient)
7171
} else {
72-
getSession(ctx, k8sClient, name, true)
72+
describeSession(ctx, k8sClient, name, true)
7373
}
7474
case "workspaces", "workspace", "ws":
7575
if name == "" {
76-
getWorkspaces(ctx, k8sClient, true)
76+
describeWorkspaces(ctx, k8sClient)
7777
} else {
78-
getWorkspace(ctx, k8sClient, name, true)
78+
describeWorkspace(ctx, k8sClient, name, true)
7979
}
8080
case "me":
8181
getMe(true)

0 commit comments

Comments
 (0)