mirror of
https://github.com/ansible/awx.git
synced 2026-02-18 19:50:05 -03:30
Compare commits
3 Commits
AAP-58577
...
change_cap
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e5635657d0 | ||
|
|
df8d2740d7 | ||
|
|
c8efa82aca |
@@ -0,0 +1,22 @@
|
|||||||
|
# Generated by Django 4.2.20 on 2025-05-22 08:57
|
||||||
|
|
||||||
|
from decimal import Decimal
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('main', '0205_delete_token_cleanup_job'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='instance',
|
||||||
|
name='capacity_adjustment',
|
||||||
|
field=models.DecimalField(
|
||||||
|
decimal_places=2, default=Decimal('0.75'), max_digits=3, validators=[django.core.validators.MinValueValidator(Decimal('0'))]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -160,7 +160,7 @@ class Instance(HasPolicyEditsMixin, BaseModel):
|
|||||||
default=100,
|
default=100,
|
||||||
editable=False,
|
editable=False,
|
||||||
)
|
)
|
||||||
capacity_adjustment = models.DecimalField(default=Decimal(1.0), max_digits=3, decimal_places=2, validators=[MinValueValidator(Decimal(0.0))])
|
capacity_adjustment = models.DecimalField(default=Decimal(0.75), max_digits=3, decimal_places=2, validators=[MinValueValidator(Decimal(0.0))])
|
||||||
enabled = models.BooleanField(default=True)
|
enabled = models.BooleanField(default=True)
|
||||||
managed_by_policy = models.BooleanField(default=True)
|
managed_by_policy = models.BooleanField(default=True)
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ def test_dispatcher_max_workers_reserve(settings, fake_redis):
|
|||||||
plus reserve worker count
|
plus reserve worker count
|
||||||
"""
|
"""
|
||||||
with override_settings(**settings):
|
with override_settings(**settings):
|
||||||
i = Instance.objects.create(hostname='test-1', node_type='hybrid')
|
i = Instance.objects.create(hostname='test-1', node_type='hybrid', capacity_adjustment=1.0)
|
||||||
i.local_health_check()
|
i.local_health_check()
|
||||||
|
|
||||||
assert get_auto_max_workers() == i.capacity + 7, (i.cpu, i.memory, i.cpu_capacity, i.mem_capacity)
|
assert get_auto_max_workers() == i.capacity + 7, (i.cpu, i.memory, i.cpu_capacity, i.mem_capacity)
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ def test_orphan_unified_job_creation(instance, inventory):
|
|||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
@mock.patch('awx.main.tasks.system.inspect_execution_and_hop_nodes', lambda *args, **kwargs: None)
|
@mock.patch('awx.main.tasks.system.inspect_execution_and_hop_nodes', lambda *args, **kwargs: None)
|
||||||
@mock.patch('awx.main.models.ha.get_cpu_effective_capacity', lambda cpu, is_control_node: 8)
|
@mock.patch('awx.main.models.ha.get_cpu_effective_capacity', lambda cpu, is_control_node: 8)
|
||||||
@mock.patch('awx.main.models.ha.get_mem_effective_capacity', lambda mem, is_control_node: 62)
|
@mock.patch('awx.main.models.ha.get_mem_effective_capacity', lambda mem, is_control_node: 64)
|
||||||
def test_job_capacity_and_with_inactive_node():
|
def test_job_capacity_and_with_inactive_node():
|
||||||
i = Instance.objects.create(hostname='test-1')
|
i = Instance.objects.create(hostname='test-1')
|
||||||
i.save_health_data('18.0.1', 2, 8000)
|
i.save_health_data('18.0.1', 2, 8000)
|
||||||
assert i.enabled is True
|
assert i.enabled is True
|
||||||
assert i.capacity_adjustment == 1.0
|
assert i.capacity_adjustment == 0.75
|
||||||
assert i.capacity == 62
|
assert i.capacity == 50
|
||||||
i.enabled = False
|
i.enabled = False
|
||||||
i.save()
|
i.save()
|
||||||
with override_settings(CLUSTER_HOST_ID=i.hostname):
|
with override_settings(CLUSTER_HOST_ID=i.hostname):
|
||||||
|
|||||||
Reference in New Issue
Block a user