Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
nomad-lab
nomad-FAIR
Commits
5c07df95
Commit
5c07df95
authored
Jan 08, 2020
by
Markus Scheidgen
Browse files
Enhanced geometry metrics suppport.
parent
46e9fdef
Changes
4
Hide whitespace changes
Inline
Side-by-side
gui/src/components/domains.js
View file @
5c07df95
...
...
@@ -84,10 +84,13 @@ class DomainProviderBase extends React.Component {
tooltip
:
'
Aggregates the number of single configuration calculations (e.g. total energy calculations) as each entry can contain many calculations.
'
,
renderResultString
:
count
=>
(
<
span
>
with
<
b
>
{
count
.
toLocaleString
()}
<
/b> single configuration calculation{count === 1
?
'' : 's'}</
span
>
)
},
unique_geometries
:
{
label
:
'
Unique geometries
'
,
// The unique_geometries search aggregates unique geometries based on 10^8 hashes.
// This takes to long in elastic search for a reasonable user experience.
// Therefore, we only support geometries without uniqueness check
geometries
:
{
label
:
'
Geometries
'
,
shortLabel
:
'
Geometries
'
,
tooltip
:
'
Aggregates the number of
unique
simulated system geometries in all entries.
'
,
tooltip
:
'
Aggregates the number of simulated system geometries in all entries.
'
,
renderResultString
:
count
=>
(
<
span
>
that
simulate
<
b
>
{
count
.
toLocaleString
()}
<
/b> unique geometrie{count === 1
?
'' : 's'}</
span
>
)
},
datasets
:
{
...
...
nomad/app/api/repo.py
View file @
5c07df95
...
...
@@ -270,6 +270,8 @@ class RepoCalcsResource(Resource):
search_request
.
totals
(
metrics_to_use
=
total_metrics
)
search_request
.
statistic
(
'authors'
,
1000
)
elif
len
(
metrics
)
>
0
:
search_request
.
totals
(
metrics_to_use
=
metrics
)
try
:
if
scroll
:
...
...
nomad/search.py
View file @
5c07df95
...
...
@@ -635,7 +635,7 @@ class SearchRequest:
def
_response
(
self
,
response
,
with_hits
:
bool
=
False
)
->
Dict
[
str
,
Any
]:
"""
Prepares a response object covering the total number of resu
t
ls, hits, statistics,
Prepares a response object covering the total number of resul
t
s, hits, statistics,
and quantities. Other aspects like pagination and scrolling have to be added
elsewhere.
"""
...
...
@@ -657,7 +657,7 @@ class SearchRequest:
agg_name
=
'metric:%s'
%
metric
if
agg_name
in
bucket
:
result
[
metric
]
=
bucket
[
agg_name
][
'value'
]
result
.
update
(
code_runs
=
code_runs
)
result
.
update
(
code_runs
=
code_runs
)
return
result
statistics_results
=
{
...
...
tests/app/test_api.py
View file @
5c07df95
...
...
@@ -23,6 +23,7 @@ import datetime
import
os.path
from
urllib.parse
import
urlencode
import
base64
import
itertools
from
nomad.app.utils
import
rfc3339DateTime
from
nomad.app.api.auth
import
generate_upload_token
...
...
@@ -873,9 +874,12 @@ class TestRepo():
rv
=
api
.
get
(
'/repo/?owner=admin'
)
assert
rv
.
status_code
==
401
@
pytest
.
mark
.
parametrize
(
'metrics'
,
metrics_permutations
)
def
test_search_total_metrics
(
self
,
api
,
example_elastic_calcs
,
no_warn
,
metrics
):
rv
=
api
.
get
(
'/repo/?%s'
%
urlencode
(
dict
(
metrics
=
metrics
,
statistics
=
True
,
datasets
=
True
,
uploads
=
True
),
doseq
=
True
))
@
pytest
.
mark
.
parametrize
(
'metrics, statistics'
,
itertools
.
product
(
metrics_permutations
,
[
True
,
False
]))
def
test_search_total_metrics
(
self
,
api
,
example_elastic_calcs
,
no_warn
,
metrics
,
statistics
):
query_params
=
dict
(
metrics
=
metrics
)
if
statistics
:
query_params
[
'statistics'
]
=
True
rv
=
api
.
get
(
'/repo/?%s'
%
urlencode
(
query_params
,
doseq
=
True
))
assert
rv
.
status_code
==
200
,
str
(
rv
.
data
)
data
=
json
.
loads
(
rv
.
data
)
total_metrics
=
data
.
get
(
'statistics'
,
{}).
get
(
'total'
,
{}).
get
(
'all'
,
None
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment