housekeeping.py 590 B

1234567891011121314151617181920
  1. # coding: utf-8
  2. from __future__ import print_function
  3. from __future__ import absolute_import
  4. from __future__ import division
  5. from __future__ import unicode_literals
  6. from django.utils.timezone import now
  7. import django_housekeeping as hk
  8. import datetime
  9. from backend.housekeeping import Housekeeper
  10. from .maintenance import ping_stuck_processes
  11. STAGES = ["main"]
  12. class WarnProcessesStuckEarly(hk.Task):
  13. DEPENDS = [Housekeeper]
  14. def run_main(self, stage):
  15. stuck_cutoff = now() - datetime.timedelta(days=7)
  16. ping_stuck_processes(stuck_cutoff, self.hk.housekeeper.user)