Mercurial > repos > siwaa > erecord_file
comparison main_file.py @ 3:aa5c088856c8 draft
planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/erecord-deploy/-/tree/main/galaxy-tools/erecord_file commit 490623122691651ac91c33d75ea1898189be7512-dirty
author | siwaa |
---|---|
date | Thu, 15 Feb 2024 15:24:53 +0000 |
parents | 9e8f5f220917 |
children | 4c45f7b92955 |
comparison
equal
deleted
inserted
replaced
2:9e8f5f220917 | 3:aa5c088856c8 |
---|---|
56 if MAIN_DEBUG: r["sys.argv"] = sys.argv # debug | 56 if MAIN_DEBUG: r["sys.argv"] = sys.argv # debug |
57 | 57 |
58 data = dict() | 58 data = dict() |
59 json_response = dict() | 59 json_response = dict() |
60 | 60 |
61 # default configuration + maybe some modifications | |
62 config = erecord_api.conf() # default (vle-2.0.0 version) | |
63 config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") | |
64 | |
61 try : | 65 try : |
62 parser = argparse.ArgumentParser() | 66 parser = argparse.ArgumentParser() |
63 | 67 |
64 # -action | 68 # -action |
65 available_action_list = ActionViewMixin.get_action_list() | 69 available_action_list = ActionViewMixin.get_action_list() |
108 | 112 |
109 data['action'] = action | 113 data['action'] = action |
110 | 114 |
111 r["data"] = data | 115 r["data"] = data |
112 | 116 |
113 # default configuration + maybe some modifications | 117 # configuration |
114 config = erecord_api.conf() # default (vle-2.0.0 version) | |
115 config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") | |
116 if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug | 118 if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug |
117 | 119 |
118 r_init = erecord_api.init(config) | 120 r_init = erecord_api.init(config) |
119 if MAIN_DEBUG: r["init"] = r_init # debug | 121 if MAIN_DEBUG: r["init"] = r_init # debug |
120 | 122 |
153 response = erecord_api.error_case(data=data, msg=PM, e=e) | 155 response = erecord_api.error_case(data=data, msg=PM, e=e) |
154 json_response = json.loads(response) | 156 json_response = json.loads(response) |
155 | 157 |
156 r["response"] = json_response | 158 r["response"] = json_response |
157 | 159 |
158 # Restitution : json file | 160 try : |
159 jsonoutput_filepath = os.path.join(config.out_path, config.jsonoutput_filename) | 161 # Restitution : json file |
160 with open(jsonoutput_filepath, "w") as outfile: | 162 jsonoutput_filepath = os.path.join(config.out_path, |
161 json.dump(r, outfile) | 163 config.jsonoutput_filename) |
164 with open(jsonoutput_filepath, "w") as outfile: | |
165 json.dump(r, outfile) | |
166 except : | |
167 print(PM, " -- error when trying to open output json file --") | |
162 | 168 |