Index: palm/trunk/SCRIPTS/palm_wdd
===================================================================
--- palm/trunk/SCRIPTS/palm_wdd	(revision 2062)
+++ palm/trunk/SCRIPTS/palm_wdd	(revision 2416)
@@ -20,12 +20,12 @@
 # Current revisions:
 # -----------------
-#
+# 
 # 
 # Former revisions:
 # -----------------
 # $Id$
-#
-# Bugfix: return proper error messages when .wdd.config is not found and for
-# wrong actions
+# Adapted for palmrun
+# 
+# 1619 2015-07-13 06:53:19Z maronga
 #
 # 1618 2015-07-13 06:52:15Z maronga
@@ -65,12 +65,13 @@
 import ConfigParser
 import os
+import pwd
 from subprocess import check_output
 import sys
-import socket
+
 
 # Read configuration file
 # First check if the configuration file exists
 if ( os.path.exists('.wdd.config') == False ):
-    sys.stderr.write("No configuration file .wdd.config found on remote host %s." % socket.gethostname())
+    print "Error. No configuration file .wdd.config found."
     raise SystemExit     
 
@@ -89,10 +90,7 @@
 action   = str(sys.argv[1])
 data     = str(sys.argv[2])
-if ( len(sys.argv) > 3 ):
-   data2 =  str(sys.argv[3])
-
-
-cmd_readqueue = cmd_readqueue + " " + data
-cmd_tmpdir    = cmd_tmpdir + data
+
+cmd_readqueue = cmd_readqueue + " " + pwd.getpwuid( os.getuid() )[ 0 ]
+cmd_tmpdir    = cmd_tmpdir + pwd.getpwuid( os.getuid() )[ 0 ]
 
 # reading queuing system
@@ -137,5 +135,5 @@
             out = check_output(cmd_progress, shell=True, stderr=devnull)
             progress_lines = out.splitlines()
-            job_progress = progress_lines[1].split(" ")[1]
+            job_progress = progress_lines[1].split(" ")[3]
             out = None
          except:
@@ -192,8 +190,8 @@
 
 
-def DoStopNow(username,jobid):
-
-   # collect progress information
-   cmd_dostop = "touch " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2] + "/DO_STOP_NOW"
+def DoStopNow(jobid):
+
+   # collect progress information
+   cmd_dostop = "touch " + cmd_tmpdir + "/" + jobid + "/DO_STOP_NOW"
    try: 
       devnull = open(os.devnull, 'w')
@@ -204,8 +202,8 @@
       return return_message
 
-def DoRestartNow(username,jobid):
-
-   # collect progress information
-   cmd_dorestart = "touch " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2] + "/DO_RESTART_NOW"
+def DoRestartNow(jobid):
+
+   # collect progress information
+   cmd_dorestart = "touch " + cmd_tmpdir + "/" + jobid + "/DO_RESTART_NOW"
    try: 
       devnull = open(os.devnull, 'w')
@@ -216,8 +214,8 @@
       return return_message
 
-def GetPARIN(username,jobid):
-
-   # collect progress information
-   cmd_dorestart = "cat " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2] + "/PARIN"
+def GetPARIN(jobid):
+
+   # collect progress information
+   cmd_dorestart = "cat " + cmd_tmpdir + "/" + jobid + "/PARIN"
    try: 
       devnull = open(os.devnull, 'w')
@@ -226,12 +224,12 @@
       out = None
    except:
-      return_message = "Action failed."  
+      return_message = "Action failed."   + "cat " + cmd_tmpdir + "/" + jobid + "/PARIN" 
       
    return return_message
 
-def GetRC(username,jobid):
-
-   # collect progress information
-   cmd_dorestart = "cat " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2] + "/RUN_CONTROL"
+def GetRC(jobid):
+
+   # collect progress information
+   cmd_dorestart = "cat " + cmd_tmpdir + "/" + jobid + "/RUN_CONTROL"
    try: 
       devnull = open(os.devnull, 'w')
@@ -240,5 +238,5 @@
       out = None
    except:
-      return_message = "Action failed."  
+      return_message = "Action failed."
       
    return return_message
@@ -254,12 +252,12 @@
    print GetStartTime(data)
 elif ( action == "stop"):
-   print DoStopNow(data,data2)
+   print DoStopNow(data)
 elif ( action == "restart"):
-   print DoRestartNow(data,data2)
+   print DoRestartNow(data)
 elif ( action == "parin"):
-   print GetPARIN(data,data2)
+   print GetPARIN(data)
 elif ( action == "rc"):
-   print GetRC(data,data2)  
+   print GetRC(data)  
 else:
-   sys.stderr.write("Unknown action on remote host %s." % hostname)
-
+   print "Error. Action " + action + " unknown."
+
