diff --git a/coretex/cli/modules/node.py b/coretex/cli/modules/node.py index 9b507bd4..0f4d6b7d 100644 --- a/coretex/cli/modules/node.py +++ b/coretex/cli/modules/node.py @@ -399,33 +399,32 @@ def configureNode(advanced: bool) -> NodeConfiguration: else: nodeConfig.allowGpu = False - if nodeConfig.allowGpu and platform.system().lower() == "linux": - if not docker.isDaemonFileUpdated(): - shouldUpdateDockerConfig = ui.clickPrompt( - "NVIDIA has a bug where a docker container running Coretex Node can lose access to GPU " - "(https://github.com/NVIDIA/nvidia-container-toolkit/issues/48). " - "\nDo you want Coretex CLI to apply a workaround for this bug " - "(NOTE: This requires docker daemon restart)? (Y/n)", - type = bool, - default = True - ) + if nodeConfig.allowGpu and platform.system().lower() == "linux" and not docker.isDaemonFileUpdated(): + shouldUpdateDockerConfig = ui.clickPrompt( + "NVIDIA has a bug where a docker container running Coretex Node can lose access to GPU " + "(https://github.com/NVIDIA/nvidia-container-toolkit/issues/48). " + "\nDo you want Coretex CLI to apply a workaround for this bug " + "(NOTE: This requires docker daemon restart)? (Y/n)", + type = bool, + default = True + ) - if shouldUpdateDockerConfig: - docker.updateDaemonFile() - restartPrompt = ui.clickPrompt("Do you want to restart Docker to apply the changes? (Y/n)", type = bool, default = True) - - if restartPrompt: - docker.restartDocker() - else: - ui.warningEcho( - "Warning: The changes will not take effect until Docker is restarted. " - "(https://github.com/NVIDIA/nvidia-container-toolkit/issues/48)" - ) + if shouldUpdateDockerConfig: + docker.updateDaemonFile() + shouldRestartDocker = ui.clickPrompt("Do you want to restart Docker to apply the changes? (Y/n)", type = bool, default = True) + + if shouldRestartDocker: + docker.restartDocker() else: ui.warningEcho( - "Warning: Not updating the daemon.json file may lead to GPU access issues in Docker " - "containers. (https://github.com/NVIDIA/nvidia-container-toolkit/issues/48)" + "Warning: The changes will not take effect until Docker is restarted. " + "(https://github.com/NVIDIA/nvidia-container-toolkit/issues/48)" ) + else: + ui.warningEcho( + "Warning: Not updating the daemon.json file may lead to GPU access issues in Docker " + "containers. (https://github.com/NVIDIA/nvidia-container-toolkit/issues/48)" + ) if imageType == ImageType.official: tag = "gpu" if nodeConfig.allowGpu else "cpu"