mirror of
https://github.com/ansible/awx.git
synced 2026-05-07 01:17:37 -02:30
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:
@@ -177,7 +177,7 @@ def rebuild_graph(message):
|
|||||||
time_delt = len(task_dependencies) - task_dependencies.index(dep)
|
time_delt = len(task_dependencies) - task_dependencies.index(dep)
|
||||||
dep.created = task.created - datetime.timedelta(seconds=1+time_delt)
|
dep.created = task.created - datetime.timedelta(seconds=1+time_delt)
|
||||||
dep.save()
|
dep.save()
|
||||||
waiting_tasks.insert(dep, waiting_tasks.index(task))
|
waiting_tasks.insert(waiting_tasks.index(task), dep)
|
||||||
task.status = 'waiting'
|
task.status = 'waiting'
|
||||||
task.save()
|
task.save()
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,9 @@ import uuid
|
|||||||
# PyYAML
|
# PyYAML
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
|
# ZMQ
|
||||||
|
import zmq
|
||||||
|
|
||||||
# Django
|
# Django
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import models
|
from django.db import models
|
||||||
@@ -328,7 +331,9 @@ class Job(CommonTask):
|
|||||||
@property
|
@property
|
||||||
def task_impact(self):
|
def task_impact(self):
|
||||||
# NOTE: We sorta have to assume the host count matches and that forks default to 5
|
# 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
|
@property
|
||||||
def successful_hosts(self):
|
def successful_hosts(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user