Skip to content

Commit 510ccc8

Browse files
andystimeclaude
andcommitted
fix: set TF_CONNECTION_INFO_PATH to file path instead of directory
TF_CONNECTION_INFO_PATH should point to a specific file path where connection info is recorded line by line, not to a directory. Changes: - Agent workers: Set to {connectionsDir}/{workerID}.txt - Studios: Set to {connectionsDir}/{studioName}.txt - Updated comments to reflect correct usage - Each worker/studio gets its own connection info file Before: TF_CONNECTION_INFO_PATH=/var/run/connections (directory) After: TF_CONNECTION_INFO_PATH=/var/run/connections/worker-123.txt (file) The tensor-fusion-worker process will now write connection info directly to the specified file, with one connection per line in the format: clientIP,clientPort,clientPID Files modified: - internal/agent/agent.go: Worker-specific file paths - internal/studio/env.go: Studio-specific file paths Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent c6dace5 commit 510ccc8

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

internal/agent/agent.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ import (
2525
const (
2626
statusReportInterval = 30 * time.Second
2727
forceRefreshInterval = 6 * time.Hour
28-
// EnvConnectionInfoPath is the environment variable name for connection info directory path
29-
// Workers should write their connections to: {TF_CONNECTION_INFO_PATH}/{workerID}.txt
28+
// EnvConnectionInfoPath is the environment variable name for connection info file path
29+
// Set to worker-specific file: {connectionsDir}/{workerID}.txt
30+
// Worker writes connection info to this file, one line per connection
3031
EnvConnectionInfoPath = "TF_CONNECTION_INFO_PATH"
3132

3233
// Worker status constants
@@ -231,12 +232,12 @@ func (a *Agent) Start() error {
231232
}
232233

233234
// Set TF_CONNECTION_INFO_PATH environment variable for worker processes
234-
// Workers will write connection info to: {TF_CONNECTION_INFO_PATH}/{workerID}.txt
235-
// Each worker has its own file with format: clientIP,clientPort,clientPID (one per line)
235+
// Each worker gets its own file: {connectionsDir}/{workerID}.txt
236+
// Workers write connection info to their file, one line per connection (format: clientIP,clientPort,clientPID)
236237
if err := os.Setenv(EnvConnectionInfoPath, a.connectionsDir); err != nil {
237238
klog.Warningf("Failed to set %s env var: error=%v", EnvConnectionInfoPath, err)
238239
} else {
239-
klog.V(4).Infof("Set %s=%s for worker processes", EnvConnectionInfoPath, a.connectionsDir)
240+
klog.V(4).Infof("Set %s=%s (base dir, workers get {workerID}.txt)", EnvConnectionInfoPath, a.connectionsDir)
240241
}
241242

242243
// Write PID file
@@ -447,7 +448,9 @@ func (a *Agent) convertToWorkerInfos(apiWorkers []api.WorkerConfig) ([]*hvApi.Wo
447448
envVars["TF_ENABLE_LOG"] = "1"
448449
envVars[EnvURLAuth] = "1"
449450
envVars[EnvAuthorizedKeyPath] = filepath.Join(a.paths.ConfigDir(), w.WorkerID+"_share_codes")
450-
envVars[EnvConnectionInfoPath] = a.connectionsDir
451+
// Set TF_CONNECTION_INFO_PATH to the worker's specific connection file (not directory)
452+
// Worker will write connection info to this file, one line per connection
453+
envVars[EnvConnectionInfoPath] = filepath.Join(a.connectionsDir, w.WorkerID+".txt")
451454

452455
// Set hard limiter environment variables for Fractional GPU support
453456
// TODO: use MIG for partitioned

internal/studio/env.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,17 @@ func SetupGPUEnv(paths *platform.Paths, config *GPUEnvConfig) (*GPUEnvResult, er
206206
return nil, fmt.Errorf("failed to create connections directory: %w", err)
207207
}
208208

209-
// Set TF_CONNECTION_INFO_PATH for tensor-fusion-worker
209+
// Set TF_CONNECTION_INFO_PATH to studio-specific file path (not directory)
210+
// tensor-fusion-worker will write connection info to this file, one line per connection
211+
var connectionInfoPath string
210212
if !config.IsContainer {
211-
// On host, use actual connections directory
212-
result.EnvVars["TF_CONNECTION_INFO_PATH"] = connectionsDir
213+
// On host, use actual connections file with studio name
214+
connectionInfoPath = filepath.Join(connectionsDir, config.StudioName+".txt")
213215
} else {
214-
// In container, use mounted path
215-
result.EnvVars["TF_CONNECTION_INFO_PATH"] = "/var/run/tensor-fusion/connections"
216+
// In container, use mounted path with studio name
217+
connectionInfoPath = filepath.Join("/var/run/tensor-fusion/connections", config.StudioName+".txt")
216218
}
219+
result.EnvVars["TF_CONNECTION_INFO_PATH"] = connectionInfoPath
217220

218221
// Add cache path to PATH (for tensor-fusion-worker binary)
219222
if !config.IsContainer {

0 commit comments

Comments
 (0)