Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
On Thursday, 7th July from 1 to 3 pm there will be a maintenance with a short downtime of GitLab.
Open sidebar
nomad-lab
encyclopedia-physics-engine
Commits
bebc17fe
Commit
bebc17fe
authored
Aug 15, 2018
by
Markus Scheidgen
Browse files
Applied hotfix for not configured schema name uses.
parent
7fa7654c
Changes
1
Hide whitespace changes
Inline
Side-by-side
rest-api-service/app/api_v1_0/routes.py
View file @
bebc17fe
...
...
@@ -40,6 +40,8 @@ from urllib.parse import urlparse
from
onelogin.saml2.auth
import
OneLogin_Saml2_Auth
from
onelogin.saml2.utils
import
OneLogin_Saml2_Utils
import
app.config
as
config
# based on machine's hostname use different config files for SAML
# TODO switch to use environment variables: PRODUCTION, STAGING, DEVELOPMENT
hostname
=
socket
.
gethostname
()
...
...
@@ -269,32 +271,6 @@ def get_material(material_id):
@
api
.
route
(
'/materials/<int:material_id>/groups'
,
methods
=
[
'GET'
])
@
http_auth
.
login_required
def
get_calcs_groups
(
material_id
):
# query_method = """
# select *
# from (
# select method_hash,
# material_hash,
# count(*) nr_of_calculations,
# array_agg(calc.id) as calculations_list
# from p34.material
# join p34.calc on material.id = calc.material_id
# join p34.energy on calc.id = energy.calc_id
# where material.id = %s
# and energy.e_kind='Total E'
# group by material_hash,
# method_hash
# having count(*) > 1
# ) d
# cross join lateral (
# select energy.calc_id representative_calculation_id,
# energy.e_val energy_minimum
# from p34.energy
# where energy.calc_id = any(d.calculations_list)
# and energy.e_kind='Total E'
# order by energy.e_val
# limit 1
# ) last_energy;
# """
query_eos
=
"""
select *
from (
...
...
@@ -303,9 +279,9 @@ def get_calcs_groups(material_id):
group_eos_hash,
count(*) nr_of_calculations,
array_agg(calc.id order by calc.cell_volume) as calculations_list
from
p34
.material
join
p34
.calc on material.id = calc.material_id
join
p34
.energy on calc.id = energy.calc_id
from
__schema__
.material
join
__schema__
.calc on material.id = calc.material_id
join
__schema__
.energy on calc.id = energy.calc_id
where material.id = %s
and energy.e_kind='Total E'
group by material_hash,
...
...
@@ -315,13 +291,13 @@ def get_calcs_groups(material_id):
cross join lateral (
select energy.calc_id representative_calculation_id,
energy.e_val energy_minimum
from
p34
.energy
from
__schema__
.energy
where energy.calc_id = any(d.calculations_list)
and energy.e_kind='Total E'
order by energy.e_val
limit 1
) last_energy;
"""
"""
.
replace
(
'__schema__'
,
config
.
schema
)
query_convergence
=
"""
select *
from (
...
...
@@ -330,9 +306,9 @@ def get_calcs_groups(material_id):
group_parametervariation_hash,
count(*) nr_of_calculations,
array_agg(calc.id order by energy.e_val) as calculations_list
from
p34
.material
join
p34
.calc on material.id = calc.material_id
join
p34
.energy on calc.id = energy.calc_id
from
__schema__
.material
join
__schema__
.calc on material.id = calc.material_id
join
__schema__
.energy on calc.id = energy.calc_id
where material.id = %s
and energy.e_kind='Total E'
group by material_hash,
...
...
@@ -348,7 +324,7 @@ def get_calcs_groups(material_id):
order by energy.e_val
limit 1
) last_energy;
"""
"""
.
replace
(
'__schema__'
,
config
.
schema
)
# we renamed group_convergencetest_hash_hash to group_parametervariation_hash
# so, perhaps some var renaming should be done here
mat_id
=
"{}"
.
format
(
material_id
)
...
...
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