summaryrefslogtreecommitdiffstats
path: root/tools/pharos-dashboard/dashboard/models.py
diff options
context:
space:
mode:
authormaxbr <maxbr@mi.fu-berlin.de>2016-08-19 17:11:58 +0200
committermaxbr <maxbr@mi.fu-berlin.de>2016-08-19 17:11:58 +0200
commit66eb4d851e63d20031502ec0c96aaabe34c6fd32 (patch)
tree98248b6faf6b3c742efef258e34f06cc92d1a888 /tools/pharos-dashboard/dashboard/models.py
parent3b5ef3b0a88247eeafeee878de528aad71f9fd4b (diff)
Implement periodic tasks
JIRA: RELENG-12 The dashboard is now querying jenkins periodically and saving the results in the database. This fixes delays that were caused by calling the jenkins API. Signed-off-by: maxbr <maxbr@mi.fu-berlin.de>
Diffstat (limited to 'tools/pharos-dashboard/dashboard/models.py')
-rw-r--r--tools/pharos-dashboard/dashboard/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/pharos-dashboard/dashboard/models.py b/tools/pharos-dashboard/dashboard/models.py
index 973066b8..cb6b92b3 100644
--- a/tools/pharos-dashboard/dashboard/models.py
+++ b/tools/pharos-dashboard/dashboard/models.py
@@ -1,14 +1,17 @@
from django.contrib.auth.models import User
from django.db import models
+from django.utils import timezone
+
+from jenkins.models import JenkinsSlave
class Resource(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=100, unique=True)
- slavename = models.CharField(max_length=50, blank=True, null=True)
description = models.CharField(max_length=300, blank=True, null=True)
url = models.CharField(max_length=100, blank=True, null=True)
owners = models.ManyToManyField(User)
+ slave = models.ForeignKey(JenkinsSlave, on_delete=models.DO_NOTHING)
class Meta:
db_table = 'resource'
@@ -16,6 +19,7 @@ class Resource(models.Model):
def __str__(self):
return self.name
+
class ResourceUtilization(models.Model):
POD_STATUS = {
'online': 1,
@@ -25,4 +29,4 @@ class ResourceUtilization(models.Model):
id = models.AutoField(primary_key=True)
timestamp = models.DateTimeField(auto_created=True)
- pod_status = models.IntegerField() \ No newline at end of file
+ pod_status = models.IntegerField()