From 577577046b3ba6d224eeac294a26d7bbc8a68fcb Mon Sep 17 00:00:00 2001 From: Nikolai Petukhov Date: Wed, 4 Dec 2024 12:02:29 -0300 Subject: [PATCH] Run nvidia_runtime_is_available check using agents image (#93) * run same image when checking for nvidia runtime availability --- agent/worker/agent_utils.py | 5 ++++- agent/worker/constants.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/agent/worker/agent_utils.py b/agent/worker/agent_utils.py index 32565ce..bc3f474 100644 --- a/agent/worker/agent_utils.py +++ b/agent/worker/agent_utils.py @@ -1069,16 +1069,19 @@ def restart_agent( def nvidia_runtime_is_available(): docker_api = docker.from_env() - image = constants.DEFAULT_APP_DOCKER_IMAGE() + container_info = get_container_info() + image = container_info.get("Image") try: docker_api.containers.run( image, + entrypoint="", command="nvidia-smi", runtime="nvidia", remove=True, ) return True except Exception as e: + sly.logger.warning(f"Failed to run nvidia-smi:", exc_info=True) return False diff --git a/agent/worker/constants.py b/agent/worker/constants.py index be4f0c9..45a96f6 100644 --- a/agent/worker/constants.py +++ b/agent/worker/constants.py @@ -145,7 +145,7 @@ def TOKEN(): _SUPERVISELY_AGENT_FILES: f"/opt/supervisely/agents/agent-files-{TOKEN()[:8]}", _SUPERVISELY_AGENT_FILES_CONTAINER: "/app/sly-files", _OFFLINE_MODE: False, - _DEFAULT_APP_DOCKER_IMAGE: "supervisely/base-py-sdk", + _DEFAULT_APP_DOCKER_IMAGE: "supervisely/base-py-sdk:latest", _AGENT_FILES_IN_APP_CONTAINER: "/agent-storage", _AUTO_CLEAN_INT_RANGE_DAYS: 7, _REQUESTS_CA_BUNDLE_DIR_CONTAINER: "/sly_certs",