Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
grid5000
reference-repository
Commits
e0823063
Commit
e0823063
authored
May 08, 2018
by
Lucas Nussbaum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a one-line summary before the clusters table
parent
28b07427
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
generators/wiki/site_hardware.rb
generators/wiki/site_hardware.rb
+18
-0
No files found.
generators/wiki/site_hardware.rb
View file @
e0823063
...
...
@@ -18,6 +18,7 @@ class SiteHardwareGenerator < WikiGenerator
@generated_content
=
"__NOTOC__
\n
__NOEDITSECTION__
\n
"
@generated_content
+=
"<div class=
\"
sitelink
\"
>[[Hardware|Global]] | "
+
G5K
::
SITES
.
map
{
|
e
|
"[[
#{
e
.
capitalize
}
:Hardware|
#{
e
.
capitalize
}
]]"
}.
join
(
" | "
)
+
"</div>
\n
"
@generated_content
+=
"
\n
= Summary =
\n
"
@generated_content
+=
"'''
#{
generate_oneline_summary
}
'''
\n
"
@generated_content
+=
self
.
class
.
generate_summary
(
@site
,
false
)
@generated_content
+=
self
.
class
.
generate_description
(
@site
)
@generated_content
+=
MW
.
italic
(
MW
.
small
(
'Generated from the Grid5000 APIs on '
+
Time
.
now
.
strftime
(
'%Y-%m-%d'
)))
...
...
@@ -34,6 +35,23 @@ class SiteHardwareGenerator < WikiGenerator
MW
.
generate_table
(
'class="wikitable sortable"'
,
table_columns
,
table_data
)
+
"
\n
"
end
def
generate_oneline_summary
h
=
G5K
::
get_global_hash
[
'sites'
][
@site
]
# remove retired nodes
# FIXME this should probably move to a helper
h
[
'clusters'
].
each_pair
do
|
cl
,
v
|
v
[
'nodes'
].
delete_if
{
|
n
,
v
|
v
[
'status'
]
==
'retired'
}
end
h
[
'clusters'
].
delete_if
{
|
k
,
v
|
v
[
'nodes'
].
empty?
}
clusters
=
h
[
'clusters'
].
length
nodes
=
h
[
'clusters'
].
inject
(
0
)
{
|
a
,
b
|
a
+
b
[
1
][
'nodes'
].
values
.
length
}
cores
=
h
[
'clusters'
].
inject
(
0
)
{
|
a
,
b
|
cnodes
=
b
[
1
][
'nodes'
].
values
;
a
+
cnodes
.
length
*
cnodes
.
first
[
'architecture'
][
'nb_cores'
]
}
flops
=
h
[
'clusters'
].
inject
(
0
)
{
|
a
,
b
|
cnodes
=
b
[
1
][
'nodes'
].
values
;
a
+
cnodes
.
length
*
(
cnodes
.
first
[
'performance'
][
'node_flops'
]
rescue
0
)
}
tflops
=
sprintf
(
"%.1f"
,
flops
.
to_f
/
(
10
**
12
))
return
"
#{
clusters
}
cluster
#{
clusters
>
1
?
's'
:
''
}
,
#{
nodes
}
node
#{
nodes
>
1
?
's'
:
''
}
,
#{
cores
}
core
#{
cores
>
1
?
's'
:
''
}
,
#{
tflops
}
TFLOPS"
end
def
self
.
generate_summary
(
site
,
with_sites
)
table_columns
,
table_data
=
self
.
generate_summary_data
(
site
,
with_sites
)
MW
.
generate_table
(
'class="wikitable sortable"'
,
table_columns
,
table_data
)
+
"
\n
"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment