Mercurial > repos > melissacline > start_xena
changeset 1:00ea1bdc1aed
Updated the repo in the test toolshed - this should work now
author | melissacline |
---|---|
date | Thu, 04 Sep 2014 15:03:32 -0700 |
parents | 0676a227dbc6 |
children | 220bd4c7e109 |
files | startXena.py tool_dependencies.xml xena.xml |
diffstat | 3 files changed, 33 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/startXena.py Wed Sep 03 15:37:49 2014 -0400 +++ b/startXena.py Thu Sep 04 15:03:32 2014 -0700 @@ -5,15 +5,15 @@ import subprocess import sys -def stop_err(msg, fp, error_level=1): +def stop_err(msg, error_level=1): """Print error message to stdout and quit with given error level.""" - #sys.stderr.write("%s\n" % msg) - fp.write("%s\n" % msg) - fp.write("error code %d\n" % error_level) + sys.stderr.write("%s\n" % msg) + #fp.write("%s\n" % msg) + #fp.write("error code %d\n" % error_level) sys.exit(error_level) -def run(cmd, fp): +def run(cmd): #Avoid using shell=True when we call subprocess to ensure if the Python #script is killed, so too is the child process. try: @@ -26,27 +26,32 @@ return_code = child.returncode if return_code: if stderr and stdout: - stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, err, stdout, stderr), fp) + stop_err("Return code %i from command:\n%s\n\n%s\n\n%s" % (return_code, err, stdout, stderr)) else: - stop_err("Return code %i from command:\n%s\n%s" % (return_code, err, stderr), fp) + stop_err("Return code %i from command:\n%s\n%s" % (return_code, err, stderr)) def main(): - jarPath = os.getenv("JAVA_JAR_PATH", "~") - xenaBaseDir = os.getenv("XENA_BASE_DIR", "~") - xenaJarPath = os.path.join(jarPath, "xena.jar") - xenaBaseDir = os.getenv("XENA_BASE_DIR", "~") - cmdline = "java -jar %s -r %s/xena/files -d %s/xena/db -t %s/xena/tmp" % (xenaJarPath, xenaBaseDir, xenaBaseDir, xenaBaseDir) - for ii in range(1,len(sys.argv)): - cmdline = "%s %s" % (cmdline, sys.argv[ii]) - print "executing", cmdline - fp = open("/inside/home/cline/tmp/xena.out", "w") - fp.write("jar path (not paht) %s\n" % (jarPath)) - fp.write("xena base dir %s\n" % (xenaBaseDir)) - fp.write(cmdline) - run(cmdline, fp) - fp.close() + #parser = argparse.ArgumentParser() + #parser.add_argument("-H", "--host", type=str) + #parser.add_argument("-p", "--port", type=str) + #args = parser.parse_args() + + jarPath = os.getenv("JAVA_JAR_PATH", "~") + xenaJarPath = os.path.join(jarPath, "xena.jar") + xenaBaseDir = os.getenv("XENA_BASE_DIR", "~") + #xenaBaseDir = os.getenv("__tool_data_path__", "~") + "/shared/xena" + #xenaBaseDir = args.toolDataPath + "/shared/xena" + cmdline = "java -jar %s -r %s/files -d %s/xena/db -t %s/tmp" % (xenaJarPath, xenaBaseDir, xenaBaseDir, xenaBaseDir) + for ii in range(1,len(sys.argv)): + cmdline = "%s %s" % (cmdline, sys.argv[ii]) + fp = open("/Users/melissacline/tmp/xena.out", "w") + fp.write("jar path (not paht) %s\n" % (jarPath)) + fp.write("xena base dir %s\n" % (xenaBaseDir)) + fp.write(cmdline) + run(cmdline) + fp.close() if __name__ == '__main__': main( )
--- a/tool_dependencies.xml Wed Sep 03 15:37:49 2014 -0400 +++ b/tool_dependencies.xml Thu Sep 04 15:03:32 2014 -0700 @@ -3,16 +3,16 @@ <package name="installXena" version="1.0"> <install version="1.0"> <actions> + <action type="set_environment"> + <environment_variable name="JAVA_JAR_PATH" action="set_to">$INSTALL_DIR</environment_variable> + </action> + <action type="set_environment"> + <environment_variable name="XENA_BASE_DIR" action="set_to">$INSTALL_DIR</environment_variable> + </action> <action type="move_file"> <source>${REPOSITORY_INSTALL_DIR}/xena/xena.jar</source> <destination>${INSTALL_DIR}</destination> </action> - <action type="set_environment"> - <environment_variable name="JAVA_JAR_PATH" action="set_to">$INSTALL_DIR</environment_variable> - </action> - <action type="set_environment"> - <environment_variable name="XENA_BASE_DIR" action="set_to">$INSTALL_DIR/xena</environment_variable> - </action> </actions> </install> </package>
--- a/xena.xml Wed Sep 03 15:37:49 2014 -0400 +++ b/xena.xml Thu Sep 04 15:03:32 2014 -0700 @@ -4,7 +4,7 @@ <requirement type="package" version="1.0">installXena</requirement> </requirements> <command interpreter="python"> - startXena.py -H 0.0.0.0 -p 1236 & + startXena.py -H 0.0.0.0 -p 1236 & </command> <help> Press the Execute button to start the Xena VM.