From 44d00858aab35cff8344aab566b56fd9c84b5729 Mon Sep 17 00:00:00 2001
From: dave <dave@dtu.dk>
Date: Tue, 18 Oct 2016 13:13:03 +0200
Subject: [PATCH] prepost.Simulations.PBS: only run winefix on Jess, check at
 run-time

---
 wetb/prepost/Simulations.py                              | 9 +++++++--
 .../ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p     | 5 ++++-
 .../ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p     | 5 ++++-
 .../ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p    | 5 ++++-
 .../ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p    | 5 ++++-
 5 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/wetb/prepost/Simulations.py b/wetb/prepost/Simulations.py
index e12a6aa0..a60e9b28 100755
--- a/wetb/prepost/Simulations.py
+++ b/wetb/prepost/Simulations.py
@@ -1942,7 +1942,12 @@ class PBS(object):
             self.wine = 'time WINEARCH=win32 WINEPREFIX=~/.wine32 wine'
         else:
             raise UserWarning('server support only for jess or gorm')
-        self.winefix = 'WINEARCH=win32 WINEPREFIX=~/.wine32 winefix\n'
+
+        # determine at runtime if winefix has to be ran
+        self.winefix = '  _HOSTNAME_=`hostname`\n'
+        self.winefix += '  if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then \n'
+        self.winefix += '    WINEARCH=win32 WINEPREFIX=~/.wine32 winefix\n'
+        self.winefix += '  fi\n'
 
         # the output channels comes with a price tag. Each time step
         # will have a penelty depending on the number of output channels
@@ -2228,7 +2233,7 @@ class PBS(object):
                 self.pbs += "  cp -R $PBS_O_WORKDIR/%s ./%s \n" % (fname, fgen)
 
             # only apply the wine fix in PBS mode
-            self.pbs += '  ' + self.winefix
+            self.pbs += self.winefix
             # TODO: activate python env, calculate post-processing
 #            self.pbs += 'echo `python -c "import wetb; print(wetb.__version__)"`\n'
 
diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p
index ad37d08e..27dde9c4 100644
--- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p
+++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp10_s100.p
@@ -37,7 +37,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then
   mkdir -p turb/
   cp -R $PBS_O_WORKDIR/htc/dlc01_demos/dlc01_steady_wsp10_s100.htc ./htc/dlc01_demos/
   cp -R $PBS_O_WORKDIR/../turb/turb_s100_10ms*.bin turb/ 
-  WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  _HOSTNAME_=`hostname`
+  if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then 
+    WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  fi
 # ------------------------------------------------------------
 else
   # with find+xargs we first browse to CPU folder
diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p
index d4675f07..4d0df376 100644
--- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p
+++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp11_s101.p
@@ -37,7 +37,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then
   mkdir -p turb/
   cp -R $PBS_O_WORKDIR/htc/dlc01_demos/dlc01_steady_wsp11_s101.htc ./htc/dlc01_demos/
   cp -R $PBS_O_WORKDIR/../turb/turb_s101_11ms*.bin turb/ 
-  WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  _HOSTNAME_=`hostname`
+  if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then 
+    WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  fi
 # ------------------------------------------------------------
 else
   # with find+xargs we first browse to CPU folder
diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p
index 8570f9cb..fdb203d5 100644
--- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p
+++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp8_noturb.p
@@ -37,7 +37,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then
   mkdir -p turb/
   cp -R $PBS_O_WORKDIR/htc/dlc01_demos/dlc01_steady_wsp8_noturb.htc ./htc/dlc01_demos/
   cp -R $PBS_O_WORKDIR/../turb/none*.bin turb/ 
-  WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  _HOSTNAME_=`hostname`
+  if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then 
+    WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  fi
 # ------------------------------------------------------------
 else
   # with find+xargs we first browse to CPU folder
diff --git a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p
index 8b7dc11b..84d71cd6 100644
--- a/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p
+++ b/wetb/prepost/tests/data/demo_dlc/ref/pbs_in/dlc01_demos/dlc01_steady_wsp9_noturb.p
@@ -37,7 +37,10 @@ if [ -z ${LAUNCH_PBS_MODE+x} ] ; then
   mkdir -p turb/
   cp -R $PBS_O_WORKDIR/htc/dlc01_demos/dlc01_steady_wsp9_noturb.htc ./htc/dlc01_demos/
   cp -R $PBS_O_WORKDIR/../turb/none*.bin turb/ 
-  WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  _HOSTNAME_=`hostname`
+  if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then 
+    WINEARCH=win32 WINEPREFIX=~/.wine32 winefix
+  fi
 # ------------------------------------------------------------
 else
   # with find+xargs we first browse to CPU folder
-- 
GitLab