# HG changeset patch # User siwaa # Date 1708008256 0 # Node ID afc88ac8de690dc8bd631e2640be3356bc16f545 # Parent d87b8a1073ad178e326c08a7c9014c730fa315f1 planemo upload for repository https://forgemia.inra.fr/nathalie.rousse/erecord-deploy/-/tree/main/galaxy-tools/erecord_json commit 2bd91617d46a1c454a7a167113cc605bdd1b3ff2-dirty diff -r d87b8a1073ad -r afc88ac8de69 erecord_json.xml --- a/erecord_json.xml Wed Dec 13 21:46:11 2023 +0000 +++ b/erecord_json.xml Thu Feb 15 14:44:16 2024 +0000 @@ -5,7 +5,10 @@ - oras://registry.forgemia.inra.fr/nathalie.rousse/erecord-deploy/erecord_rep0_vle2:53e4840cd66e45761db955f69203284761fd6df8 + oras://registry.forgemia.inra.fr/nathalie.rousse/erecord-deploy/rep_recordb:9d6ea1defd50dd63fe036a7545a9ea527572192e + + + diff -r d87b8a1073ad -r afc88ac8de69 main_json.py --- a/main_json.py Wed Dec 13 21:46:11 2023 +0000 +++ b/main_json.py Thu Feb 15 14:44:16 2024 +0000 @@ -23,7 +23,8 @@ available only in some cases) Outputs : - - output.json data file + - output.json data file (jsonoutput_filepath) + """ MAIN_DEBUG=False # True for more information returned @@ -31,10 +32,8 @@ import argparse import json import erecord.api.erecord as erecord_api + import os -from erecord.api.cmn.utils.dir_and_file import create_dir_if_absent -from erecord.api.cmn.configs.config import PROJECT_HOME -from erecord.api.cmn.configs.config import out_path PM = "[main_json.py]" @@ -42,20 +41,15 @@ 'get_vpz_report_conditions', 'post_vpz_report_conditions', 'get_vpz_report', 'post_vpz_report'] -jsonoutput_filepath = os.path.join(out_path, "output.json") # tool.xml uses it - r = dict() import sys if MAIN_DEBUG: r["sys.path"] = sys.path # debug if MAIN_DEBUG: r["sys.argv"] = sys.argv # debug -if MAIN_DEBUG: r["out_path"] = out_path # debug data = dict() json_response = dict() -create_dir_if_absent(PROJECT_HOME) # required - try : parser = argparse.ArgumentParser() parser.add_argument("-data", type=str, help="data json file path") @@ -86,9 +80,16 @@ data["action"] = 'help' r["data"] = data - r_init = erecord_api.init() + + # default configuration + maybe some modifications + config = erecord_api.conf() # default (vle-2.0.0 version) + config.DB_add_vpz(vpz_id=1312, vpzname="wwdm.vpz", pkgname="wwdm") + if MAIN_DEBUG: r["config"] = config.get_as_dict() # debug + + r_init = erecord_api.init(config) if MAIN_DEBUG: r["init"] = r_init # debug - response = erecord_api.action(data) + + response = erecord_api.action(config, data) json_response = json.loads(response) except Exception as e : @@ -99,6 +100,7 @@ r["response"] = json_response # Restitution : json file +jsonoutput_filepath = os.path.join(config.out_path, config.jsonoutput_filename) with open(jsonoutput_filepath, "w") as outfile: json.dump(r, outfile)