[#2] agent使用pyinstaller打包成二进制可执行文件,通过环境变量指定master endpoint和上报间隔
This commit is contained in:
@@ -27,7 +27,7 @@ def collect_metadata(config: AgentConfig) -> Dict[str, Any]:
|
||||
"instance": instance,
|
||||
"cpu_number": _detect_cpu_count(),
|
||||
"memory_in_bytes": _detect_memory_bytes(),
|
||||
"gpu_number": _detect_gpu_count(config),
|
||||
"gpu_number": _detect_gpu_count(),
|
||||
}
|
||||
return meta
|
||||
|
||||
@@ -70,11 +70,8 @@ def _detect_memory_bytes() -> int:
|
||||
return 0
|
||||
|
||||
|
||||
def _detect_gpu_count(config: AgentConfig) -> int:
|
||||
"""采集 GPU 数量,可被配置覆盖。"""
|
||||
if config.gpu_number_override is not None:
|
||||
return config.gpu_number_override
|
||||
|
||||
def _detect_gpu_count() -> int:
|
||||
"""采集 GPU 数量,如无法探测则默认为 0。"""
|
||||
try:
|
||||
proc = subprocess.run(
|
||||
["nvidia-smi", "-L"],
|
||||
|
||||
Reference in New Issue
Block a user