diff --git a/lib/refrepo/gen/wiki/generators/site_hardware.rb b/lib/refrepo/gen/wiki/generators/site_hardware.rb index c461c1133554d9e935f4b2c27b6c116cd19304f7..7c76a281ae8db3244405072507a8cb8c4d9f0f96 100644 --- a/lib/refrepo/gen/wiki/generators/site_hardware.rb +++ b/lib/refrepo/gen/wiki/generators/site_hardware.rb @@ -117,15 +117,19 @@ class SiteHardwareGenerator < WikiGenerator access_conditions << "<b>#{queue}</b> queue" end access_conditions << '<b>[[Getting_Started#Selecting_specific_resources|exotic]]</b> job type' if cluster_hash.map { |_k, v| v['exotic']}.first - 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']) + table_columns = [] + 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'}]) + table_columns << [{ attributes: 'data-sort-type="number"', text: '#' }, 'Name', { attributes: 'data-sort-type="number"', text: 'Cores' }, 'Architecture' ] data = partition(cluster_hash) table_data << (with_sites == true ? ["[[#{site.capitalize}:Hardware|#{site.capitalize}]]"] : []) + [ (with_sites == true ? "[[#{site.capitalize}:Hardware##{cluster_uid}" + "|#{cluster_uid}]]" : "[[##{cluster_uid}" + "|#{cluster_uid}]]"), access_conditions.join(",<br/>"), cell_data(data, 'date'), cluster_nodes, - cell_data(data, 'num_processor_model'), + cell_data(data, 'cpus_per_node'), + cell_data(data, 'processor_model'), cell_data(data, 'cores_per_cpu_str'), + cell_data(data, 'architecture'), sort_data(data, 'ram_size') + (!data['pmem_size'].nil? ? " + #{cell_data(data, 'pmem_size')} [[PMEM]]" : ''), 'data-sort-value="' + sort_data(data, 'storage_size') + '"|' + cell_data(data, 'storage'), 'data-sort-value="' + sort_data(data, 'network_throughput') + '"|' + cell_data(data, 'used_networks') @@ -360,6 +364,7 @@ def get_hardware(sites) hard['cpus_per_node_str'] = hard['cpus_per_node'].to_s + ' ' + G5K.pluralize(hard['cpus_per_node'], 'CPU') + '/node' hard['cores_per_cpu'] = node_hash['architecture']['nb_cores'] / hard['cpus_per_node'] hard['cores_per_cpu_str'] = hard['cores_per_cpu'].to_s + ' ' + G5K.pluralize(hard['cores_per_cpu'], 'core') + '/CPU' + hard['architecture'] = node_hash['architecture']['platform_type'] exotic_archname = get_exotic_archname(node_hash['architecture']['platform_type']) hard['num_processor_model'] = (hard['cpus_per_node'] == 1 ? '' : "#{hard['cpus_per_node']} x ") + (exotic_archname ? "#{exotic_archname} " : '') + hard['processor_model'].gsub(' ', ' ') 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) if e[1] == 1 "<b>#{size} #{e[0]['tech']}</b>" else - "<b>1 x #{size} #{e[0]['tech']}</b>" + ' + ' + (e[1] - 1).to_s + " x #{size} #{e[0]['tech']}" + (e[0]['reservation'] ? '[[Disk_reservation|*]]' : '') + "<b>#{size} #{e[0]['tech']}</b>" + ' + ' + ((remainder = e[1] - 1) == 1 ? '' : "#{remainder} x ") + "#{size} #{e[0]['tech']}" + (e[0]['reservation'] ? '[[Disk_reservation|*]]' : '') end else if e[1] == 1 diff --git a/lib/refrepo/gen/wiki/mw_utils.rb b/lib/refrepo/gen/wiki/mw_utils.rb index 3773e950e3d6c581b11f44b33639a5777234fcc4..690051cd9443197d899ab1fa9a23a1f6ed7ecddc 100644 --- a/lib/refrepo/gen/wiki/mw_utils.rb +++ b/lib/refrepo/gen/wiki/mw_utils.rb @@ -164,13 +164,20 @@ module MW table_text += MW::LINE_FEED + MW::TABLE_ROW + MW::LINE_FEED - columns.each { |col| - if col.kind_of?(Hash) - table_text += MW::TABLE_HEADER + col[:attributes] + MW::TABLE_CELL + col[:text] + MW::LINE_FEED - else - table_text += MW::TABLE_HEADER + MW::TABLE_CELL + col + MW::LINE_FEED + # A bit hacky, we want generate_table to work with an array or with an + # array of array for mulitline header + columns = [columns] unless columns.first.kind_of?(Array) + + columns.each do |headers_row| + headers_row.each do |col| + if col.kind_of?(Hash) + table_text += MW::TABLE_HEADER + col[:attributes] + MW::TABLE_CELL + col[:text] + MW::LINE_FEED + else + table_text += MW::TABLE_HEADER + MW::TABLE_CELL + col + MW::LINE_FEED + end end - } + table_text += MW::TABLE_ROW + MW::LINE_FEED + end rows.each { |row| if row.kind_of?(Hash) and row[:sort] == false @@ -181,7 +188,7 @@ module MW table_cell = MW::TABLE_CELL inline_cell = MW::INLINE_CELL end - table_text += MW::TABLE_ROW + MW::LINE_FEED + table_text += MW::LINE_FEED row.each_with_index{ |cell, i| if (i == 0) table_text += table_cell @@ -190,7 +197,7 @@ module MW end table_text += cell.to_s } - table_text += MW::LINE_FEED + table_text += MW::LINE_FEED + MW::TABLE_ROW } table_text += MW::LINE_FEED + MW::TABLE_END return table_text