Fix a bug processing dependent tasks. Fix an issue where we weren't

calculating the task impact of a job properly
This commit is contained in:
Matthew Jones 2014-03-11 16:12:22 -04:00
parent f5ea85e0fc
commit 116cf902b5
2 changed files with 7 additions and 2 deletions

View File

@ -177,7 +177,7 @@ def rebuild_graph(message):
time_delt = len(task_dependencies) - task_dependencies.index(dep)
dep.created = task.created - datetime.timedelta(seconds=1+time_delt)
dep.save()
waiting_tasks.insert(dep, waiting_tasks.index(task))
waiting_tasks.insert(waiting_tasks.index(task), dep)
task.status = 'waiting'
task.save()

View File

@ -15,6 +15,9 @@ import uuid
# PyYAML
import yaml
# ZMQ
import zmq
# Django
from django.conf import settings
from django.db import models
@ -328,7 +331,9 @@ class Job(CommonTask):
@property
def task_impact(self):
# NOTE: We sorta have to assume the host count matches and that forks default to 5
return min(self._get_hosts().count(), 5 if self.forks == 0 else self.forks) * 10
from awx.main.models.inventory import Host
count_hosts = Host.objects.filter(inventory__jobs__pk=self.pk).count()
return min(count_hosts, 5 if self.forks == 0 else self.forks) * 10
@property
def successful_hosts(self):