make jobs_running more rich in OPTIONS

* Expose jobs_running as an IntegerField
This commit is contained in:
chris meyers
2018-03-28 15:57:14 -04:00
parent c7ecbb7d2a
commit 8438331563
2 changed files with 10 additions and 3 deletions

View File

@@ -85,6 +85,10 @@ class Instance(models.Model):
# NOTE: TODO: Likely to repurpose this once standalone ramparts are a thing
return "awx"
@property
def jobs_running(self):
return UnifiedJob.objects.filter(execution_node=self.hostname, status__in=('running', 'waiting',)).count()
def is_lost(self, ref_time=None, isolated=False):
if ref_time is None:
ref_time = now()