[Swift-commit] r6138 - trunk/bin

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Mon Jan 7 16:07:34 CST 2013


Author: davidk
Date: 2013-01-07 16:07:33 -0600 (Mon, 07 Jan 2013)
New Revision: 6138

Added:
   trunk/bin/swiftstat
Modified:
   trunk/bin/swiftrun
Log:
Have swiftrun create .swift structure and keep track of run status
First simple version of swiftstat


Modified: trunk/bin/swiftrun
===================================================================
--- trunk/bin/swiftrun	2013-01-07 20:53:40 UTC (rev 6137)
+++ trunk/bin/swiftrun	2013-01-07 22:07:33 UTC (rev 6138)
@@ -12,6 +12,34 @@
    fi
 }
 
+# crash: Report a problem and exit
+crash()
+{
+    MSG=$1
+    echo ${MSG}  >&2
+    exit 1
+}
+
+# Create .swift structure
+create_dotswift()
+{
+   if [ ! -d "$HOME/.swift" ]; then
+      mkdir $HOME/.swift || crash "Unable to mkdir $HOME/.swift"
+   fi
+
+   if [ ! -d "$HOME/.swift/runs" ]; then
+      mkdir $HOME/.swift/runs || crash "Unable to mkdir $HOME/.swift/runs"
+   fi
+
+   if [ ! -d "$HOME/.swift/runs/current" ]; then
+      mkdir $HOME/.swift/runs/current || crash "Unable to mkdir $HOME/.swift/runs/current"
+   fi
+
+  if [ ! -d "$HOME/.swift/runs/completed" ]; then
+     mkdir $HOME/.swift/runs/completed || crash "Unable to mkdir $HOME/.swift/runs/completed"
+  fi
+}
+
 # Parse command line arguments
 args=""
 script=""
@@ -27,6 +55,7 @@
 done
 
 # Create run directory
+create_dotswift
 rundir=$( echo run??? | sed -e 's/^.*run//' | awk '{ printf("run%03d\n", $1+1)}' )
 mkdir $rundir
 
@@ -51,4 +80,7 @@
 
 # Run
 cd $rundir
+timestamp=$( date +%s )
+ln -s $PWD $HOME/.swift/runs/current/$rundir.$timestamp 
 time swift -sites.file sites.xml -tc.file tc.data $script $args 2>&1 | tee swift.out
+mv $HOME/.swift/runs/current/$rundir.$timestamp $HOME/.swift/runs/completed

Added: trunk/bin/swiftstat
===================================================================
--- trunk/bin/swiftstat	                        (rev 0)
+++ trunk/bin/swiftstat	2013-01-07 22:07:33 UTC (rev 6138)
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+watch --no-title -n 5 "find -L $HOME/.swift/runs/current -name swift.out -exec echo \; -exec dirname {} \; -exec tail -1 {} \;"


Property changes on: trunk/bin/swiftstat
___________________________________________________________________
Added: svn:executable
   + *




More information about the Swift-commit mailing list