Skip to content

Commit 4511890

Browse files
authored
adding support for github actions on cluster name (#69)
1 parent 379c413 commit 4511890

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Default owners for everything
2-
* @luccabb @skalyan
2+
* @luccabb @skalyan @gunchu

clusterscope/cluster_info.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# This source code is licensed under the license found in the
55
# LICENSE file in the root directory of this source tree.
66
import logging
7+
import os
78
import platform
89
import shutil
910
import subprocess
@@ -101,6 +102,8 @@ def get_cluster_name(self) -> str:
101102
"""
102103
if self.is_slurm_cluster:
103104
return self.slurm_cluster_info.get_cluster_name()
105+
if "GITHUB_ACTIONS" in os.environ:
106+
return "github"
104107
return "local-node"
105108

106109
def get_slurm_version(self) -> str:

tests/test_cluster_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class TestUnifiedInfo(unittest.TestCase):
2323
def test_get_cluster_name(self):
2424
unified_info = UnifiedInfo()
2525
unified_info.is_slurm_cluster = False
26-
self.assertEqual(unified_info.get_cluster_name(), "local-node")
26+
self.assertIn(unified_info.get_cluster_name(), ["local-node", "github"])
2727

2828
def test_get_gpu_generation_and_count(self):
2929
unified_info = UnifiedInfo()

0 commit comments

Comments
 (0)