mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
[Dashboard] Node resource display fix (#6521)
This commit is contained in:
parent
26ec500ef9
commit
c507859a83
2 changed files with 8 additions and 7 deletions
|
@ -52,10 +52,10 @@ def round_resource_value(quantity):
|
|||
|
||||
def format_resource(resource_name, quantity):
|
||||
if resource_name == "object_store_memory" or resource_name == "memory":
|
||||
# Convert to 100MiB chunks and then to GiB
|
||||
# Convert to 50MiB chunks and then to GiB
|
||||
quantity = quantity * (50 * 1024 * 1024) / (1024 * 1024 * 1024)
|
||||
return f"{round_resource_value(quantity)} GiB"
|
||||
return f"{round_resource_value(quantity)}"
|
||||
return "{} GiB".format(round_resource_value(quantity))
|
||||
return "{}".format(round_resource_value(quantity))
|
||||
|
||||
|
||||
class Dashboard(object):
|
||||
|
@ -162,14 +162,15 @@ class Dashboard(object):
|
|||
for address, data in D.items():
|
||||
available_resources = data["availableResources"]
|
||||
total_resources = data["totalResources"]
|
||||
extra_info = ""
|
||||
extra_info = []
|
||||
for resource_name in sorted(available_resources.keys()):
|
||||
total = total_resources[resource_name]
|
||||
occupied = total - available_resources[resource_name]
|
||||
total = format_resource(resource_name, total)
|
||||
occupied = format_resource(resource_name, occupied)
|
||||
extra_info += f"{resource_name}: {occupied} / {total}, "
|
||||
data["extraInfo"] = extra_info[:-2]
|
||||
extra_info.append("{}: {} / {}".format(
|
||||
resource_name, occupied, total))
|
||||
data["extraInfo"] = ", ".join(extra_info)
|
||||
return await json_response(result=D)
|
||||
|
||||
async def logs(req) -> aiohttp.web.Response:
|
||||
|
|
|
@ -246,7 +246,7 @@ const ResourceSet ResourceSet::GetNumCpus() const {
|
|||
|
||||
const std::string format_resource(std::string resource_name, double quantity) {
|
||||
if (resource_name == "object_store_memory" || resource_name == "memory") {
|
||||
// Convert to 100MiB chunks and then to GiB
|
||||
// Convert to 50MiB chunks and then to GiB
|
||||
return std::to_string(quantity * (50 * 1024 * 1024) / (1024 * 1024 * 1024)) + " GiB";
|
||||
}
|
||||
return std::to_string(quantity);
|
||||
|
|
Loading…
Add table
Reference in a new issue