Commit dfc68266 authored by Nathalie Rousse's avatar Nathalie Rousse
Browse files

Minor modifications and corrections, especially to maintain compatibility with...

Minor modifications and corrections, especially to maintain compatibility with previous erecord version (vle-1.1) :
- parameter value types : same values as before (double, boolean...) instead of DOUBLE, BOOLEAN...
- case of empty simulation results
- documentation
parent 4e6b2c9c
......@@ -22,6 +22,7 @@ models, such as the Record platform ones.
Version using pyvle.
Is the version installed under erecord VM (147.100.164.34).
erecord.toulouse.inra.fr
*******************************************************************************
vle-x
......
......@@ -158,14 +158,14 @@ html_theme_path = ['_themes']
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
#html_logo = None
html_logo = 'INRA_logo.png'
html_logo = None
#html_logo = '_static/INRA_logo.png'
#html_logo = 'INRA_logo.jpg'
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
#html_favicon = None
html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
......
......@@ -38,6 +38,8 @@ Request parameters
* :ref:`webapi_activity_vpz_choice`
* :ref:`webapi_opt_parselect`
* :ref:`webapi_opt_style`
* :ref:`webapi_opt_format`
......
......@@ -59,7 +59,11 @@ VlePar
------
Vle parameter
Vle parameter (of a VleCond)
Vle parameter (of a VleCond).
It contains some information about the parameter (name, value...), that is got or not into a request answer (it depends on the options given into the request).
A value type can value : "boolean", "integer", "double", "string", "xml", "set", "map", "tuple", "table", "matrix, "none", "".
.. _dm_vleview:
......
......@@ -2,4 +2,4 @@ URL :
http://erecord.toulouse.inra.fr:8000/vpz/input/
Content :
{"vpz":266,"duration":100,"begin":2453982.0,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":[0.0064]},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":[1.86]}],"mode":"compactlist"}
{"vpz":266,"duration":100,"begin":2453982.0,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":"[0.0064]"},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":"[1.86]"}],"mode":"compactlist"}
......@@ -2,4 +2,4 @@ URL :
http://erecord.toulouse.inra.fr:8000/vpz/input/
Content :
{"vpz":266,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":[0.0064]},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":[1.86]}],"parselect":["cond_wwdm","cond_meteo.meteo_file"]}
{"vpz":266,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":"[0.0064]"},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":"[1.86]"}],"parselect":["cond_wwdm","cond_meteo.meteo_file"]}
......@@ -2,5 +2,5 @@ URL :
http://erecord.toulouse.inra.fr:8000/vpz/input/
Content :
{"vpz":266,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":[0.0064]},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":[1.86]}],"mode":"compactlist","parselect":["cond_wwdm.A","cond_wwdm.B","cond_wwdm.Eb","cond_wwdm.TI"]}
{"vpz":266,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":"[0.0064]"},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":"[1.86]"}],"mode":"compactlist","parselect":["cond_wwdm.A","cond_wwdm.B","cond_wwdm.Eb","cond_wwdm.TI"]}
......@@ -5,7 +5,7 @@ Content (case of single plan (single simulation)) :
{"vpz":266,"duration":6,"begin":2453982.0,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":0.0064},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":1.86}],"mode":["tree","single","dataframe"],"outselect":"all"}
Content (case of linear plan (multiple simulation)) :
{"vpz":266,"duration":6,"begin":2453982.0,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":[0.0064,0.0065,0.0066]},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":[1.84,1.85,1.86]}],"mode":["tree","linear","dataframe"],"outselect":"all"}
{"vpz":266,"duration":6,"begin":2453982.0,"pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":"[0.0064,0.0065,0.0066]"},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":"[1.84,1.85,1.86]"}],"mode":["tree","linear","dataframe"],"outselect":"all"}
(rq : or with "matrix" instead of "dataframe")
......@@ -5,7 +5,7 @@ curl -L -H "Content-Type: application/json" -d '{"vpz":266, "duration":6, "begin
cURL command line (case of linear plan (multiple simulation)) :
curl -L -H "Content-Type: application/json" -d '{"vpz":266, "duration":6, "begin":2453982.0, "mode":["tree","linear","dataframe"], "outselect":"all", "pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":[0.0064,0.0065,0.0066]},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":[1.84,1.85,1.86]}]}' http://erecord.toulouse.inra.fr:8000/vpz/output/
curl -L -H "Content-Type: application/json" -d '{"vpz":266, "duration":6, "begin":2453982.0, "mode":["tree","linear","dataframe"], "outselect":"all", "pars":[{"selection_name":"cond_wwdm.A","cname":"cond_wwdm","pname":"A","value":"[0.0064,0.0065,0.0066]"},{"selection_name":"cond_wwdm.Eb","cname":"cond_wwdm","pname":"Eb","value":"[1.84,1.85,1.86]"}]}' http://erecord.toulouse.inra.fr:8000/vpz/output/
(rq : or with "matrix" instead of "dataframe")
......@@ -32,10 +32,10 @@ inputdata["mode"] = ["tree", "single", "dataframe"]
# some parameters modification with 'pars' (multiple values)
parameter_A = {"selection_name":"cond_wwdm.A",
"cname":"cond_wwdm","pname":"A",
"value":[0.0064,0.0065,0.0066]}
"value":"[0.0064,0.0065,0.0066]"}
parameter_Eb = {"selection_name":"cond_wwdm.Eb",
"cname":"cond_wwdm","pname":"Eb",
"value":[1.84,1.85,1.86]}
"value":"[1.84,1.85,1.86]"}
pars = list()
pars.append(parameter_A)
pars.append(parameter_Eb)
......
......@@ -16,10 +16,47 @@ from erecord_cmn.utils.vle import vle_bash_cmd
from erecord_cmn.utils.process import call_subprocess
from erecord_cmn.utils.coding import byteify
#from erecord_cmn.utils.coding import byteify
###############################################################################
def get_value_type(json_value_type):
""" Conversion of a value type coming from erecord pkg (json format)
Note : json_value_type values are :
- vle::value::Value::type values
- "" for unknown vle::value::Value::type value
or for vle::value::Value::USER that is treated as unknown
"""
if json_value_type == "BOOLEAN":
return "boolean"
elif json_value_type == "INTEGER":
return "integer"
elif json_value_type == "DOUBLE":
return "double"
elif json_value_type == "STRING":
return "string"
elif json_value_type == "XMLTYPE":
return "xml"
elif json_value_type == "SET":
return "set"
elif json_value_type == "MAP":
return "map"
elif json_value_type == "TUPLE":
return "tuple"
elif json_value_type == "TABLE":
return "table"
elif json_value_type == "MATRIX":
return "matrix"
elif json_value_type == "NIL":
return "none"
else : # "" and else
return ""
###############################################################################
stderr_filename = "stderr.txt"
stdout_filename = "stdout.txt"
ok_filename = "OK"
......@@ -107,6 +144,7 @@ def get_file_jsoncontent(folder_path, file_name) :
r = json.loads(res)
return r
def control_out(runvle_path) :
"""Makes controls and returns reports
......
......@@ -37,6 +37,9 @@ class VpzDownloadViewMixin(object):
key = download_document.key
url = reverse('erecord_slm-download', request=request)
if "?" in url : # remaining option(s)
url = url.split("?")[0]
options = {'key':key}
more_text = "The resource to download the result is 'GET slm/download'"
......
......@@ -101,7 +101,8 @@ def get_vpzpath_choices() :
pkgname=pkg, vpzname=name) :
if is_structured_as_vle_install(vle_usr_path) :
#choices_list.append( (v,v) )
choices_list.append( (v,c) )
a = REPOSITORIES_HOME + c
choices_list.append( (a,c) )
return choices_list
class VpzPathForm(forms.ModelForm):
......
......@@ -42,6 +42,7 @@ from erecord_cmn.utils.vle import is_structured_as_vle_install
from erecord_cmn.utils.coding import byteify
from erecord_cmn.utils.erecord_package import vle_read_vpz
from erecord_cmn.utils.erecord_package import get_value_type
from erecord_cmn.utils.erecord_package import print_vle_read_vpz_result
ht_vpzact_vpzname = \
......@@ -289,14 +290,14 @@ class VpzInput(LockableVpzInputMixin, VpzInputTransformMixin, VpzInputMixin,
for vname in view_list.keys() :
jview = view_list[vname]
type = jview["type"] #.encode()? #u'type': u'timed'
timestep = jview["timestep"] #u'timestep': 1.0
type = jview["type"] #.encode()? #u'type': u'timed'
timestep = jview["timestep"] #u'timestep': 1.0
output = jview["output"]
output_name = output["name"] #u'name': u'view'
output_plugin = output["plugin"] #u'plugin': u'file'
#!!! output_format = output["format"] #u'format': u'local'
output_name = output["name"] #u'name': u'view'
output_plugin = output["plugin"] #u'plugin': u'file'
#old output_format = output["format"] #u'format': u'local'
output_format = "obsolete"
output_location = output["location"] #u'location': u''
output_location = output["location"] #u'location': u''
vleview = self.vleview_list.create(name=vname, type=type,
timestep=timestep, output_name=output_name,
......@@ -727,7 +728,7 @@ class VleCond(LockableVleCondMixin, DefaultVerboseNameMixin, models.Model):
par_list = jcondition["par_list"]
for pname in par_list.keys() :
parameter = par_list[pname]
parameter_type = parameter["type"]
parameter_type = get_value_type(parameter["type"])
parameter_value = parameter["value"]
self.vlepar_list.create(pname=pname, cname=self.name,
type=parameter_type, value=json.dumps(parameter_value),
......
......@@ -238,10 +238,18 @@ class VpzOutputMixin(object):
restype = jres["restype"]
if "res" in keys :
res = jres["res"]
if type(res) is str : # error case
msg = "Simulation running error ... " + res
raise Exception(msg)
# empty cases
if res is None : # single case
res = dict()
if type(res) is list : # linear case
if res == [None] :
res = list()
self.res = res
self.plan = plan
self.restype = restype
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment