Skip to content

Commit 5d4b87f

Browse files
committed
Merge branch 'gen_arch' into 'master'
Amélioration des tableaux pour la partie CPU See merge request grid5000/reference-repository!376
2 parents e3c52ee + 9fb0831 commit 5d4b87f

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

lib/refrepo/gen/wiki/generators/site_hardware.rb

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,19 @@ def self.generate_summary_data(site, with_sites)
117117
access_conditions << "<b>#{queue}</b>&nbsp;queue"
118118
end
119119
access_conditions << '<b>[[Getting_Started#Selecting_specific_resources|exotic]]</b>&nbsp;job&nbsp;type' if cluster_hash.map { |_k, v| v['exotic']}.first
120-
table_columns = (with_sites == true ? ['Site'] : []) + ['Cluster', 'Access Condition', 'Date of arrival', { attributes: 'data-sort-type="number"', text: 'Nodes' }, 'CPU', { attributes: 'data-sort-type="number"', text: 'Cores' }, { attributes: 'data-sort-type="number"', text: 'Memory' }, { attributes: 'data-sort-type="number"', text: 'Storage' }, { attributes: 'data-sort-type="number"', text: 'Network' }] + ((site_accelerators.zero? && with_sites == false) ? [] : ['Accelerators'])
120+
table_columns = []
121+
table_columns << (with_sites == true ? [{attributes: 'rowspan=2', text: 'Site'}] : []) + [{attributes: 'rowspan=2', text: 'Cluster'}, {attributes: 'rowspan=2', text: 'Access Condition'}, {attributes: 'rowspan=2', text: 'Date of arrival'}, { attributes: 'data-sort-type="number" rowspan=2', text: 'Nodes' }, {attributes: 'colspan=4', text: 'CPU'}, { attributes: 'data-sort-type="number" rowspan=2', text: 'Memory' }, { attributes: 'data-sort-type="number" rowspan=2', text: 'Storage' }, { attributes: 'data-sort-type="number" rowspan=2', text: 'Network' }] + ((site_accelerators.zero? && with_sites == false) ? [] : [{attributes: 'rowspan=2', text: 'Accelerators'}])
122+
table_columns << [{ attributes: 'data-sort-type="number"', text: '#' }, 'Name', { attributes: 'data-sort-type="number"', text: 'Cores' }, 'Architecture' ]
121123
data = partition(cluster_hash)
122124
table_data << (with_sites == true ? ["[[#{site.capitalize}:Hardware|#{site.capitalize}]]"] : []) + [
123125
(with_sites == true ? "[[#{site.capitalize}:Hardware##{cluster_uid}" + "|#{cluster_uid}]]" : "[[##{cluster_uid}" + "|#{cluster_uid}]]"),
124126
access_conditions.join(",<br/>"),
125127
cell_data(data, 'date'),
126128
cluster_nodes,
127-
cell_data(data, 'num_processor_model'),
129+
cell_data(data, 'cpus_per_node'),
130+
cell_data(data, 'processor_model'),
128131
cell_data(data, 'cores_per_cpu_str'),
132+
cell_data(data, 'architecture'),
129133
sort_data(data, 'ram_size') + (!data['pmem_size'].nil? ? " + #{cell_data(data, 'pmem_size')} [[PMEM]]" : ''),
130134
'data-sort-value="' + sort_data(data, 'storage_size') + '"|' + cell_data(data, 'storage'),
131135
'data-sort-value="' + sort_data(data, 'network_throughput') + '"|' + cell_data(data, 'used_networks')
@@ -360,6 +364,7 @@ def get_hardware(sites)
360364
hard['cpus_per_node_str'] = hard['cpus_per_node'].to_s + '&nbsp;' + G5K.pluralize(hard['cpus_per_node'], 'CPU') + '/node'
361365
hard['cores_per_cpu'] = node_hash['architecture']['nb_cores'] / hard['cpus_per_node']
362366
hard['cores_per_cpu_str'] = hard['cores_per_cpu'].to_s + '&nbsp;' + G5K.pluralize(hard['cores_per_cpu'], 'core') + '/CPU'
367+
hard['architecture'] = node_hash['architecture']['platform_type']
363368
exotic_archname = get_exotic_archname(node_hash['architecture']['platform_type'])
364369
hard['num_processor_model'] = (hard['cpus_per_node'] == 1 ? '' : "#{hard['cpus_per_node']}&nbsp;x&nbsp;") + (exotic_archname ? "#{exotic_archname}&nbsp;" : '') + hard['processor_model'].gsub(' ', '&nbsp;')
365370
hard['processor_description'] = "#{hard['processor_model']} (#{hard['microarchitecture']}#{hard['processor_freq'] ? ', ' + hard['processor_freq'] : ''}, #{hard['cpus_per_node_str']}, #{hard['cores_per_cpu_str']})"
@@ -375,7 +380,7 @@ def get_hardware(sites)
375380
if e[1] == 1
376381
"<b>#{size}&nbsp;#{e[0]['tech']}</b>"
377382
else
378-
"<b>1&nbsp;x&nbsp;#{size}&nbsp;#{e[0]['tech']}</b>" + ' +&nbsp;' + (e[1] - 1).to_s + "&nbsp;x&nbsp;#{size}&nbsp;#{e[0]['tech']}" + (e[0]['reservation'] ? '[[Disk_reservation|*]]' : '')
383+
"<b>#{size}&nbsp;#{e[0]['tech']}</b>" + ' +&nbsp;' + ((remainder = e[1] - 1) == 1 ? '' : "#{remainder}&nbsp;x&nbsp;") + "#{size}&nbsp;#{e[0]['tech']}" + (e[0]['reservation'] ? '[[Disk_reservation|*]]' : '')
379384
end
380385
else
381386
if e[1] == 1

lib/refrepo/gen/wiki/mw_utils.rb

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -164,13 +164,20 @@ def self.generate_table(table_options, columns, rows)
164164

165165
table_text += MW::LINE_FEED + MW::TABLE_ROW + MW::LINE_FEED
166166

167-
columns.each { |col|
168-
if col.kind_of?(Hash)
169-
table_text += MW::TABLE_HEADER + col[:attributes] + MW::TABLE_CELL + col[:text] + MW::LINE_FEED
170-
else
171-
table_text += MW::TABLE_HEADER + MW::TABLE_CELL + col + MW::LINE_FEED
167+
# A bit hacky, we want generate_table to work with an array or with an
168+
# array of array for mulitline header
169+
columns = [columns] unless columns.first.kind_of?(Array)
170+
171+
columns.each do |headers_row|
172+
headers_row.each do |col|
173+
if col.kind_of?(Hash)
174+
table_text += MW::TABLE_HEADER + col[:attributes] + MW::TABLE_CELL + col[:text] + MW::LINE_FEED
175+
else
176+
table_text += MW::TABLE_HEADER + MW::TABLE_CELL + col + MW::LINE_FEED
177+
end
172178
end
173-
}
179+
table_text += MW::TABLE_ROW + MW::LINE_FEED
180+
end
174181

175182
rows.each { |row|
176183
if row.kind_of?(Hash) and row[:sort] == false
@@ -181,7 +188,7 @@ def self.generate_table(table_options, columns, rows)
181188
table_cell = MW::TABLE_CELL
182189
inline_cell = MW::INLINE_CELL
183190
end
184-
table_text += MW::TABLE_ROW + MW::LINE_FEED
191+
table_text += MW::LINE_FEED
185192
row.each_with_index{ |cell, i|
186193
if (i == 0)
187194
table_text += table_cell
@@ -190,7 +197,7 @@ def self.generate_table(table_options, columns, rows)
190197
end
191198
table_text += cell.to_s
192199
}
193-
table_text += MW::LINE_FEED
200+
table_text += MW::LINE_FEED + MW::TABLE_ROW
194201
}
195202
table_text += MW::LINE_FEED + MW::TABLE_END
196203
return table_text

0 commit comments

Comments
 (0)