diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index a657705..fa5c13c 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -11,10 +11,9 @@ on: env: CUDA_DEVICE_ORDER: PCI_BUS_ID - RUNNER: 10.0.14.248 jobs: - build: + test: runs-on: ${{ matrix.os }} strategy: @@ -70,10 +69,31 @@ jobs: source venv/bin/activate pip install . python tests/os.py + + wsl: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + - uses: Vampire/setup-wsl@v4 + with: + distribution: Ubuntu-24.04 + additional-packages: + python3-pip + python3-venv + + - name: test os + shell: wsl-bash -u root {0} + run: | + python3 -m venv venv + source venv/bin/activate + pip install . + python tests/os.py + gpu: runs-on: self-hosted container: - image: ${RUNNER}:5000/modelcloud/gptqmodel:compiler_cuda124-torch2.5.1-python311 + image: 10.0.14.248:5000/modelcloud/gptqmodel:compiler_cuda124-torch2.5.1-python311 steps: - uses: actions/checkout@v4 @@ -85,7 +105,7 @@ jobs: - name: Find suitable GPU run: | - gpu_id=$(curl -s "http://${{ needs.check-vm.outputs.ip }}/gpu/get?id=${{ github.run_id }}×tamp=$(date +%s%3N)&force=1") + gpu_id=$(curl -s "http://10.0.14.248/gpu/get?id=${{ github.run_id }}×tamp=$(date +%s%3N)&force=1") echo "CUDA_VISIBLE_DEVICES=$gpu_id" >> $GITHUB_ENV - name: test gpu diff --git a/device_smi/cpu.py b/device_smi/cpu.py index 06c28ba..a1d4c93 100644 --- a/device_smi/cpu.py +++ b/device_smi/cpu.py @@ -134,8 +134,14 @@ def metrics(self): if platform.system().lower() == "windows": command_result = _run(["wmic", "cpu", "get", "loadpercentage"]).strip() command_result = re.sub(r'\n+', '\n', command_result) - result = command_result.split("\n")[1].split(",") - utilization = int(result[0]) + try: + result = command_result.split("\n")[1].split(",") + utilization = int(result[0]) + except BaseException as e: + print(f"error occurred, command_result: ") + print(f"{command_result}") + print(f"------------") + raise e command_result = _run(["wmic", "os", "get", "FreePhysicalMemory"]).strip() command_result = re.sub(r'\n+', '\n', command_result) diff --git a/device_smi/os.py b/device_smi/os.py index 4dea029..ba1a06a 100644 --- a/device_smi/os.py +++ b/device_smi/os.py @@ -15,7 +15,7 @@ def __init__(self, cls): if platform.system().lower() == "linux" or platform.system().lower() == "freebsd" or platform.system().lower() == "solaris" or platform.system().lower() == "sunos": release_info = self.to_dict(_run(["cat", "/etc/os-release"]).replace("\"", "").lower(), "=") - cls.name = release_info["name"].replace("oracle", "").strip() + cls.name = release_info["name"].replace("oracle", "").replace("gnu/linux", "").strip() cls.version = release_info["version_id"] match = re.match(r"(\d+\.\d+)", cls.version)