[Kubernetes] [Dashboard] Remove disk data from dashboard when running on K8s. (#14676)

This commit is contained in:
Dmitri Gekhtman 2021-04-05 20:16:20 -04:00 committed by GitHub
parent 6f56d7e360
commit 410f768046
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -209,9 +209,19 @@ const NodeInfo: React.FC<{}> = () => {
// Show GPU features only if there is at least one GPU in cluster.
const showGPUs =
nodes.map((n) => n.gpus).filter((gpus) => gpus.length !== 0).length !== 0;
// Don't show disk on Kubernetes. K8s node disk usage should be monitored
// elsewhere.
// If a Ray node is running in a K8s pod, it marks available disk as 1 byte.
// (See ReporterAgent._get_disk_usage() in reporter_agent.py)
// Check if there are any nodes with realistic disk total:
const showDisk = nodes.filter((n) => n.disk["/"].total > 10).length !== 0;
const filterPredicate = (
feature: NodeInfoFeature | HeaderInfo<nodeInfoColumnId>,
) => showGPUs || (feature.id !== "gpu" && feature.id !== "gram");
) =>
(showGPUs || (feature.id !== "gpu" && feature.id !== "gram")) &&
(showDisk || feature.id !== "disk");
const filteredFeatures = nodeInfoFeatures.filter(filterPredicate);
const filteredHeaders = nodeInfoHeaders.filter(filterPredicate);

View file

@ -240,7 +240,15 @@ class ReporterAgent(dashboard_utils.DashboardAgentModule,
os.environ["USERPROFILE"] if sys.platform == "win32" else os.sep,
ray._private.utils.get_user_temp_dir(),
]
return {x: psutil.disk_usage(x) for x in dirs}
if IN_KUBERNETES_POD:
# If in a K8s pod, disable disk display by passing in dummy values.
return {
x: psutil._common.sdiskusage(
total=1, used=0, free=1, percent=0.0)
for x in dirs
}
else:
return {x: psutil.disk_usage(x) for x in dirs}
def _get_workers(self):
raylet_proc = self._get_raylet_proc()