github.com/DARA-Project/GoDist-Scheduler@v0.0.0-20201030134746-668de4acea0d/examples/diningphilosopher_test/config.bash (about)

     1  #!/bin/bash -x
     2  # diningPhil/run.sh controls the exection of the dining philosophers
     3  # example diningPhilosophers runs on an arbetrary number of hosts, the
     4  # communication pattern follows Host_i-1 <--> Host_i <--> Host_i+1
     5  # That is, every host has a neighbour, and only communicates with that
     6  # neighbour
     7  
     8  export PROCESSES=3
     9  export DINV_LOG_STORE="localhost:17000"
    10  export DINV_PROJECT="phil"
    11  export BasePort=6000
    12  DINV=$GOPATH/src/bitbucket.org/bestchai/dinv
    13  DARA=$GOPATH/src/github.com/DARA-Project/GoDist-Scheduler
    14  testDir=$DARA/examples/diningphilosopher_test
    15  dgo=/usr/bin/dgo
    16  LOGSERVER="localhost:17000"
    17  
    18  function installDinv {
    19      echo "Install dinv"
    20      cd $DINV
    21      $dgo install
    22      cd $testDir
    23  }
    24  
    25  function runTestPrograms {
    26      cd $testDir
    27      pwd
    28      for (( i=0; i<PROCESSES; i++))
    29      do
    30          let "hostPort=i + BasePort"
    31          let "neighbourPort= (i+1)%PROCESSES + BasePort"
    32  
    33          export DINV_HOSTNAME="localhost:$hostPort"
    34          $dgo run diningphilosopher.go -mP $hostPort -nP $neighbourPort &
    35      done
    36      sleep 15
    37      kill `ps | pgrep dining | awk '{print $1}'`
    38  }
    39  
    40  function RecordExecution {
    41      cd $testDir
    42      pwd
    43      $dgo build diningphilosopher.go
    44      for i in $(seq 1 $PROCESSES)
    45      do
    46          echo "$i $i $i $i"
    47          let "k=i - 1"
    48          let "hostPort=k + BasePort"
    49          let "neighbourPort= (k+1)%PROCESSES + BasePort"
    50  
    51          export DINV_HOSTNAME="localhost:$hostPort"
    52          export DARAPID=$i
    53          export DARAON=true
    54          #record an execution
    55          ./diningphilosopher -mP $hostPort -nP $neighbourPort 1> diningphilosoper-$DARAPID.record 2> Local-Scheduler-$DARAPID.record &
    56          export DARAON=false
    57      done
    58  }
    59  
    60  function ReplayExecution {
    61      cd $testDir
    62      pwd
    63      $dgo build diningphilosopher.go
    64      for i in $(seq 1 $PROCESSES)
    65      do
    66          echo "$i $i $i $i"
    67          let "k=i - 1"
    68          let "hostPort=k + BasePort"
    69          let "neighbourPort= (k+1)%PROCESSES + BasePort"
    70  
    71          export DINV_HOSTNAME="localhost:$hostPort"
    72          export DARAPID=$i
    73          export DARAON=true
    74          #record an execution
    75          ./diningphilosopher -mP $hostPort -nP $neighbourPort 1> diningphilosoper-$DARAPID.replay 2> Local-Scheduler-$DARAPID.replay &
    76          export DARAON=false
    77      done
    78  }