Changeset 2416 for palm/trunk/SCRIPTS/palm_wdd
- Timestamp:
- Sep 6, 2017 2:28:14 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
palm/trunk/SCRIPTS/palm_wdd
r2062 r2416 20 20 # Current revisions: 21 21 # ----------------- 22 # 22 # 23 23 # 24 24 # Former revisions: 25 25 # ----------------- 26 26 # $Id$ 27 # 28 # Bugfix: return proper error messages when .wdd.config is not found and for29 # wrong actions27 # Adapted for palmrun 28 # 29 # 1619 2015-07-13 06:53:19Z maronga 30 30 # 31 31 # 1618 2015-07-13 06:52:15Z maronga … … 65 65 import ConfigParser 66 66 import os 67 import pwd 67 68 from subprocess import check_output 68 69 import sys 69 import socket 70 70 71 71 72 # Read configuration file 72 73 # First check if the configuration file exists 73 74 if ( os.path.exists('.wdd.config') == False ): 74 sys.stderr.write("No configuration file .wdd.config found on remote host %s." % socket.gethostname())75 print "Error. No configuration file .wdd.config found." 75 76 raise SystemExit 76 77 … … 89 90 action = str(sys.argv[1]) 90 91 data = str(sys.argv[2]) 91 if ( len(sys.argv) > 3 ): 92 data2 = str(sys.argv[3]) 93 94 95 cmd_readqueue = cmd_readqueue + " " + data 96 cmd_tmpdir = cmd_tmpdir + data 92 93 cmd_readqueue = cmd_readqueue + " " + pwd.getpwuid( os.getuid() )[ 0 ] 94 cmd_tmpdir = cmd_tmpdir + pwd.getpwuid( os.getuid() )[ 0 ] 97 95 98 96 # reading queuing system … … 137 135 out = check_output(cmd_progress, shell=True, stderr=devnull) 138 136 progress_lines = out.splitlines() 139 job_progress = progress_lines[1].split(" ")[ 1]137 job_progress = progress_lines[1].split(" ")[3] 140 138 out = None 141 139 except: … … 192 190 193 191 194 def DoStopNow( username,jobid):195 196 # collect progress information 197 cmd_dostop = "touch " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2]+ "/DO_STOP_NOW"192 def DoStopNow(jobid): 193 194 # collect progress information 195 cmd_dostop = "touch " + cmd_tmpdir + "/" + jobid + "/DO_STOP_NOW" 198 196 try: 199 197 devnull = open(os.devnull, 'w') … … 204 202 return return_message 205 203 206 def DoRestartNow( username,jobid):207 208 # collect progress information 209 cmd_dorestart = "touch " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2]+ "/DO_RESTART_NOW"204 def DoRestartNow(jobid): 205 206 # collect progress information 207 cmd_dorestart = "touch " + cmd_tmpdir + "/" + jobid + "/DO_RESTART_NOW" 210 208 try: 211 209 devnull = open(os.devnull, 'w') … … 216 214 return return_message 217 215 218 def GetPARIN( username,jobid):219 220 # collect progress information 221 cmd_dorestart = "cat " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2]+ "/PARIN"216 def GetPARIN(jobid): 217 218 # collect progress information 219 cmd_dorestart = "cat " + cmd_tmpdir + "/" + jobid + "/PARIN" 222 220 try: 223 221 devnull = open(os.devnull, 'w') … … 226 224 out = None 227 225 except: 228 return_message = "Action failed." 226 return_message = "Action failed." + "cat " + cmd_tmpdir + "/" + jobid + "/PARIN" 229 227 230 228 return return_message 231 229 232 def GetRC( username,jobid):233 234 # collect progress information 235 cmd_dorestart = "cat " + cmd_tmpdir + "/" + username + "." + jobid.partition(".")[2]+ "/RUN_CONTROL"230 def GetRC(jobid): 231 232 # collect progress information 233 cmd_dorestart = "cat " + cmd_tmpdir + "/" + jobid + "/RUN_CONTROL" 236 234 try: 237 235 devnull = open(os.devnull, 'w') … … 240 238 out = None 241 239 except: 242 return_message = "Action failed." 240 return_message = "Action failed." 243 241 244 242 return return_message … … 254 252 print GetStartTime(data) 255 253 elif ( action == "stop"): 256 print DoStopNow(data ,data2)254 print DoStopNow(data) 257 255 elif ( action == "restart"): 258 print DoRestartNow(data ,data2)256 print DoRestartNow(data) 259 257 elif ( action == "parin"): 260 print GetPARIN(data ,data2)258 print GetPARIN(data) 261 259 elif ( action == "rc"): 262 print GetRC(data ,data2)260 print GetRC(data) 263 261 else: 264 sys.stderr.write("Unknown action on remote host %s." % hostname)265 262 print "Error. Action " + action + " unknown." 263
Note: See TracChangeset
for help on using the changeset viewer.