Mercurial > repos > fubar > planemo_test
view planemo_test/planemo_test.xml @ 0:d6fb2ee61c2c draft
Uploaded
author | fubar |
---|---|
date | Thu, 03 Jun 2021 04:43:09 +0000 |
parents | |
children | 0b622237ddfb |
line wrap: on
line source
<tool name="planemo_test" id="planemo_test" version="0.01"> <!--Source in git at: https://github.com/fubar2/toolfactory--> <!--Created by ross.lazarus@gmail.com at 04/05/2021 03:41:57 using the Galaxy Tool Factory.--> <description>Test and finalise a toolshed archive</description> <requirements> <requirement type="package" version="5.0.1">rpyc</requirement> <requirement type="package" version="3.2.3">rsync</requirement> <requirement type="package" version="4.6.3">lxml</requirement> </requirements> <stdio> <exit_code range="1:" level="fatal"/> </stdio> <version_command><![CDATA[echo "0.01"]]></version_command> <command><![CDATA[python $runme $ToolFactory_toolshed_XML_from_the_history_to_test $new_tested_toolshed_archive]]></command> <configfiles> <configfile name="runme"><![CDATA[#raw # script for ToolFactory toolshed archive test tool # most of the work is done in the rpyc server function exposed for this purpose import lxml.etree as ET import os import rpyc import shutil import subprocess import sys def run_rsync(srcf, dstf): src = os.path.abspath(srcf) dst = os.path.abspath(dstf) if os.path.isdir(src): cll = ["rsync", "-r", src, dst] else: cll = ["rsync", src, dst] subprocess.run( cll, capture_output=False, encoding="utf8", shell=False, ) def main(): assert len(sys.argv) >= 3, 'Must have input xml and output archive paths on command line' xmlin = sys.argv[1] arcout = sys.argv[2] tree = ET.parse(xmlin) root = tree.getroot() toolname = root.get('id') try: conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) except ConnectionRefusedError: print('### no remote rpyc server found on port 9999 - this only works in the ToolFactory Appliance with that server running...') sys.exit(1) collection = './testout' abscoll = os.path.abspath(collection) os.mkdir(collection) # for collection pwork = os.path.join("/export", "galaxy", "tested_TF_archives") ptooldir = os.path.join(pwork,toolname) pworkrep = os.path.join("/export", "galaxy", "tested_TF_reports") prepdir = os.path.join(pworkrep, toolname) galtooldir = os.path.join('/export/galaxy/tools/TFtools', toolname) res = conn.root.planemo_lint_test(xmlin, abscoll) shutil.copy(f"{toolname}_tested.toolshed.gz", arcout) main() #end raw]]></configfile> </configfiles> <inputs> <param name="ToolFactory_toolshed_XML_from_the_history_to_test" type="data" optional="false" label="ToolFactory toolshed XML from the history to test" help="" format="xml" multiple="false"/> </inputs> <outputs> <data name="new_tested_toolshed_archive" format="toolshed.gz" label="${ToolFactory_toolshed_XML_from_the_history_to_test.name}_tested.toolshed.gz" hidden="false"/> <collection name="testout" type="list" label="${ToolFactory_toolshed_XML_from_the_history_to_test.name} Planemo Test Reports"> <discover_datasets pattern="__name_and_ext__" directory="testout" visible="false" /> </collection> </outputs> <tests> <test> <output name="new_tested_toolshed_archive" value="new_tested_toolshed_archive_sample" compare="sim_size" delta_frac="0.2"/> <param name="ToolFactory_toolshed_XML_from_the_history_to_test" value="ToolFactory_toolshed_XML_from_the_history_to_test_sample"/> <output_collection name="testout"/> </test> </tests> <help><![CDATA[ **What it Does** Runs planemo test and returns a toolshed archive updated with test outputs and a Planemo test result. Dogfood demonstration - this tool was generated by the ToolFactory - labels were manually adjusted to include tool names since it's not easy to put mako strings into a galaxyxml label. This script will only work if it can use methods that completely sidestep Galaxy job-runner security inside the ToolFactory Appliance. It should not be able to work anywhere else. It expects to find a server on port 9999 of a planemo-server container to do most of the more nefarious stuff. Rsync does the rest. This is as insecure as can be imagined and one good reason why the ToolFactory Appliance should never, ever be exposed on any public network. Private desktop/laptop use only is recommended. ------ Script:: # script for ToolFactory toolshed archive test tool # most of the work is done in the rpyc server function exposed for this purpose import lxml.etree as ET import os import sys import rpyc import shutil import subprocess def run_rsync(srcf, dstf): src = os.path.abspath(srcf) dst = os.path.abspath(dstf) if os.path.isdir(src): cll = ["rsync", "-r", src, dst] else: cll = ["rsync", src, dst] subprocess.run( cll, capture_output=False, encoding="utf8", shell=False, ) def main(): assert len(sys.argv) >= 3, 'Must have input xml and output archive paths on command line' xmlin = sys.argv[1] arcout = sys.argv[2] tree = ET.parse(xmlin) root = tree.getroot() toolname = root.get('id') conn = rpyc.connect("planemo-server", port=9999, config={'sync_request_timeout':1200}) collection = './testout' abscoll = os.path.abspath(collection) os.mkdir(collection) # for collection pwork = os.path.join("/export", "galaxy", "tested_TF_archives") ptooldir = os.path.join(pwork,toolname) pworkrep = os.path.join("/export", "galaxy", "tested_TF_reports") prepdir = os.path.join(pworkrep, toolname) galtooldir = os.path.join('/export/galaxy/tools/TFtools', toolname) res = conn.root.planemo_lint_test(xmlin, abscoll) run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", ".") run_rsync(f"{ptooldir}/{toolname}_tested.toolshed.gz", galtooldir) shutil.copy(f"{toolname}_tested.toolshed.gz", arcout) main() ]]></help> <citations> <citation type="doi">10.1093/bioinformatics/bts573</citation> </citations> </tool>