summaryrefslogtreecommitdiff
path: root/5x_cv/wrapper5cv.sh
blob: 2155635b78a8d0875467f15109fde779091f381a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Wrapper Skript for CV
# Set Factors, Datasets, Exceptions in the respective config_files
# AM, 2011

if [ $# -lt 2 ]; then
  echo "Usage: $0 factors datasets"
  exit
fi

# Configure basics
source $HOME/.bash_aliases
otconfig
THIS_DATE=`date +%Y%m%d_%H_`
FACTORS="$1"
DATASETS="$2"

# Don't start when running
while ps x | grep 5x | grep -v grep >/dev/null 2>&1; do sleep 3; done

LOGFILE="$THIS_DATE""$USER""_wrapper5cv.log"
rm "$LOGFILE" >/dev/null 2>&1

cat $DATASETS | while read dataset_uri; do
  if ! [[ "$dataset_uri" =~ "#" ]]; then # allow comments
    cat $FACTORS | while read factor; do
      if ! [[ "$factor" =~ "#" ]]; then # allow comments
        echo "${THIS_DATE}: $factor" >> $LOGFILE>&1
        factor="$factor;dataset_uri=$dataset_uri"
        echo "ruby 5x_crossvalidation.rb $factor" >> $LOGFILE 2>&1
        ruby 5x_crossvalidation.rb $factor >> $LOGFILE 2>&1
      fi
    done
  else
   echo >> $LOGFILE 2>&1
   echo $dataset_uri >> $LOGFILE 2>&1
  fi
done