in src/checker_common.py [0:0]
def has_gpu_resources(node: client.models.V1Node) -> bool:
"""Check if the node has GPU resources in capacity or allocatable.
Args:
node (kubernetes.client.V1Node): Kubernetes node object
Returns:
bool: True if node has GPUs, False otherwise
"""
# Get the node's status
node_status = node.status
# Check both capacity and allocatable for GPU resources
if node_status and node_status.allocatable:
gpu_key = "nvidia.com/gpu" # Standard NVIDIA GPU label
if gpu_key in node_status.allocatable:
# Convert to int and check if > 0
try:
gpu_count = int(node_status.allocatable.get(gpu_key, 0))
if gpu_count > 0:
return True
except (TypeError, ValueError):
pass
return False