Remove jobs older than 10 days in Qube


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.