Skip to content

Commit 243c27e

Browse files
author
Pierre Neyron
committed
Merge branch '11674-update_wiki_oar_props' into 'master'
Update the OAR-Properties wiki page See merge request grid5000/reference-repository!100
2 parents 42fdee4 + 3d25146 commit 243c27e

File tree

3 files changed

+115
-36
lines changed

3 files changed

+115
-36
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ namespace :valid do
100100
end
101101

102102
namespace :gen do
103-
desc "Run wiki generator -- parameters: NAME={hardware,site_hardware,...} SITE={global,grenoble,...} DO={diff,print,update}"
103+
desc "Run wiki generator -- parameters: NAME={hardware,site_hardware,oar-properties,...} SITE={global,grenoble,...} DO={diff,print,update}"
104104
task "wiki" do
105105
require 'refrepo/gen/wiki'
106106
options = {}

lib/refrepo/gen/oar-properties.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,7 @@ def get_ref_node_properties_internal(cluster_uid, cluster, node_uid, node)
403403
h['cputype'] = [node['processor']['model'], node['processor']['version']].join(' ')
404404
h['cpufreq'] = node['processor']['clock_speed'] / 1_000_000_000.0
405405
h['disktype'] = (node['storage_devices'].first || {})['interface']
406+
h['chassis'] = [node['chassis']['manufacturer'], node['chassis']['name'], node['chassis']['serial']].join(' ')
406407

407408
# ETH
408409
ni_mountable = node['network_adapters'].select { |na| /^eth[0-9]*$/.match(na['device']) && (na['enabled'] == true && (na['mounted'] == true || na['mountable'] == true)) }
@@ -763,8 +764,6 @@ def ignore_default_keys()
763764
"id", # id from API (= resource_id from oarnodes)
764765
"api_timestamp", # from API
765766
"links", # from API
766-
"gpu", # temporary hack, waiting for the new generator that will handle gpu
767-
"gpudevice", # temporary hack, waiting for the new generator that will handle gpu
768767
]
769768
return ignore_default_keys
770769
end

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

Lines changed: 113 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def initialize(page_name)
3232
"description" => "Is this resource available in production queue ?",
3333
"value_type" => "Boolean"
3434
},
35+
"chassis" => {
36+
"description" => "The manfacturer, name and serial of the chassis."
37+
},
3538
"cluster" => {
3639
"description" => "The name of the cluster the resource is part of"
3740
},
@@ -43,24 +46,78 @@ def initialize(page_name)
4346
"description" => "The ID of the CPU the resource is part of. The unique scope is the OAR server. ",
4447
"possible_values" => "1, 2, 3, ..."
4548
},
49+
"cpuset" => {
50+
"description" => "Logical processor identifier (only the first thread in case of HyperThreading).",
51+
"possible_values" => "0, 1, 2, 3, ..."
52+
},
53+
"disk" => {
54+
"description" => "Id of a reservable disk on a node, for resources of type 'disk'.",
55+
},
56+
"diskpath" => {
57+
"description" => "Device path of a reservable disk on a node, for resources of type 'disk'.",
58+
},
4659
"gpu" => {
4760
"description" => "The ID of the GPU the resource is part of. The unique scope is the OAR server. ",
4861
"possible_values" => "1, 2, 3, ..."
4962
},
63+
"gpudevice" => {
64+
"description" => "GPU device identifier.",
65+
"possible_values" => "0, 1, 2, 3"
66+
},
5067
"host" => {
51-
"description" => "A user-friendly name for the network_address property",
68+
"description" => "The full hostname of the node the resource is part of.",
5269
"possible_values" => "dahu-1.grenoble.grid5000.fr, ..."
5370
},
5471
"ip" => {
5572
"description" => "The IPv4 address of the node the resource is part of"
5673
},
5774
"network_address" => {
58-
"description" => "The full hostname of the node the resource is part of",
75+
"description" => "The full hostname of the node the resource is part of, please use 'host' instead.",
5976
"possible_values" => "dahu-1.grenoble.grid5000.fr, ..."
6077
},
78+
"slash_16" => {
79+
"description" => "Used for subnet resources.",
80+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
81+
},
82+
"slash_17" => {
83+
"description" => "Used for subnet resources.",
84+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
85+
},
86+
"slash_18" => {
87+
"description" => "Used for subnet resources.",
88+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
89+
},
90+
"slash_19" => {
91+
"description" => "Used for subnet resources.",
92+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
93+
},
94+
"slash_20" => {
95+
"description" => "Used for subnet resources.",
96+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
97+
},
98+
"slash_21" => {
99+
"description" => "Used for subnet resources.",
100+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
101+
},
102+
"slash_22" => {
103+
"description" => "Used for subnet resources.",
104+
"possible_values" => "3d92, 00e6, 2cfc, 2bed, ..."
105+
},
61106
"switch" => {
62107
"description" => "On what switch the resource is directly connected ?"
63108
},
109+
"subnet_address" => {
110+
"description" => "Subnet address for subnet resources.",
111+
"possible_values" => "10.144.52.0, 10.144.24.0, 10.144.132.0, 10.146.28.0, 10.144.236.0, ..."
112+
},
113+
"subnet_prefix" => {
114+
"description" => "Subnet prefix for subnet resources.",
115+
"possible_values" => "22"
116+
},
117+
"vlan" => {
118+
"description" => "Used for kavlan-topo resources.",
119+
"possible_values" => "1, 1523, 1560, 1597, ..."
120+
},
64121
"nodemodel" => {
65122
"description" => "The type of the chassis"
66123
},
@@ -136,34 +193,37 @@ def initialize(page_name)
136193
"mic" => {
137194
"description" => "Intel many integrated core architecture support",
138195
"value_type" => "Boolean"
196+
},
197+
"type" => {
198+
"description" => "Type of the resource.",
199+
"possible_values" => "kavlan-topo, storage, disk, kavlan-local, kavlan-global, default, subnet, kavlan"
200+
},
201+
"expiry_date" => {
202+
"description" => "Expiration date for the given resource.",
203+
"possible_values" => "0"
204+
},
205+
"comment" => {
206+
"description" => "Comment for the given resource. (g5k internal property)",
207+
"possible_values" => "Retired since 2018-01-30: retired_cluster, PSU Dead, Retired"
208+
},
209+
"maintenance" => {
210+
"description" => "Is this resource under maintenance ?",
211+
"value_type" => "Boolean",
212+
"possible_values" => "YES, NO"
139213
}
140214
}
141215

142216
#Group properties by categories
143217
@@categories = {
144218
"Job-related properties" => ["besteffort", "deploy", "production", "cluster_priority", "max_walltime"],
145-
"Hierarchy" => ["cluster", "cpu", "core", "host", "network_address", "ip", "switch"],
219+
"Hierarchy" => ["chassis", "cluster", "cpu", "cpuset", "core", "disk", "diskpath", "gpu", "gpudevice", "host", "slash_16", "slash_17", "slash_18", "slash_19", "slash_20", "slash_21", "slash_22", "switch", "subnet_address", "subnet_prefix", "vlan"],
146220
"Hardware" => ["gpu_model", "gpu_count", "memnode", "memcore", "memcpu", "disktype", "disk_reservation_count", "myri_rate", "myri_count", "myri", "ib_rate", "ib_count", "ib", "opa_rate", "opa_count", "eth_rate", "eth_count", "cpufreq", "cputype", "cpucore", "cpuarch", "virtual", "mic"],
147-
"Miscellaneous" => ["wattmeter", "nodemodel"]
221+
"Miscellaneous" => ["wattmeter", "nodemodel", "network_address", "ip", "type", "expiry_date", "comment", "maintenance"]
148222
}
149223

150224
#Existing properties that won't be documented
151225
@@ignored_properties = ["maintenance", "state", "ip_virtual"]
152226

153-
def get_nodes_properties(_site_uid, site)
154-
properties = {}
155-
site['clusters'].sort.to_h.each do |cluster_uid, cluster|
156-
cluster['nodes'].sort.to_h.each do |node_uid, node|
157-
begin
158-
properties[node_uid] = get_ref_node_properties_internal(cluster_uid, cluster, node_uid, node)
159-
rescue MissingProperty => e
160-
puts "Error while processing node #{node_uid}: #{e}"
161-
end
162-
end
163-
end
164-
return properties
165-
end
166-
167227
def get_value_type(prop, values)
168228
if (@@properties[prop]["value_type"])
169229
return @@properties[prop]["value_type"]
@@ -183,38 +243,58 @@ def generate_content
183243
refapi = load_data_hierarchy
184244
#Properties generated from oar-properties generator
185245
props = {}
186-
G5K::SITES.each{ |site_uid|
187-
props[site_uid] = get_nodes_properties(site_uid, refapi["sites"][site_uid])
246+
oar_data_properties = []
247+
G5K::SITES.each_with_index{ |site_uid, index|
248+
props[site_uid] = {}
249+
props[site_uid]["default"] = get_ref_default_properties(site_uid, refapi["sites"][site_uid])
250+
props[site_uid]["disk"] = get_ref_disk_properties(site_uid, refapi["sites"][site_uid])
251+
252+
# Retrieve all oar fields from the first site
253+
if index == 0
254+
get_oar_data(site_uid, {"api": {}, "verbose": false}).each { |oar_node_data, _|
255+
oar_node_data.each { |key, _|
256+
oar_data_properties << key unless oar_data_properties.include? key
257+
}
258+
}
259+
end
188260
}
189261

190262
#Compiled properties used to generate page
191263
oar_properties = {}
192264
props.sort.to_h.each { |site, site_props|
193-
site_props.sort.to_h.each { |node_uid, node_props|
194-
node_props.sort.to_h.each { |property, value|
195-
next if @@ignored_properties.include?(property)
196-
197-
oar_properties[property] ||= {}
198-
oar_properties[property]["values"] ||= []
199-
oar_properties[property]["values"] << value unless value.nil?
200-
oar_properties[property]["values"].uniq!
201-
oar_properties[property]["values"].sort!{ |a, b|
202-
(a && a.to_s || "") <=> (b && b.to_s || "")
265+
site_props.sort.to_h.each { |type, type_props|
266+
type_props.sort.to_h.each { |node_uid, node_props|
267+
node_props.sort.to_h.each { |property, value|
268+
next if @@ignored_properties.include?(property)
269+
270+
oar_properties[property] ||= {}
271+
oar_properties[property]["values"] ||= []
272+
oar_properties[property]["values"] << value unless value.nil?
273+
oar_properties[property]["values"].uniq!
274+
oar_properties[property]["values"].sort!{ |a, b|
275+
(a && a.to_s || "") <=> (b && b.to_s || "")
276+
}
203277
}
204278
}
205279
}
206280
}
207281
oar_properties.sort.to_h.each { |prop, prop_hash|
208282
prop_hash["values"].sort!
209283
if (prop_hash["values"].length > 20)
210-
#Limit possible values to 20 elements and mark the list as truncated
211-
prop_hash["values"].slice!(0...-20)
284+
#Limit possible values to 20 random elements and mark the list as truncated
285+
prop_hash["values"] = prop_hash["values"].sample(20).sort
212286
prop_hash["values"].push("...")
213287
end
214-
@@properties[prop]["possible_values"] ||= prop_hash["values"].join(", ")
288+
@@properties[prop]["possible_values"] ||= prop_hash["values"].join(", ") unless @@properties[prop].nil?
215289
}
216290

291+
# Compare properties with fields from oar db
292+
oar_data_properties.reject!{|x| (@@properties.keys.include? x or @@ignored_properties.include? x)}
293+
217294
@generated_content = "{{Portal|User}}\nProperties on resources managed by OAR allow users to select them according to their experiment's characteristics." + MW::LINE_FEED
295+
if not oar_data_properties.empty?
296+
@generated_content += "{{Warning|text=Following properties are not documented : " + oar_data_properties.sort.join(', ') + "}}" + MW::LINE_FEED
297+
end
218298
@generated_content += MW::heading("OAR Properties", 1) + MW::LINE_FEED
219299

220300
@@categories.sort.to_h.each { |cat, cat_properties|

0 commit comments

Comments
 (0)