From 797030be42415b65dc2c8ca95f873120abedd7c0 Mon Sep 17 00:00:00 2001 From: Masahiro Nakao Date: Sun, 14 Jan 2024 17:02:56 +0900 Subject: [PATCH] rate -> ratio --- Disk_Info/app.rb | 2 +- Disk_Info/views/index.erb | 8 ++++---- Resource_Info/app.rb | 2 +- Resource_Info/views/index.erb | 4 ++-- misc/dashboard/fugaku_info/_accounting.html.erb | 16 ++++++++-------- misc/utils.rb | 16 ++++++++-------- 6 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Disk_Info/app.rb b/Disk_Info/app.rb index 3a0ff39..e015027 100755 --- a/Disk_Info/app.rb +++ b/Disk_Info/app.rb @@ -19,7 +19,7 @@ def num_with_commas(number) return number.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\1,').reverse end - def rate(a, b) + def ratio(a, b) if b.to_i == 0 return 0 else diff --git a/Disk_Info/views/index.erb b/Disk_Info/views/index.erb index 6f7bc5f..00d529c 100755 --- a/Disk_Info/views/index.erb +++ b/Disk_Info/views/index.erb @@ -39,11 +39,11 @@ td { Limit Usage Avail. - Rate + Ratio Limit Usage Avail. - Rate + Ratio <% @disk_info[i][1..-1].each do |d| %> @@ -67,7 +67,7 @@ td { <%= num_with_commas(capacity_avail) %>
- <%= rate(capacity, capacity_limit) %>% + <%= ratio(capacity, capacity_limit) %>%
<% else %> @@ -82,7 +82,7 @@ td { <%= num_with_commas(inode_avail) %>
- <%= rate(inode, inode_limit) %>% + <%= ratio(inode, inode_limit) %>%
<% else %> diff --git a/Resource_Info/app.rb b/Resource_Info/app.rb index 96f4210..128eeec 100755 --- a/Resource_Info/app.rb +++ b/Resource_Info/app.rb @@ -16,7 +16,7 @@ def title "Resource info" end - def rate(a, b) + def ratio(a, b) if b.to_i == 0 return 0 else diff --git a/Resource_Info/views/index.erb b/Resource_Info/views/index.erb index e807afd..ae9f070 100755 --- a/Resource_Info/views/index.erb +++ b/Resource_Info/views/index.erb @@ -37,7 +37,7 @@ td { Limit Usage Available - Rate + Ratio <% @resource_info[i].each do |d| %> @@ -56,7 +56,7 @@ td { <%= num_with_commas(avail) %>
- <%= rate(usage, limit) %>% + <%= ratio(usage, limit) %>%
<% else %> diff --git a/misc/dashboard/fugaku_info/_accounting.html.erb b/misc/dashboard/fugaku_info/_accounting.html.erb index 4be3165..a934692 100644 --- a/misc/dashboard/fugaku_info/_accounting.html.erb +++ b/misc/dashboard/fugaku_info/_accounting.html.erb @@ -13,9 +13,9 @@ Resource (NH) - LimitUsageAvail.Rate - LimitUsageAvail.Rate - LimitUsageAvail.Rate + LimitUsageAvail.Ratio + LimitUsageAvail.Ratio + LimitUsageAvail.Ratio <%- groups = `groups`.split - ["f-op"] -%> <%- groups.each do |group_name| -%> @@ -42,7 +42,7 @@ <%= disk_info[i].avail %>
- <%= disk_info[i].rate %>% + <%= disk_info[i].ratio %>%
<%- else -%> @@ -55,7 +55,7 @@ <%= inode_info[i].avail %>
- <%= inode_info[i].rate %>% + <%= inode_info[i].ratio %>%
<%- else -%> @@ -69,7 +69,7 @@ <%= resource_info.avail %>
- <%= resource_info.rate %>% + <%= resource_info.ratio %>%
<%- else -%> @@ -93,7 +93,7 @@ <%= home_disk_info.avail %>
- <%= home_disk_info.rate %>% + <%= home_disk_info.ratio %>%
<%= home_inode_info.limit %> @@ -101,7 +101,7 @@ <%= home_inode_info.avail %>
- <%= home_inode_info.rate %>% + <%= home_inode_info.ratio %>%
- - - - diff --git a/misc/utils.rb b/misc/utils.rb index e64d577..33ffc43 100644 --- a/misc/utils.rb +++ b/misc/utils.rb @@ -20,8 +20,8 @@ ACC_GROUP_DIR = ACC_DIR + "group/" ACC_HOME_DIR = ACC_DIR + "home/" APP_CACHE_DIR = SYS_OOD_DIR + "app/" -Resource_info = Struct.new(:limit, :usage, :avail, :rate) -Disk_info = Struct.new(:volume, :limit, :usage, :avail, :rate) +Resource_info = Struct.new(:limit, :usage, :avail, :ratio) +Disk_info = Struct.new(:volume, :limit, :usage, :avail, :ratio) NOT_DEFINED = -1 NOT_USED = -1 $attr = "" @@ -704,8 +704,8 @@ def dashboard_resource(group_name) limit = i[3].to_i/3600 usage = i[7].to_i/3600 avail = i[6].to_i/3600 - rate = ((usage * 100) / limit).round - return Resource_info.new(num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate) + ratio = ((usage * 100) / limit).round + return Resource_info.new(num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio) end end end @@ -729,8 +729,8 @@ def _disk_info(file, group_name) limit = i[3].to_i usage = i[4].to_i avail = i[5].to_i - rate = ((usage * 100) / limit).round - info.push(Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate)) + ratio = ((usage * 100) / limit).round + info.push(Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio)) end end end @@ -776,8 +776,8 @@ def _home_info(file) limit = i[3].to_i usage = i[4].to_i avail = i[5].to_i - rate = ((usage * 100) / limit).round - return Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), rate) + ratio = ((usage * 100) / limit).round + return Disk_info.new(volume, num_with_commas(limit), num_with_commas(usage), num_with_commas(avail), ratio) end end