Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 99e95469 authored by Baptiste Jonglez's avatar Baptiste Jonglez
Browse files

[lib] [wiki] Display full name of GPU in cluster details

parent beba5846
No related branches found
No related tags found
No related merge requests found
Pipeline #188255 passed
...@@ -148,7 +148,7 @@ class SiteHardwareGenerator < WikiGenerator ...@@ -148,7 +148,7 @@ class SiteHardwareGenerator < WikiGenerator
'Storage' => h['storage_description'], 'Storage' => h['storage_description'],
'Network' => h['network_description'], 'Network' => h['network_description'],
} }
hash[accelerators] = h['accelerators'] if accelerators hash[accelerators] = h['accelerators_long'] if accelerators
text_data << MW::generate_hash_table(hash) text_data << MW::generate_hash_table(hash)
} }
} }
...@@ -190,14 +190,18 @@ def sort_data(data, key) ...@@ -190,14 +190,18 @@ def sort_data(data, key)
data[key].map{ |e| e['sort'] }[0] data[key].map{ |e| e['sort'] }[0]
end end
def gpu_description(node_hash) def gpu_description(node_hash, long_names)
lgpu = node_hash['gpu_devices'] lgpu = node_hash['gpu_devices']
if lgpu if lgpu
bymodel = {} bymodel = {}
lgpu.each { |g| lgpu.each { |g|
d = g[1] d = g[1]
vendor = d['vendor'] vendor = d['vendor']
model = GPURef.getGrid5000LegacyNameFor(d['model']) if long_names
model = d['model']
else
model = GPURef.getGrid5000LegacyNameFor(d['model'])
end
vm = vendor.to_s + ' ' + model.to_s.gsub(' ', '&nbsp;') vm = vendor.to_s + ' ' + model.to_s.gsub(' ', '&nbsp;')
if bymodel[vm] if bymodel[vm]
bymodel[vm] += 1 bymodel[vm] += 1
...@@ -390,7 +394,8 @@ def get_hardware(sites) ...@@ -390,7 +394,8 @@ def get_hardware(sites)
s s
end.join('<br />') end.join('<br />')
hard['gpu_str'] = gpu_description(node_hash) hard['gpu_str'] = gpu_description(node_hash, false)
hard['gpu_str_long'] = gpu_description(node_hash, true)
mic = node_hash['mic'] mic = node_hash['mic']
hard['mic_str'] = if mic hard['mic_str'] = if mic
(mic['mic_count'].to_i == 1 ? '' : mic['mic_count'].to_s + '&nbsp;x&nbsp;') + mic['mic_vendor'].to_s + ' ' + mic['mic_model'].to_s.gsub(' ', '&nbsp;') (mic['mic_count'].to_i == 1 ? '' : mic['mic_count'].to_s + '&nbsp;x&nbsp;') + mic['mic_vendor'].to_s + ' ' + mic['mic_model'].to_s.gsub(' ', '&nbsp;')
...@@ -398,6 +403,7 @@ def get_hardware(sites) ...@@ -398,6 +403,7 @@ def get_hardware(sites)
'' ''
end end
hard['accelerators'] = hard['gpu_str'] != '' ? hard['gpu_str'] + (hard['mic_str'] != '' ? ' ; ' + hard['mic_str'] : '') : hard['mic_str'] hard['accelerators'] = hard['gpu_str'] != '' ? hard['gpu_str'] + (hard['mic_str'] != '' ? ' ; ' + hard['mic_str'] : '') : hard['mic_str']
hard['accelerators_long'] = hard['gpu_str_long'] != '' ? hard['gpu_str_long'] + (hard['mic_str'] != '' ? ' ; ' + hard['mic_str'] : '') : hard['mic_str']
add(hardware[site_uid][cluster_uid], node_uid, hard) add(hardware[site_uid][cluster_uid], node_uid, hard)
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment