[Swift-commit] r7547 - SwiftApps/swift-galaxy/swift

ketan at ci.uchicago.edu ketan at ci.uchicago.edu
Sun Feb 2 18:55:24 CST 2014


Author: ketan
Date: 2014-02-02 18:55:23 -0600 (Sun, 02 Feb 2014)
New Revision: 7547

Modified:
   SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
   SwiftApps/swift-galaxy/swift/swiftforeachlist.xml
   SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
Log:
arbitrary user args in list foreach

Modified: SwiftApps/swift-galaxy/swift/swiftforeachlist.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-02-03 00:12:58 UTC (rev 7546)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.sh	2014-02-03 00:55:23 UTC (rev 7547)
@@ -1,12 +1,5 @@
 #!/bin/bash
 
-#ToDo:
-#
-#1. Add arguments, variable number such that user can add and remove them.
-#2. Add a way for users to specify expected outputs.
-#3. Add a type such that only binaries and executable scripts are populated in the executable list.
-#
-
 echo $@ > /tmp/args.txt
 # numeric range
 site=$1
@@ -17,24 +10,31 @@
 shift
 outloc=$1
 shift
+outlistfile=$1
+shift
 logfile=$1
 shift
-outlistfile=$1
 
+while [ $# -gt 0 ] ; do
+  a="$a"" $1"
+  shift 
+done
+
 cat << EOF > /tmp/script.swift
 type file;
 
-app (file _out, file _err) anapp(file _exec, string _arg){
-    sh @_exec _arg stdout=@_out stderr=@_err;
+app (file _out, file _err) anapp(file _exec, int _i, string _args){
+    sh @_exec _i _args stdout=@_out stderr=@_err;
 }
 
+string args="$a";
 file exec<"$executable">;
 file listfile<"$listfile">;
 string list[] = readData(listfile);
 foreach l, i in list{
     file out <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".out")>;
     file err <single_file_mapper; file=@strcat("$outloc", "/", l, ".", i, ".err")>;
-    (out,err) = anapp(exec, l);
+    (out,err) = anapp(exec, i, args);
 }
 EOF
 

Modified: SwiftApps/swift-galaxy/swift/swiftforeachlist.xml
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachlist.xml	2014-02-03 00:12:58 UTC (rev 7546)
+++ SwiftApps/swift-galaxy/swift/swiftforeachlist.xml	2014-02-03 00:55:23 UTC (rev 7547)
@@ -9,6 +9,9 @@
             $outloc
             $log_file
             $outlist
+            #for $a in $arg
+              ${a.argname}
+            #end for
   </command>
 
   <inputs>
@@ -21,6 +24,10 @@
 
     <param format="sh" name="executable" type="data" label="Executable"/>
     <param format="data" name="listfile" type="data" label="List file"/>
+    <repeat name="arg" title="arg">
+       <param name="argname" type="text" label="arg" />
+    </repeat>
+
     <param name="outloc" size="50" type="text" value="$HOME/swift-sandbox" label="location for output files" help="Swift will write output files here on disc">
         <sanitizer sanitize="False"/>
     </param>

Modified: SwiftApps/swift-galaxy/swift/swiftforeachrange.sh
===================================================================
--- SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-02-03 00:12:58 UTC (rev 7546)
+++ SwiftApps/swift-galaxy/swift/swiftforeachrange.sh	2014-02-03 00:55:23 UTC (rev 7547)
@@ -21,13 +21,13 @@
 outlistfile=$1
 shift
 logfile=$1
+shift
 
 while [ $# -gt 0 ] ; do
   a="$a"" $1"
   shift 
 done
 
-
 #Build Swift source code
 cat << EOF > /tmp/script.swift
 type file;




More information about the Swift-commit mailing list