changeset 2:b97775e9fe06 draft

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/export_to_cluster/ commit f5c5f3d6ce676937f5c673ec7fc0631a9f490dc2
author earlhaminst
date Fri, 24 Mar 2017 12:20:48 -0400
parents a9d1991c90e3
children 9838eed606ad
files export_to_cluster.py export_to_cluster.xml
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/export_to_cluster.py	Mon Oct 03 06:26:41 2016 -0400
+++ b/export_to_cluster.py	Fri Mar 24 12:20:48 2017 -0400
@@ -24,15 +24,16 @@
 real_export_dir = os.path.realpath(options.export_dir)
 dir_prefix = options.dir_prefix.rstrip(os.sep)
 if not real_export_dir.startswith(dir_prefix):
-    sys.exit("%s must be a subdirectory of %s" % (options.export_dir, dir_prefix))
+    raise Exception("%s must be a subdirectory of %s" % (options.export_dir, dir_prefix))
 if not os.path.exists(real_export_dir):
-    sys.exit("%s does not exist or it is not accessible by the Galaxy user" % options.export_dir)
+    raise Exception("%s does not exist or it is not accessible by the Galaxy user" % options.export_dir)
 if not os.path.isdir(real_export_dir):
-    sys.exit("%s is not a directory" % options.export_dir)
+    raise Exception("%s is not a directory" % options.export_dir)
 
 dataset_paths = args[::3]
 dataset_names = args[1::3]
 dataset_exts = args[2::3]
+exit_code = 0
 for dp, dn, de in zip(dataset_paths, dataset_names, dataset_exts):
     """
     Copied from get_valid_filename from django
@@ -46,5 +47,6 @@
         print("Dataset '%s' copied to '%s'" % (dn, dest))
     except Exception as e:
         msg = "Error copying dataset '%s' to '%s', %s" % (dn, dest, e)
-        print(msg)
-        sys.stderr.write(msg)
+        print(msg, file=sys.stderr)
+        exit_code = 1
+sys.exit(exit_code)
--- a/export_to_cluster.xml	Mon Oct 03 06:26:41 2016 -0400
+++ b/export_to_cluster.xml	Fri Mar 24 12:20:48 2017 -0400
@@ -2,13 +2,13 @@
     <requirements>
         <requirement type="set_environment">EXPORT_DIR_PREFIX</requirement>
     </requirements>
-    <command>
+    <command detect_errors="aggressive">
 <![CDATA[
-python $__tool_directory__/export_to_cluster.py -d '$export_dir' -p "\$EXPORT_DIR_PREFIX"
+python '$__tool_directory__/export_to_cluster.py' -d '$export_dir' -p "\$EXPORT_DIR_PREFIX"
 #for $d in $datasets
     '${d}' '${d.hid}: ${d.name}' '${d.ext}'
 #end for
-> $log
+> '$log'
 ]]>
     </command>
     <inputs>