Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nomad-FAIR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nomad-lab
nomad-FAIR
Commits
5d6e8e49
Commit
5d6e8e49
authored
5 years ago
by
Markus Scheidgen
Browse files
Options
Downloads
Patches
Plain Diff
Minor changes to the statistics command.
parent
493cb626
No related branches found
No related tags found
1 merge request
!60
v0.6.0 Release
Pipeline
#60659
passed
5 years ago
Stage: build
Stage: test
Stage: release
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nomad/cli/client/statistics.py
+14
-11
14 additions, 11 deletions
nomad/cli/client/statistics.py
with
14 additions
and
11 deletions
nomad/cli/client/statistics.py
+
14
−
11
View file @
5d6e8e49
...
...
@@ -32,7 +32,7 @@ def codes(client, minimum=1, **kwargs):
x_values
=
sorted
([
code
for
code
,
values
in
data
.
quantities
[
'
code_name
'
].
items
()
if
code
!=
'
not processed
'
and
values
[
'
code_runs
'
]
>=
minimum
],
key
=
lambda
x
:
x
.
lower
())
if
code
!=
'
not processed
'
and
values
.
get
(
'
calculations
'
,
1000
)
>=
minimum
],
key
=
lambda
x
:
x
.
lower
())
return
data
.
quantities
,
x_values
,
'
code_name
'
,
'
code
'
...
...
@@ -167,14 +167,12 @@ class Metric:
axis
.
bar
(
x_positions
,
y_values
,
width
,
label
=
self
.
label
,
color
=
color
,
align
=
'
edge
'
)
axis
.
tick_params
(
axis
=
'
y
'
,
labelcolor
=
label_color
)
for
x
,
v
in
zip
(
x_positions
,
y_values
):
axis
.
text
(
x
+
.
1
,
v
,
'
{:,}
'
.
format
(
int
(
v
)),
color
=
color
,
fontweight
=
'
bold
'
,
rotation
=
90
)
# TODO remove
if
color
.
endswith
(
'
red
'
):
import
matplotlib.lines
as
mlines
line
=
mlines
.
Line2D
([
min
(
x_positions
),
max
(
x_positions
)],
[
80
,
80
],
color
=
color
)
axis
.
add_line
(
line
)
# for x, v in zip(x_positions, y_values):
# axis.text(x + .1, v, ' {:,}'.format(int(v)), color=color, fontweight='bold', rotation=90)
# import matplotlib.lines as mlines
# line = mlines.Line2D([min(x_positions), max(x_positions)], [72, 72], color=color)
# axis.add_line(line)
def
bar_plot
(
client
,
retrieve
,
metric1
,
metric2
=
None
,
title
=
None
,
**
kwargs
):
...
...
@@ -205,10 +203,13 @@ def bar_plot(client, retrieve, metric1, metric2=None, title=None, **kwargs):
ax1
.
set_title
(
title
)
metric1
.
draw_axis
(
ax1
,
data
,
x_values
,
x
-
(
width
/
2
),
width
,
'
tab:blue
'
,
only
=
metric2
is
None
)
ax1
.
set_ylim
(
bottom
=
1
)
if
metric2
:
ax2
=
ax1
.
twinx
()
# instantiate a second axes that shares the same x-axis
metric2
.
draw_axis
(
ax2
,
data
,
x_values
,
x
+
width
/
2
,
width
,
'
tab:red
'
)
metric2
.
draw_axis
(
ax2
,
data
,
x_values
,
x
+
width
/
2
,
width
,
'
tab:red
'
)
ax2
.
set_ylim
(
bottom
=
1
)
fig
.
tight_layout
()
...
...
@@ -317,7 +318,7 @@ def statistics(errors, title, x_axis, y_axis, cumulate, total, save, power, open
y_axis
=
[
metrics
[
y
]
for
y
in
y_axis
]
fig
,
plt
=
bar_plot
(
client
,
x_axis
,
*
y_axis
,
title
=
title
,
owner
=
owner
,
minimum
=
minimum
,
code_name
=
"
VASP
"
)
fig
,
plt
=
bar_plot
(
client
,
x_axis
,
*
y_axis
,
title
=
title
,
owner
=
owner
,
minimum
=
minimum
)
if
errors
or
x_axis
is
not
None
:
if
save
is
not
None
:
...
...
@@ -326,5 +327,7 @@ def statistics(errors, title, x_axis, y_axis, cumulate, total, save, power, open
plt
.
show
()
if
total
:
data
=
client
.
repo
.
search
(
per_page
=
1
,
owner
=
owner
,
metrics
=
[
'
total_energies
'
,
'
calculations
'
,
'
users
'
,
'
datasets
'
]).
response
().
result
data
=
client
.
repo
.
search
(
per_page
=
1
,
owner
=
owner
,
metrics
=
[
'
total_energies
'
,
'
calculations
'
,
'
users
'
,
'
datasets
'
]).
response
().
result
print
(
json
.
dumps
(
data
.
quantities
[
'
total
'
],
indent
=
4
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment