SERVER-118456: Add CPU Architecture BES Flag (#47207)
GitOrigin-RevId: 1227af862332a3a192d0c5a9f28b989d1fb87119
This commit is contained in:
parent
299e5c7b07
commit
e12500e9ea
@ -9,6 +9,7 @@ import sys
|
||||
import git
|
||||
|
||||
from bazel.wrapper_hook.wrapper_util import (
|
||||
cpu_architecture,
|
||||
cpu_info,
|
||||
filesystem_info,
|
||||
memory_info,
|
||||
@ -83,6 +84,7 @@ def write_workstation_bazelrc(args):
|
||||
|
||||
# Collect system resource information
|
||||
cpu_count = cpu_info() # CPU count - works on all platforms
|
||||
cpu_arch = cpu_architecture() # CPU architecture - works on all platforms
|
||||
total_memory_gb = memory_info("MemTotal") # Total memory - Linux only
|
||||
available_memory_gb = memory_info("MemAvailable") # Available memory - Linux only
|
||||
filesystem_type, best_mountpoint_len = filesystem_info() # Filesystem type - Linux only
|
||||
@ -106,6 +108,7 @@ common --bes_keywords=engflow:BuildScmStatus={status}
|
||||
common --bes_keywords=rawCommandLineBase64={b64_cmd_line}
|
||||
common --bes_keywords=base_branch={base_branch}
|
||||
common --bes_keywords=client_system:cpu_count={cpu_count}
|
||||
common --bes_keywords=client_system:cpu_architecture={cpu_arch}
|
||||
common --bes_keywords=client_system:total_memory_gb={total_memory_gb}
|
||||
common --bes_keywords=client_system:available_memory_gb={available_memory_gb}
|
||||
common --bes_keywords=client_system:filesystem_type={filesystem_type}
|
||||
|
||||
@ -74,6 +74,19 @@ def cpu_info() -> str:
|
||||
return _UNKNOWN
|
||||
|
||||
|
||||
def cpu_architecture() -> str:
|
||||
"""CPU architecture - works on all platforms"""
|
||||
try:
|
||||
arch = platform.machine()
|
||||
# Normalize aarch64 to arm64
|
||||
if arch == "aarch64":
|
||||
return "arm64"
|
||||
return arch
|
||||
except Exception as _e:
|
||||
wrapper_debug(f"Failed to get CPU architecture {_e}")
|
||||
return _UNKNOWN
|
||||
|
||||
|
||||
def memory_info(mem_type: str) -> str:
|
||||
"""Memory - Linux only"""
|
||||
memory_gb = _UNKNOWN
|
||||
|
||||
Loading…
Reference in New Issue
Block a user