queuedrop.py 484 B

123456789101112131415161718192021222324
  1. # -*- coding: utf-8 -*-
  2. """
  3. demeter web
  4. name:admin.py
  5. author:rabin
  6. """
  7. import time
  8. from demeter.core import *
  9. timeSleep = 36000
  10. # 批量控制的队列清理,10小时清理一次24小时之前完成的数据
  11. class Queuedrop(object):
  12. def run(self):
  13. self.handle()
  14. time.sleep(timeSleep)
  15. def handle(self):
  16. num = 3600*24
  17. model = Demeter.model('device_mul_queue')
  18. model.status = 4
  19. cur = Demeter.time() - num
  20. model.operdate.assign(cur, '<=')
  21. model.delete()