Skip to content

Commit

Permalink
Position change of Fugaku point
Browse files Browse the repository at this point in the history
  • Loading branch information
mnakao committed Feb 7, 2024
1 parent fd98e2c commit df044e0
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 62 deletions.
16 changes: 1 addition & 15 deletions misc/accounting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ HOME_DIR=${ACCOUNTING_DIR}/home
GROUP_TMP=${GROUP_DIR}/group.tmp
DISK_TMP=${HOME_DIR}/disk.tmp
INODE_TMP=${HOME_DIR}/inode.tmp
FUGAKU_PT_TMP=${GROUP_DIR}/fugaku_pt.tmp
FREE_QUEUE_TMP=${ACCOUNTING_DIR}/free_queue.tmp
#=============================================================================
ACCOUNTJ="/usr/local/bin/accountj"
Expand Down Expand Up @@ -67,7 +66,7 @@ mkdir -p ${GROUP_DIR} ${HOME_DIR}
{
# グループ名1つ1つに対してaccountj -gを実行し、グループ毎のバジェットを取得
FILE=${DIR}/resource.csv
su - ktool -c "${REMOTE_SSH} ${ACCOUNTJ} -g ${II} -c -h -r 1 -e -E" | tr -d '"' | egrep '^SUBTHEME|^SUBTHEMEPERIOD|^EXCLUSIVEUSE|^USER' | egrep -v '^USER_' > ${FILE}
su - ktool -c "${REMOTE_SSH} ${ACCOUNTJ} -g ${II} -c -h -r 1 -e -E" | tr -d '"' | egrep '^SUBTHEME|^SUBTHEMEPERIOD|^EXCLUSIVEUSE|^RESOURCE_GROUP|^USER' | egrep -v '^USER_' > ${FILE}

if [ $? -ne 0 ]; then
rm ${LOCKFILE} ${GROUP_TMP}
Expand Down Expand Up @@ -227,19 +226,6 @@ mkdir -p ${GROUP_DIR} ${HOME_DIR}
rm ${FREE_QUEUE_TMP}
} &

#==============================================================================
# 富岳ポイント
#==============================================================================
{
su - ktool -c "${REMOTE_SSH} ${ACCOUNTJ_PT} -a -c" | tr -d '"' | tail -n +6 > ${FUGAKU_PT_TMP}

while IFS=, read -r _ _ group _ value _ _; do
echo ${value} > ${GROUP_DIR}/${group}/fugaku_pt.dat
done < ${FUGAKU_PT_TMP}

rm ${FUGAKU_PT_TMP}
} &

#==============================================================================
# 終了処理
#==============================================================================
Expand Down
67 changes: 34 additions & 33 deletions misc/dashboard/fugaku_info/_accounting.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
<th colspan="4">Capacity (GiB)</th>
<th colspan="4">Inode</th>
<th colspan="4">Resource (NH)</th>
<th rowspan="2">Fugaku Points</th>
</tr>
<tr>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
<th>Limit</th><th>Usage</th><th>Avail.</th><th>Ratio</th>
<%- if check_fugaku_pt_period("Feb") -%>
<th>Limit (pt-Feb)</th>
<%- elsif check_fugaku_pt_period("Aug") -%>
<th>Limit (pt-Aug)</th>
<%- else -%>
<th>Limit</th>
<%- end -%>
<th>Usage</th><th>Avail.</th><th>Ratio</th>
</tr>
<%- groups = `groups`.split - ["fugaku", "f-op"] -%>
<%- groups.delete_if { |i| i.start_with?("isv") } -%>
Expand All @@ -42,45 +48,44 @@
<td align="right"><%= disk_info[i].limit %></td>
<td align="right"><%= disk_info[i].usage %></td>
<td align="right"><%= disk_info[i].avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(disk_info[i].ratio) %>" style="width: <%= disk_info[i].ratio %>%;"><%= disk_info[i].ratio %>%</strong>
</div>
</td>
<td><div class="graph"><strong class="bar_<%= dashboard_color(disk_info[i].ratio) %>" style="width: <%= disk_info[i].ratio %>%;"><%= disk_info[i].ratio %>%</strong></div></td>
<%- else -%>
<td> - </td><td> - </td><td> - </td><td> - </td><td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
<%- end -%>

<%- unless inode_info.empty? -%>
<td align="right"><%= inode_info[i].limit %></td>
<td align="right"><%= inode_info[i].usage %></td>
<td align="right"><%= inode_info[i].avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(inode_info[i].ratio) %>" style="width: <%= inode_info[i].ratio %>%;"><%= inode_info[i].ratio %>%</strong>
</div>
</td>
<td><div class="graph"><strong class="bar_<%= dashboard_color(inode_info[i].ratio) %>" style="width: <%= inode_info[i].ratio %>%;"><%= inode_info[i].ratio %>%</strong></div></td>
<%- else -%>
<td> - </td><td> - </td><td> - </td><td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
<%- end -%>

<%- if i == 0 -%>
<%- unless resource_info == nil -%>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.limit %></td>
<%- if check_fugaku_pt_period("Feb") -%>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.limit %> (<%= get_fugaku_pt_resource("Feb", group_name) %>)</td>
<%- elsif check_fugaku_pt_period("Aug") -%>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.limit %> (<%= get_fugaku_pt_resource("Aug", group_name) %>)</td>
<%- else -%>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.limit %></td>
<%- end -%>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.usage %></td>
<td align="right" rowspan="<%= num_volumes %>"><%= resource_info.avail %></td>
<td rowspan="<%= num_volumes %>">
<div class="graph">
<strong class="bar_<%= dashboard_color(resource_info.ratio) %>" style="width: <%= resource_info.ratio %>%;"><%= resource_info.ratio %>%</strong>
</div>
</td>
<td align="right" rowspan="<%= num_volumes %>"><%= dashboard_get_fugaku_point(group_name) %></td>
<td rowspan="<%= num_volumes %>"><div class="graph"><strong class="bar_<%= dashboard_color(resource_info.ratio) %>" style="width: <%= resource_info.ratio %>%;"><%= resource_info.ratio %>%</strong></div></td>
<%- else -%>
<td rowspan="<%= num_volumes %>"> - </td>
<td rowspan="<%= num_volumes %>"> - </td>
<td rowspan="<%= num_volumes %>"> - </td>
<td rowspan="<%= num_volumes %>"> - </td>
<td rowspan="<%= num_volumes %>"> - </td>
<%- end -%>
<%- end -%>
</tr>
Expand All @@ -95,20 +100,16 @@
<td align="right"><%= home_disk_info.limit %></td>
<td align="right"><%= home_disk_info.usage %></td>
<td align="right"><%= home_disk_info.avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(home_disk_info.ratio) %>" style="width: <%= home_disk_info.ratio %>%;"><%= home_disk_info.ratio %>%</strong>
</div>
</td>
<td><div class="graph"><strong class="bar_<%= dashboard_color(home_disk_info.ratio) %>" style="width: <%= home_disk_info.ratio %>%;"><%= home_disk_info.ratio %>%</strong></div></td>

<td align="right"><%= home_inode_info.limit %></td>
<td align="right"><%= home_inode_info.usage %></td>
<td align="right"><%= home_inode_info.avail %></td>
<td>
<div class="graph">
<strong class="bar_<%= dashboard_color(home_inode_info.ratio) %>" style="width: <%= home_inode_info.ratio %>%;"><%= home_inode_info.ratio %>%</strong>
</div>
</td>
<td> - </td><td> - </td><td> - </td><td> - </td><td> - </td>
<td><div class="graph"><strong class="bar_<%= dashboard_color(home_inode_info.ratio) %>" style="width: <%= home_inode_info.ratio %>%;"><%= home_inode_info.ratio %>%</strong></div></td>
<td> - </td>
<td> - </td>
<td> - </td>
<td> - </td>
</tr>
</table>
</p>
2 changes: 2 additions & 0 deletions misc/logo/fugaku.css
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ h4.fugaku_info {
background: #2A2A2A;
border: solid 1px #AAAAAA;
color: #ffffff;
white-space: nowrap;
}
.design01 td {
padding: 0px 4px;
Expand All @@ -96,6 +97,7 @@ h4.fugaku_info {
@media (max-width: 1459.98px) {
.design01 th {
padding: 0px;
white-space: nowrap;
}
.design01 td{
padding: 0px;
Expand Down
43 changes: 29 additions & 14 deletions misc/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,24 +326,39 @@ def dashboard_get_fugaku_point(group)
return File.exist?(file)? num_with_commas(File.read(file).chomp) : "0"
end

def check_pt()
`groups`.split.each do |g|
return true if dashboard_get_fugaku_point(g) != "0"
def check_fugaku_pt_period(month)
if month == "Aug"
return Time.now.between?(Time.parse(FUGAKU_PT_AUG_START), Time.parse(FUGAKU_PT_AUG_END))
elsif month == "Feb"
return Time.now.between?(Time.parse(FUGAKU_PT_FEB_START), Time.parse(FUGAKU_PT_FEB_END))
else
return false
end

return false
end

def check_within_period(start_time, end_time)
return Time.now.between?(Time.parse(start_time), Time.parse(end_time))
def get_fugaku_pt_resource(month, group, w_commas = true)
file = ACC_GROUP_DIR + group + "/resource.csv"
if File.exist?(file)
CSV.foreach(file) do |row|
if row[0] == "RESOURCE_GROUP" and row[1] == "pt-Aug" and month == "Aug"
return (w_commas)? num_with_commas(row[2]) : row[2].to_i
elsif row[0] == "RESOURCE_GROUP" and row[1] == "pt-Feb" and month == "Feb"
return (w_commas)? num_with_commas(row[2]) : row[2].to_i
end
end
end

return -1 # for debug
end

def check_pt_aug()
return check_within_period(FUGAKU_PT_AUG_START, FUGAKU_PT_AUG_END) && check_pt()
end
def check_fugaku_pt(month)
return false unless check_fugaku_pt_period(month)

`groups`.split.each do |g|
return true if get_fugaku_pt_resource(month, g, false) > 0
end

def check_pt_feb()
return check_within_period(FUGAKU_PT_FEB_START, FUGAKU_PT_FEB_END) && check_pt()
return false
end

def form_queue(name, enable_fugaku_threads = true, added_fugaku_queues = [])
Expand Down Expand Up @@ -389,8 +404,8 @@ def form_queue(name, enable_fugaku_threads = true, added_fugaku_queues = [])

enable_free_queue = check_free_queue()
enable_cd_portal = check_cd_portal()
enable_pt_aug = check_pt_aug()
enable_pt_feb = check_pt_feb()
enable_pt_aug = check_fugaku_pt("Aug")
enable_pt_feb = check_fugaku_pt("Feb")
if name == "fugaku_small_and_prepost"
$attr << output_queue("fugaku-small", "small", "fugaku", hide_elmts - show_elmts_small)
$attr << output_queue("fugaku-small-free", "small-free", "fugaku", hide_elmts - show_elmts_small_free) if enable_free_queue
Expand Down

0 comments on commit df044e0

Please sign in to comment.