From a61e729ebbc27a85e492010f3571cb659c8f8762 Mon Sep 17 00:00:00 2001 From: Matthew Jones Date: Wed, 14 Dec 2016 15:05:28 -0500 Subject: [PATCH] Purge event res dict if it is over a certain size Also purge/update some old settings values --- awx/lib/tower_display_callback/events.py | 4 +++- awx/main/tasks.py | 1 + awx/settings/defaults.py | 17 +++++------------ 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/awx/lib/tower_display_callback/events.py b/awx/lib/tower_display_callback/events.py index 0909ed460d..c17cf2c7f1 100644 --- a/awx/lib/tower_display_callback/events.py +++ b/awx/lib/tower_display_callback/events.py @@ -173,7 +173,9 @@ class EventContext(object): if event_data.get(key, False): event = key break - + max_res = int(os.getenv("MAX_EVENT_RES", 700000)) + if event not in ('playbook_on_stats',) and "res" in event_data and len(str(event_data['res'])) > max_res: + event_data['res'] = {} event_dict = dict(event=event, event_data=event_data) for key in event_data.keys(): if key in ('job_id', 'ad_hoc_command_id', 'uuid', 'parent_uuid', 'created', 'artifact_data'): diff --git a/awx/main/tasks.py b/awx/main/tasks.py index e0dcae0fca..addbe4c8f2 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -809,6 +809,7 @@ class RunJob(BaseTask): env['REST_API_URL'] = settings.INTERNAL_API_URL env['REST_API_TOKEN'] = job.task_auth_token or '' env['TOWER_HOST'] = settings.TOWER_URL_BASE + env['MAX_EVENT_RES'] = settings.MAX_EVENT_RES_DATA env['CALLBACK_QUEUE'] = settings.CALLBACK_QUEUE env['CALLBACK_CONNECTION'] = settings.BROKER_URL if getattr(settings, 'JOB_CALLBACK_DEBUG', False): diff --git a/awx/settings/defaults.py b/awx/settings/defaults.py index fbb9c8fb73..9c758dfb13 100644 --- a/awx/settings/defaults.py +++ b/awx/settings/defaults.py @@ -150,7 +150,11 @@ ALLOWED_HOSTS = [] REMOTE_HOST_HEADERS = ['REMOTE_ADDR', 'REMOTE_HOST'] # Note: This setting may be overridden by database settings. -STDOUT_MAX_BYTES_DISPLAY = 1048576 +STDOUT_MAX_BYTES_DISPLAY = 10485760 + +# The maximum size of the ansible callback event's res data structure +# beyond this limit and the value will be removed +MAX_EVENT_RES_DATA = 700000 # Note: This setting may be overridden by database settings. EVENT_STDOUT_MAX_BYTES_DISPLAY = 1024 @@ -522,17 +526,6 @@ ANSIBLE_FORCE_COLOR = True # the celery task. AWX_TASK_ENV = {} -# Maximum number of job events processed by the callback receiver worker process -# before it recycles -JOB_EVENT_RECYCLE_THRESHOLD = 3000 - -# Number of workers used to proecess job events in parallel -JOB_EVENT_WORKERS = 4 - -# Maximum number of job events that can be waiting on a single worker queue before -# it can be skipped as too busy -JOB_EVENT_MAX_QUEUE_SIZE = 100 - # Flag to enable/disable updating hosts M2M when saving job events. CAPTURE_JOB_EVENT_HOSTS = False