mirror of
https://github.com/ansible/awx.git
synced 2026-03-05 02:31:03 -03:30
Make awx/main/tests/live dramatically faster (#15780)
* Make awx/main/tests/live dramatically faster * Add new setting to exclude list
This commit is contained in:
@@ -5,9 +5,9 @@ import time
|
|||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
from django_guid import get_guid
|
from django_guid import get_guid
|
||||||
|
from django.conf import settings
|
||||||
|
|
||||||
from . import pg_bus_conn
|
from . import pg_bus_conn
|
||||||
from awx.main.utils import is_testing
|
|
||||||
|
|
||||||
logger = logging.getLogger('awx.main.dispatch')
|
logger = logging.getLogger('awx.main.dispatch')
|
||||||
|
|
||||||
@@ -101,7 +101,7 @@ class task:
|
|||||||
obj = cls.get_async_body(args=args, kwargs=kwargs, uuid=uuid, **kw)
|
obj = cls.get_async_body(args=args, kwargs=kwargs, uuid=uuid, **kw)
|
||||||
if callable(queue):
|
if callable(queue):
|
||||||
queue = queue()
|
queue = queue()
|
||||||
if not is_testing():
|
if not settings.DISPATCHER_MOCK_PUBLISH:
|
||||||
with pg_bus_conn() as conn:
|
with pg_bus_conn() as conn:
|
||||||
conn.notify(queue, json.dumps(obj))
|
conn.notify(queue, json.dumps(obj))
|
||||||
return (obj, queue)
|
return (obj, queue)
|
||||||
|
|||||||
@@ -7,6 +7,9 @@ from awx.settings.development import * # NOQA
|
|||||||
# Some things make decisions based on settings.SETTINGS_MODULE, so this is done for that
|
# Some things make decisions based on settings.SETTINGS_MODULE, so this is done for that
|
||||||
SETTINGS_MODULE = 'awx.settings.development'
|
SETTINGS_MODULE = 'awx.settings.development'
|
||||||
|
|
||||||
|
# Turn off task submission, because sqlite3 does not have pg_notify
|
||||||
|
DISPATCHER_MOCK_PUBLISH = True
|
||||||
|
|
||||||
# Use SQLite for unit tests instead of PostgreSQL. If the lines below are
|
# Use SQLite for unit tests instead of PostgreSQL. If the lines below are
|
||||||
# commented out, Django will create the test_awx-dev database in PostgreSQL to
|
# commented out, Django will create the test_awx-dev database in PostgreSQL to
|
||||||
# run unit tests.
|
# run unit tests.
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ LOCAL_SETTINGS = (
|
|||||||
'CACHES',
|
'CACHES',
|
||||||
'DEBUG',
|
'DEBUG',
|
||||||
'NAMED_URL_GRAPH',
|
'NAMED_URL_GRAPH',
|
||||||
|
'DISPATCHER_MOCK_PUBLISH',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -424,6 +424,11 @@ EXECUTION_NODE_REMEDIATION_CHECKS = 60 * 30 # once every 30 minutes check if an
|
|||||||
# Amount of time dispatcher will try to reconnect to database for jobs and consuming new work
|
# Amount of time dispatcher will try to reconnect to database for jobs and consuming new work
|
||||||
DISPATCHER_DB_DOWNTIME_TOLERANCE = 40
|
DISPATCHER_DB_DOWNTIME_TOLERANCE = 40
|
||||||
|
|
||||||
|
# If you set this, nothing will ever be sent to pg_notify
|
||||||
|
# this is not practical to use, although periodic schedules may still run slugish but functional tasks
|
||||||
|
# sqlite3 based tests will use this
|
||||||
|
DISPATCHER_MOCK_PUBLISH = False
|
||||||
|
|
||||||
BROKER_URL = 'unix:///var/run/redis/redis.sock'
|
BROKER_URL = 'unix:///var/run/redis/redis.sock'
|
||||||
CELERYBEAT_SCHEDULE = {
|
CELERYBEAT_SCHEDULE = {
|
||||||
'tower_scheduler': {'task': 'awx.main.tasks.system.awx_periodic_scheduler', 'schedule': timedelta(seconds=30), 'options': {'expires': 20}},
|
'tower_scheduler': {'task': 'awx.main.tasks.system.awx_periodic_scheduler', 'schedule': timedelta(seconds=30), 'options': {'expires': 20}},
|
||||||
|
|||||||
Reference in New Issue
Block a user