Posted By

throb on 05/04/10


Tagged

python DateTime qube


Versions (?)

Remove jobs older than 10 days in Qube


 / Published in: Python
 

  1. import qb, datetime
  2.  
  3. jobs = qb.jobinfo()
  4.  
  5. for job in jobs:
  6.  
  7. now = datetime.datetime.today()
  8. then = datetime.datetime.fromtimestamp(job['timesubmit'])
  9. elapsed = now-then
  10. if elapsed.days > 10 :
  11.  
  12. print str(job['id']) + ':' + str(job['timesubmit'])
  13. print 'Time elapsed %d days' % (elapsed.days)
  14. qb.remove(job['id'])

Report this snippet  

You need to login to post a comment.