auto detect runpod host

This commit is contained in:
robertvoy
2025-07-16 13:01:05 +10:00
parent 24c6b41a73
commit 338456b79d
+32 -1
View File
@@ -771,6 +771,12 @@ class DistributedExtension {
async detectMasterIP() {
try {
// Detect if we're running on Runpod
const isRunpod = window.location.hostname.endsWith('.proxy.runpod.net');
if (isRunpod) {
this.log("Detected Runpod environment", "info");
}
const data = await this.api.getNetworkInfo();
this.log("Network info: " + JSON.stringify(data), "debug");
@@ -826,7 +832,8 @@ class DistributedExtension {
host: "localhost",
port: 8189 + portOffset,
cuda_device: i,
enabled: true
enabled: true,
extra_args: isRunpod ? "--listen" : ""
};
newWorkers.push(worker);
workerNum++;
@@ -875,6 +882,30 @@ class DistributedExtension {
return;
}
// For Runpod, use the proxy hostname as master host
if (isRunpod) {
const runpodHost = window.location.hostname;
this.log(`Setting Runpod master host: ${runpodHost}`, "info");
// Save the Runpod host
await this.api.updateMaster({ host: runpodHost });
// Update local config
if (!this.config.master) this.config.master = {};
this.config.master.host = runpodHost;
// Show notification
if (app.extensionManager?.toast) {
app.extensionManager.toast.add({
severity: "info",
summary: "Runpod Auto-Configuration",
detail: `Master host set to ${runpodHost} with --listen flag for workers`,
life: 5000
});
}
return; // Skip regular IP detection for Runpod
}
// Use the recommended IP from the backend
if (data.recommended_ip && data.recommended_ip !== '127.0.0.1') {
this.log(`Auto-detected master IP: ${data.recommended_ip}`, "info");