Poll job status

   1 echo "
   2 #!/usr/bin/python
   3 import xmlrpclib
   4 import sys
   5 import time
   6 
   7 api=sys.argv[1]
   8 jobid=sys.argv[2]
   9 server=xmlrpclib.ServerProxy('http://admin:'+api+'@localhost/RPC2/')
  10 wcount=0
  11 count=0
  12 while True:
  13     status = server.scheduler.job_status(jobid)
  14     if status['job_status'] == 'Complete':
  15         break
  16     elif status['job_status'] == 'Submitted':
  17         sys.stdout.write('w')
  18         wcount = wcount + 1
  19     else:
  20         sys.stdout.write('1')
  21         count =count + 1
  22     time.sleep(1)
  23     sys.stdout.flush()
  24 print '\nJob Complete, ' + str(count) + ' seconds elapsed (' + str(wcount) + ' seconds in queue)'
  25 " > $lavadir/checkstatus.py 
  26 
  27 # run the following command with the Job ID
  28 # python $lavadir/checkstatus.py $api JOBID
  29 

Platform/LAVA/Copy-Paste/Poll-Job-Status (last modified 2013-08-11 15:53:06)