Merge pull request #837 from wish-oss/fix/gpu-setup

fix: update GPU setup command to use sudo and add error handling
This commit is contained in:
Mauricio Siu 2024-12-08 22:09:23 -06:00 committed by GitHub
commit 83b3176f6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -303,7 +303,7 @@ const setupLocalServer = async (daemonConfig: any) => {
await fs.writeFile(configFile, JSON.stringify(daemonConfig, null, 2));
const setupCommands = [
`pkexec sh -c '
`sudo sh -c '
cp ${configFile} /etc/docker/daemon.json &&
mkdir -p /etc/nvidia-container-runtime &&
sed -i "/swarm-resource/d" /etc/nvidia-container-runtime/config.toml &&
@ -314,7 +314,14 @@ const setupLocalServer = async (daemonConfig: any) => {
`rm ${configFile}`,
].join(" && ");
await execAsync(setupCommands);
try {
await execAsync(setupCommands);
} catch (error) {
console.error("Setup failed:", error);
throw new Error(
"Failed to configure GPU support. Please ensure you have sudo privileges and try again.",
);
}
};
const addGpuLabel = async (nodeId: string, serverId?: string) => {