changeset 8:ee221004e3b4 draft

Add an option to produce empty files.
author hackdna
date Mon, 13 May 2013 17:59:26 -0400
parents 5ac9c40dae35
children b72564825e0c
files refinery_test_1-1.xml refinery_test_1-2.xml refinery_test_2-1.xml refinery_test_2-2.xml refinery_test_2-6.xml refinery_test_tool.py
diffstat 6 files changed, 17 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/refinery_test_1-1.xml	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_1-1.xml	Mon May 13 17:59:26 2013 -0400
@@ -2,12 +2,13 @@
     <description>for testing Galaxy workflow execution from Refinery</description>
 
     <command interpreter="python">
-        refinery_test_tool.py -i $input_file -o $output_file -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr
+        refinery_test_tool.py -i $input_file -o $output_file -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr $empty_outfile
     </command>
 
     <inputs>
         <param name="input_file" format="txt" type="data" label="Input file"/>
         <param name="sleep_time" type="integer" label="Sleep (seconds)" value="0" min="0"/>
+        <param name="empty_outfile" type="boolean" label="Produce empty output file" truevalue="--empty_outfile" falsevalue=""/>
         <param name="p_fail" type="float" label="Probability of failure [0.0, 1.0]" value="0.0" min="0.0" max="1.0"/>
         <param name="stdout" type="boolean" label="Write to standard out" truevalue="--stdout" falsevalue=""/>
         <param name="stderr" type="boolean" label="Write to standard error" truevalue="--stderr" falsevalue=""/>
--- a/refinery_test_1-2.xml	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_1-2.xml	Mon May 13 17:59:26 2013 -0400
@@ -2,12 +2,13 @@
     <description>for testing Galaxy workflow execution from Refinery</description>
 
     <command interpreter="python">
-        refinery_test_tool.py -i $input_file -o $output_file1 $output_file2 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr
+        refinery_test_tool.py -i $input_file -o $output_file1 $output_file2 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr $empty_outfile
     </command>
 
     <inputs>
         <param name="input_file" format="txt" type="data" label="Input file"/>
         <param name="sleep_time" type="integer" label="Sleep (seconds)" value="0" min="0"/>
+        <param name="empty_outfile" type="boolean" label="Produce empty output files" truevalue="--empty_outfile" falsevalue=""/>
         <param name="p_fail" type="float" label="Probability of failure [0.0, 1.0]" value="0.0" min="0.0" max="1.0"/>
         <param name="stdout" type="boolean" label="Write to standard out" truevalue="--stdout" falsevalue=""/>
         <param name="stderr" type="boolean" label="Write to standard error" truevalue="--stderr" falsevalue=""/>
--- a/refinery_test_2-1.xml	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_2-1.xml	Mon May 13 17:59:26 2013 -0400
@@ -2,13 +2,14 @@
     <description>for testing Galaxy workflow execution from Refinery</description>
 
     <command interpreter="python">
-        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr
+        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr $empty_outfile
     </command>
 
     <inputs>
         <param name="input_file1" format="txt" type="data" label="Input file A"/>
         <param name="input_file2" format="txt" type="data" label="Input file B"/>
         <param name="sleep_time" type="integer" label="Sleep (seconds)" value="0" min="0"/>
+        <param name="empty_outfile" type="boolean" label="Produce empty output file" truevalue="--empty_outfile" falsevalue=""/>
         <param name="p_fail" type="float" label="Probability of failure [0.0, 1.0]" value="0.0" min="0.0" max="1.0"/>
         <param name="stdout" type="boolean" label="Write to standard out" truevalue="--stdout" falsevalue=""/>
         <param name="stderr" type="boolean" label="Write to standard error" truevalue="--stderr" falsevalue=""/>
--- a/refinery_test_2-2.xml	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_2-2.xml	Mon May 13 17:59:26 2013 -0400
@@ -2,13 +2,14 @@
     <description>for testing Galaxy workflow execution from Refinery</description>
 
     <command interpreter="python">
-        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file1 $output_file2 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr
+        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file1 $output_file2 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr $empty_outfile
     </command>
 
     <inputs>
         <param name="input_file1" format="txt" type="data" label="Input file A"/>
         <param name="input_file2" format="txt" type="data" label="Input file B"/>
         <param name="sleep_time" type="integer" label="Sleep (seconds)" value="0" min="0"/>
+        <param name="empty_outfile" type="boolean" label="Produce empty output files" truevalue="--empty_outfile" falsevalue=""/>
         <param name="p_fail" type="float" label="Probability of failure [0.0, 1.0]" value="0.0" min="0.0" max="1.0"/>
         <param name="stdout" type="boolean" label="Write to standard out" truevalue="--stdout" falsevalue=""/>
         <param name="stderr" type="boolean" label="Write to standard error" truevalue="--stderr" falsevalue=""/>
--- a/refinery_test_2-6.xml	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_2-6.xml	Mon May 13 17:59:26 2013 -0400
@@ -2,13 +2,14 @@
     <description>for testing Galaxy workflow execution from Refinery</description>
 
     <command interpreter="python">
-        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file1 $output_file2 $output_file3 $output_file4 $output_file5 $output_file6 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr
+        refinery_test_tool.py -i $input_file1 $input_file2 -o $output_file1 $output_file2 $output_file3 $output_file4 $output_file5 $output_file6 -e $exit_code -p $p_fail -s $sleep_time $stdout $stderr $empty_outfile
     </command>
 
     <inputs>
         <param name="input_file1" format="txt" type="data" label="Input file A"/>
         <param name="input_file2" format="txt" type="data" label="Input file B"/>
         <param name="sleep_time" type="integer" label="Sleep (seconds)" value="0" min="0"/>
+        <param name="empty_outfile" type="boolean" label="Produce empty output files" truevalue="--empty_outfile" falsevalue=""/>
         <param name="p_fail" type="float" label="Probability of failure [0.0, 1.0]" value="0.0" min="0.0" max="1.0"/>
         <param name="stdout" type="boolean" label="Write to standard out" truevalue="--stdout" falsevalue=""/>
         <param name="stderr" type="boolean" label="Write to standard error" truevalue="--stderr" falsevalue=""/>
--- a/refinery_test_tool.py	Mon May 13 16:52:26 2013 -0400
+++ b/refinery_test_tool.py	Mon May 13 17:59:26 2013 -0400
@@ -29,8 +29,11 @@
     input = read_files(args.input_files)
     try:
         for out_file in args.output_files:
-            out_file.write("Output file name: " + out_file.name + "\n\n")
-            out_file.write(input)
+            if args.empty_outfile:
+                output = ''
+            else:
+                output = "Output file name: " + out_file.name + "\n\n" + input
+            out_file.write(output)
     except IOError as e:
         cleanup(args)
         parser.error(e)
@@ -104,6 +107,8 @@
                         help='write a message to stdout')
     parser.add_argument('--stderr', action='store_true',
                         help='write a message to stderr')
+    parser.add_argument('--empty_outfile', action='store_true',
+                        help='produce empty output file(s)')
     parser.add_argument('-p', '--p-fail', type=float, default=0.0,
                         help='probability of execution failure, default: %(default)s')
     parser.add_argument('-s', '--sleep', dest='seconds', type=int, default=0,