Skip to content

Commit 6e0318e

Browse files
andystimeclaude
andcommitted
feat: auto-detect container platform from GPU agent architecture
Added agent architecture information to share public API response and use it to automatically set correct container platform when creating studio environments. Changes: 1. Backend API: - Added agent_arch field to PublicShareInfo response - Join worker and agent tables to get architecture info 2. Go Client: - Added AgentArch field to SharePublicInfo type - Auto-set platform based on GPU agent architecture - Prioritize agent arch over platform flag for library downloads - Log agent architecture in share link resolution This ensures: - ARM-based GPU workers (e.g., NVIDIA Jetson) get linux/arm64 containers - x86_64 GPU workers get linux/amd64 containers - Container architecture matches GPU endpoint architecture Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent e345abf commit 6e0318e

2 files changed

Lines changed: 16 additions & 5 deletions

File tree

cmd/ggo/studio/studio.go

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,12 +256,14 @@ func runCreate(cmd *cobra.Command, args []string) error {
256256

257257
// Append share code to connection URL for authentication
258258
shareInfo.ConnectionURL = shareInfo.ConnectionURL + "+" + shortCode
259-
klog.Infof("Resolved share link: worker_id=%s vendor=%s connection_url=%s",
260-
shareInfo.WorkerID, shareInfo.HardwareVendor, shareInfo.ConnectionURL)
259+
klog.Infof("Resolved share link: worker_id=%s vendor=%s arch=%s connection_url=%s",
260+
shareInfo.WorkerID, shareInfo.HardwareVendor, shareInfo.AgentArch, shareInfo.ConnectionURL)
261261

262-
// Determine target arch from platform flag (default: amd64)
262+
// Determine target arch from share info (preferred) or platform flag (fallback)
263263
targetArch := "amd64"
264-
if platform != "" {
264+
if shareInfo.AgentArch != "" {
265+
targetArch = shareInfo.AgentArch
266+
} else if platform != "" {
265267
if parts := strings.SplitN(platform, "/", 2); len(parts) == 2 {
266268
targetArch = parts[1]
267269
}
@@ -472,9 +474,17 @@ func buildCreateOptions(name string, shareInfo *api.SharePublicInfo) (*studio.Cr
472474
}
473475

474476
// Default platform to linux/amd64 for studio containers
477+
// If share info provides agent architecture, use it to set the correct platform
475478
effectivePlatform := platform
476479
if effectivePlatform == "" {
477-
effectivePlatform = "linux/amd64"
480+
if shareInfo != nil && shareInfo.AgentArch != "" {
481+
// Use agent architecture from share info (e.g., "amd64", "arm64")
482+
effectivePlatform = "linux/" + shareInfo.AgentArch
483+
klog.V(2).Infof("Using platform from GPU agent: %s", effectivePlatform)
484+
} else {
485+
// Default to linux/amd64 for compatibility
486+
effectivePlatform = "linux/amd64"
487+
}
478488
}
479489

480490
return &studio.CreateOptions{

internal/api/types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ type SharePublicInfo struct {
229229
WorkerID string `json:"worker_id"`
230230
HardwareVendor string `json:"hardware_vendor"`
231231
ConnectionURL string `json:"connection_url"`
232+
AgentArch string `json:"agent_arch,omitempty"` // Architecture of the agent (e.g., "amd64", "arm64")
232233
}
233234

234235
// SystemMetrics represents system metrics for metrics report

0 commit comments

Comments
 (0)