Implement gathering overall task capacity

For use when running/planning jobs
This commit is contained in:
Matthew Jones
2016-11-07 13:44:17 -05:00
parent db5ffa7e03
commit 343966f744
6 changed files with 32 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
import sys
from django.db import models
from django.db.models import Sum
from django.conf import settings
@@ -40,6 +41,9 @@ class InstanceManager(models.Manager):
"""Return count of active Tower nodes for licensing."""
return self.all().count()
def total_capacity(self):
return self.aggregate(total_capacity=Sum('capacity'))['total_capacity']
def my_role(self):
# NOTE: TODO: Likely to repurpose this once standalone ramparts are a thing
return "tower"