summaryrefslogtreecommitdiffstats
path: root/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
commita1da09ca6e089913a6aacd5f55051a7f19d6f1fc (patch)
tree2b2a498a4eb0135bc99d03fe0e2aff2d6fbe8ab1 /pharos-dashboard/dashboard/models.py
parent79aec84973032e15ae9d36fcbd7d7d42af3283d1 (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 'pharos-dashboard/dashboard/models.py')
-rw-r--r--pharos-dashboard/dashboard/models.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/pharos-dashboard/dashboard/models.py b/pharos-dashboard/dashboard/models.py
index 973066b..cb6b92b 100644
--- a/pharos-dashboard/dashboard/models.py
+++ b/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()