Handle edge case when node capacity is undefined gracefully. Closes #7280. (kubeflow/kubeflow#7281)

* Handle edge case when node capacity is undefined gracefully

* Change log message to capacity

* No need to make the message a warning

* Resolve flake8 issue

* ensure closing bracket matches indentation of opening bracket

* Fix flake8 issues from other files
This commit is contained in:
boarder7395 2023-12-06 02:37:06 -05:00 committed by GitHub
parent bead8d49b7
commit dfe131a537
1 changed files with 6 additions and 1 deletions

View File

@ -114,7 +114,12 @@ def get_gpu_vendors():
installed_resources = set() installed_resources = set()
nodes = api.list_nodes().items nodes = api.list_nodes().items
for node in nodes: for node in nodes:
installed_resources.update(node.status.capacity.keys()) if node.status.capacity:
installed_resources.update(status.capacity.keys())
else:
log.debug(
"Capacity was not available for node {node.metadata.name}"
)
# Keep the vendors the key of which exists in at least one node # Keep the vendors the key of which exists in at least one node
available_vendors = installed_resources.intersection(config_vendor_keys) available_vendors = installed_resources.intersection(config_vendor_keys)