comparison main_file.py @ 4:4c45f7b92955 draft

planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/erecord-deploy/-/tree/main/galaxy-tools/erecord_file commit 882e24ac5dbef67295dd4466908b7eea02e34697-dirty
author siwaa
date Thu, 15 Feb 2024 17:12:58 +0000
parents aa5c088856c8
children 9c54c0d98c18
comparison
equal deleted inserted replaced
3:aa5c088856c8 4:4c45f7b92955
38 38
39 MAIN_DEBUG=False # True for more information returned 39 MAIN_DEBUG=False # True for more information returned
40 40
41 import argparse 41 import argparse
42 import json 42 import json
43 import erecord.api.erecord as erecord_api 43
44 #import erecord.api.erecord as erecord_api
45 from erecord.api.erecord import conf
46 from erecord.api.erecord import init
47 from erecord.api.erecord import action
48 from erecord.api.erecord import error_case
49
44 from erecord.api.cmn.views_mixins import ActionViewMixin 50 from erecord.api.cmn.views_mixins import ActionViewMixin
45 from erecord.api.cmn.utils.errors import build_error_content 51 from erecord.api.cmn.utils.errors import build_error_content
46 52
47 import os 53 import os
48 import shutil 54 import shutil
57 63
58 data = dict() 64 data = dict()
59 json_response = dict() 65 json_response = dict()
60 66
61 # default configuration + maybe some modifications 67 # default configuration + maybe some modifications
62 config = erecord_api.conf() # default (vle-2.0.0 version) 68 config = conf() ## erecord_api.conf() # default (vle-2.0.0 version)
63 config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") 69 config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm")
64 70
65 try : 71 try :
66 parser = argparse.ArgumentParser() 72 parser = argparse.ArgumentParser()
67 73
115 r["data"] = data 121 r["data"] = data
116 122
117 # configuration 123 # configuration
118 if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug 124 if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug
119 125
120 r_init = erecord_api.init(config) 126 r_init = init(config) ## erecord_api.init(config)
121 if MAIN_DEBUG: r["init"] = r_init # debug 127 if MAIN_DEBUG: r["init"] = r_init # debug
122 128
123 response = erecord_api.action(config, data) 129 response = action(config, data) ## erecord_api.action(config, data)
124 json_response = json.loads(response) 130 json_response = json.loads(response)
125 131
126 # Restitution : file (experiment.xls, conditions.xls, report.zip) 132 # Restitution : file (experiment.xls, conditions.xls, report.zip)
127 # Note : 133 # Note :
128 # tool.xml command "touch" the file (in case of failed to be copied here) 134 # tool.xml command "touch" the file (in case of failed to be copied here)
150 cnt = build_error_content(exception=e, errormsg=msg) 156 cnt = build_error_content(exception=e, errormsg=msg)
151 json_response["error PLUS"] = str(cnt) 157 json_response["error PLUS"] = str(cnt)
152 158
153 except Exception as e : 159 except Exception as e :
154 160
155 response = erecord_api.error_case(data=data, msg=PM, e=e) 161 response = error_case(data=data, msg=PM, e=e) ## erecord_api.error_case(data=data, msg=PM, e=e)
156 json_response = json.loads(response) 162 json_response = json.loads(response)
157 163
158 r["response"] = json_response 164 r["response"] = json_response
159 165
160 try : 166 try :