summaryrefslogtreecommitdiffstats
path: root/tools/pharos-dashboard/dashboard/tasks.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2016-09-19 10:13:26 +0200
committermaxbr <maxbr@mi.fu-berlin.de>2016-09-19 10:13:26 +0200
commit1375c1e7f9e21de9ea0a1c756d27caa652a7c2f2 (patch)
tree07d385ec4e056e31f978821fb31971abf7704a18 /tools/pharos-dashboard/dashboard/tasks.py
parent24fc0008d2ffcfa2dc9d2d7c74e8f0b3a5345d84 (diff)
Send notifications for booking start and end
JIRA: PHAROS-265 Change-Id: I53a37ac31dda70935752afc6da3315e6dfcbc90f Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools/pharos-dashboard/dashboard/tasks.py')
-rw-r--r--tools/pharos-dashboard/dashboard/tasks.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/pharos-dashboard/dashboard/tasks.py b/tools/pharos-dashboard/dashboard/tasks.py
new file mode 100644
index 00000000..3df4bfba
--- /dev/null
+++ b/tools/pharos-dashboard/dashboard/tasks.py
@@ -0,0 +1,13 @@
+from celery import shared_task
+from datetime import timedelta
+from django.utils import timezone
+
+from jenkins.models import JenkinsStatistic
+from notification.models import BookingNotification
+
+
+@shared_task
+def database_cleanup():
+ now = timezone.now()
+ JenkinsStatistic.objects.filter(timestamp__lt=now - timedelta(weeks=4)).delete()
+ BookingNotification.objects.filter(submit_time__lt=now - timedelta(weeks=4)).delete() \ No newline at end of file