Skip to content

Commit fa8f5c8

Browse files
committed
Merge branch '9870-gen-wiki-status' into 'master'
add a wiki generator for the Status page See merge request grid5000/reference-repository!47
2 parents 5a6a2be + 1df7227 commit fa8f5c8

File tree

2 files changed

+221
-0
lines changed

2 files changed

+221
-0
lines changed

lib/refrepo/gen/wiki.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'refrepo/gen/wiki/generators/oar_properties'
77
require 'refrepo/gen/wiki/generators/site_hardware'
88
require 'refrepo/gen/wiki/generators/site_network'
9+
require 'refrepo/gen/wiki/generators/status'
910

1011
module RefRepo::Gen::Wiki
1112

@@ -22,6 +23,10 @@ module RefRepo::Gen::Wiki
2223
:gen => G5KHardwareGenerator,
2324
:page => 'Hardware'
2425
},
26+
'status' => {
27+
:gen => StatusGenerator,
28+
:page => 'Status'
29+
},
2530
'oar_properties' => {
2631
:gen => OarPropertiesGenerator,
2732
:page => 'OAR_Properties'
Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
# coding: utf-8
2+
3+
class StatusGenerator < WikiGenerator
4+
5+
def initialize(page_name)
6+
super(page_name)
7+
end
8+
9+
def generate_content
10+
@global_hash = get_global_hash
11+
@site_uids = G5K::SITES
12+
13+
@generated_content = "__NOEDITSECTION__\n"
14+
@generated_content += "{{Status|In production}}\n"
15+
@generated_content += "{{Portal|User}}\n"
16+
@generated_content += "{{Portal|Platform}}\n"
17+
@generated_content += "\n= [https://www.grid5000.fr/status/ Current platform events] (maintenance, outages, issues...) =\n"
18+
@generated_content += "If you experience problems, please check '''[https://www.grid5000.fr/status/ the platform's operation schedule]''' ''(Past, present and future incidents (planned or not...) are notified for all sites).''\n"
19+
@generated_content += MW::LINE_FEED
20+
@generated_content += MW::LINE_FEED
21+
@generated_content += "For other long running minor issue that may affect your experiment, you can check the list of known artifacts : '''[https://intranet.grid5000.fr/status/artifact/ Grid5000 Artifacts]''' ''(this list is also displayed when you connect on frontends).''\n"
22+
@generated_content += MW::LINE_FEED
23+
@generated_content += generate_resources_reservations
24+
@generated_content += MW::LINE_FEED
25+
@generated_content += generate_network_monitoring
26+
@generated_content += MW::LINE_FEED
27+
@generated_content += generate_power_monitoring
28+
@generated_content += MW::LINE_FEED
29+
@generated_content += generate_usage_statistics
30+
@generated_content += MW::LINE_FEED
31+
@generated_content += generate_ganglia
32+
@generated_content += MW::LINE_FEED
33+
@generated_content += generate_jenkins
34+
@generated_content += MW.italic(MW.small(generated_date_string))
35+
@generated_content += MW::LINE_FEED
36+
end
37+
38+
def generate_resources_reservations
39+
data = "= Resources reservations (OAR) status =\n"
40+
data += MW::LINE_FEED
41+
data += "{|\n"
42+
data += "|bgcolor=\"#aaaaaa\" colspan=\"8\"|\n"
43+
data += "'''Monika''' ''(current placement and queued jobs status)''\n"
44+
data += "|-\n"
45+
46+
# Loop over Grid'5000 sites for Monika's links
47+
@site_uids.sort.each do |site_uid|
48+
if has_queue_production?(site_uid)
49+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
50+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/monika.cgi '''#{site_uid.capitalize}''']<br>\n"
51+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/monika-prod.cgi '''#{site_uid.capitalize} (production)''']\n"
52+
else
53+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
54+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/monika.cgi '''#{site_uid.capitalize}''']\n"
55+
end
56+
end
57+
58+
data += "|-\n"
59+
data += "|bgcolor=\"#aaaaaa\" colspan=\"8\"|\n"
60+
data += "'''Drawgantt''' ''(past, current and future OAR jobs scheduling)''\n"
61+
data += "|-\n"
62+
data += "|bgcolor=\"#eeeeee\" colspan=\"8\"|\n"
63+
data += "Default view:\n"
64+
data += "|-\n"
65+
66+
# Loop over Grid'5000 sites for Drawgantt's links
67+
@site_uids.sort.each do |site_uid|
68+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
69+
data += "<big>'''#{site_uid.capitalize}'''</big><br>\n"
70+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg/ '''nodes''']<br>\n"
71+
if has_queue_production?(site_uid)
72+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-prod/ '''nodes (production)''']<br>\n"
73+
end
74+
if has_reservable_disks?(site_uid)
75+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-disks/ disks]<br>\n"
76+
end
77+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-subnets/ subnets]<br>\n"
78+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-vlans/ vlans]\n"
79+
end
80+
81+
data += "|-\n"
82+
data += "|bgcolor=\"#eeeeee\" colspan=\"8\"|\n"
83+
data += "Forecast view for 1 week:\n"
84+
data += "|-\n"
85+
86+
# Loop over Grid'5000 sites for Drawgantt's weekly links
87+
@site_uids.sort.each do |site_uid|
88+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
89+
data += "<big>'''#{site_uid.capitalize}'''</big><br>\n"
90+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg/?relative_start=-28800&relative_stop=604800 '''nodes''']<br>\n"
91+
if has_queue_production?(site_uid)
92+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-prod/?relative_start=-28800&relative_stop=604800 '''nodes (production)''']<br>\n"
93+
end
94+
if has_reservable_disks?(site_uid)
95+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-disks/?relative_start=-28800&relative_stop=604800 disks]<br>\n"
96+
end
97+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-subnets/?relative_start=-28800&relative_stop=604800 subnets]<br>\n"
98+
data += "[https://intranet.grid5000.fr/oar/#{site_uid.capitalize}/drawgantt-svg-vlans/?relative_start=-28800&relative_stop=604800 vlans]\n"
99+
end
100+
101+
data += "|}\n"
102+
end
103+
104+
def generate_network_monitoring
105+
data = "= Network Monitoring =\n"
106+
data += "== Backbone network status and load ==\n"
107+
data += "[http://pasillo.renater.fr/weathermap/weathermap_g5k.html Grid'5000 Weathermap] (courtesy of Renater)\n"
108+
data += MW::LINE_FEED
109+
data += "Shows the actual state of the opticals links between the Grid'5000 10Gb-ready sites. A link painted in black on the weathermap means that you won't be able to access this site nodes from the Grid'5000 internal network.\n"
110+
data += MW::LINE_FEED
111+
data += "== Sites network traffic ==\n"
112+
data += MW::LINE_FEED
113+
data + "A dashboard combining links and real-time data is available on the [https://intranet.grid5000.fr/net/Lille/ Grid'5000 Backbone Network Monitoring] page.\n"
114+
end
115+
116+
def generate_power_monitoring
117+
data = "= Power Monitoring =\n"
118+
data += MW::LINE_FEED
119+
data += "{|\n"
120+
@site_uids.sort.each do |site_uid|
121+
if has_power_monitoring?(site_uid)
122+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
123+
data += "[https://intranet.grid5000.fr/supervision/#{site_uid}/monitoring/energy/last/minute/ '''#{site_uid.capitalize}''']\n"
124+
end
125+
end
126+
127+
data += "|}\n"
128+
data += MW::LINE_FEED
129+
data += "Clusters where kwapi is available are listed on this page : https://intranet.grid5000.fr/jenkins-status/?job=test_kwapi\n"
130+
end
131+
132+
def generate_usage_statistics
133+
data = "= Usage statistics =\n"
134+
data + "[https://intranet.grid5000.fr/stats/ Stats5k] gathers a lot of statistics about the testbed.\n"
135+
end
136+
137+
def generate_ganglia
138+
data = "= Ganglia =\n"
139+
data + "[https://intranet.grid5000.fr/ganglia/ Ganglia] provides resources usage metrics (memory, cpu, jobs...) for individual sites or the whole platform.\n"
140+
end
141+
142+
def generate_jenkins
143+
data = "= Jenkins =\n"
144+
data += "[https://intranet.grid5000.fr/jenkins-status/ Jenkins] tests most of Grid'5000 services. The web interface provides a summary of results, indicating platform health. Detailed logs are not normally available to users, but access can be requested if needed.\n"
145+
data += MW::LINE_FEED
146+
data += "{|\n"
147+
148+
@site_uids.sort.each do |site_uid|
149+
data += "|bgcolor=\"#ffffff\" valign=\"top\" style=\"border:1px solid #cccccc;padding:1em;padding-top:0.5em;\"|\n"
150+
data += "[https://intranet.grid5000.fr/jenkins-status/?site=#{site_uid} '''#{site_uid.capitalize}''']\n"
151+
end
152+
153+
data += "|}\n"
154+
end
155+
156+
def has_reservable_disks?(site)
157+
site_hash = @global_hash["sites"][site]
158+
site_hash["clusters"].each_value do |cluster_hash|
159+
cluster_hash.fetch('nodes').each_value do |node_hash|
160+
sd = node_hash['storage_devices']
161+
reservable_disks = sd.select{ |v| v['reservation'] == true }.count > 0
162+
163+
if reservable_disks
164+
return true
165+
end
166+
end
167+
end
168+
169+
false
170+
end
171+
172+
def has_queue_production?(site)
173+
site_hash = @global_hash["sites"][site]
174+
site_hash["clusters"].each_value do |cluster_hash|
175+
if cluster_hash["queues"].include?("production")
176+
return true
177+
end
178+
end
179+
180+
false
181+
end
182+
183+
def has_power_monitoring?(site)
184+
site_hash = @global_hash["sites"][site]
185+
site_hash["clusters"].each_value do |cluster_hash|
186+
cluster_hash.fetch("nodes").each_value do | node_hash|
187+
if node_hash["sensors"].has_key?("power") and node_hash["sensors"]["power"]["available"]
188+
return true
189+
end
190+
end
191+
end
192+
193+
false
194+
end
195+
end
196+
197+
if __FILE__ == $0
198+
generator = StatusGenerator.new("Status")
199+
200+
options = WikiGenerator::parse_options
201+
if (options)
202+
ret = 2
203+
begin
204+
ret = generator.exec(options)
205+
rescue MediawikiApi::ApiError => e
206+
puts e, e.backtrace
207+
ret = 3
208+
rescue StandardError => e
209+
puts "Error with node: #{generator.instance_variable_get(:@node)}"
210+
puts e, e.backtrace
211+
ret = 4
212+
ensure
213+
exit(ret)
214+
end
215+
end
216+
end

0 commit comments

Comments
 (0)