-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve event processing performance by passing host_id through event data #5514
Comments
|
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
additionaly, optimize away several per-event host lookups and changed/failed propagation lookups we've always performed these (fairly expensive) queries *on every event save* - if you're processing tens of thousands of events in short bursts, this is way too slow this commit also introduces a new command for profiling the insertion rate of events, `awx-manage callback_stats` see: ansible#5514
Could this change have caused this traceback in logs while saving events?
|
that looks more related to teardown code. Inventory updates don't link from events to the host (only jobs and ad hoc commands do). What you're seeing sounds like someone had a running inventory update and deleted the inventory update, or related inventory, or related organization. We have logic to prevent that, but it might not be airtight. Or it could be that the inventory update finished and was deleted, but not all of its events had finished processing. In that case, the tracebacks are not necessarily bad. |
@kdelee that error is what @AlanCoding suggested, and isn't unique to this change - it occurs if the callback receiver tries to save an inventory update event that's related to an inventory update that no longer exists you can reproduce this pretty easily by:
as long as things recover and stdout still flows for new jobs after this, errors in the logs for this situation are fine/expected |
ok cool |
Did the following to verify this:
See below an example of the following event for one of the hosts: {
"id": 559,
"type": "job_event",
"url": "/api/v2/job_events/559/",
"related": {
"job": "/api/v2/jobs/34/",
"children": "/api/v2/job_events/559/children/",
"host": "/api/v2/hosts/1/"
},
"summary_fields": {
"host": {
"id": 1,
"name": "localhost",
"description": ""
},
"job": {
"id": 34,
"name": "Demo Job Template",
"description": "",
"status": "successful",
"failed": false,
"elapsed": 3.594,
"type": "job",
"job_template_id": 7,
"job_template_name": "Demo Job Template"
},
"role": {}
},
"created": "2020-02-12T16:12:21.842052Z",
"modified": "2020-02-12T16:12:21.946018Z",
"job": 34,
"event": "runner_on_ok",
"counter": 8,
"event_display": "Host OK",
"event_data": {
"playbook": "hello_world.yml",
"playbook_uuid": "dfb499d2-c070-425e-9d01-882e606180e7",
"play": "Hello World Sample",
"play_uuid": "0242ac12-0005-6c79-06b4-000000000006",
"play_pattern": "all",
"task": "Hello Message",
"task_uuid": "0242ac12-0005-6c79-06b4-000000000008",
"task_action": "debug",
"task_args": "",
"task_path": "/tmp/awx_34_ezqkhwpa/project/hello_world.yml:4",
"host": "localhost",
"remote_addr": "localhost",
"res": {
"msg": "Hello World!",
"_ansible_verbose_always": true,
"_ansible_no_log": false,
"changed": false
},
"event_loop": null,
"uuid": "c681c3d4-83ce-423d-8a11-46bd2c616e37"
},
"event_level": 3,
"failed": false,
"changed": false,
"uuid": "c681c3d4-83ce-423d-8a11-46bd2c616e37",
"parent_uuid": "0242ac12-0005-6c79-06b4-000000000008",
"host": 1,
"host_name": "localhost",
"playbook": "hello_world.yml",
"play": "Hello World Sample",
"task": "Hello Message",
"role": "",
"stdout": "\u001b[0;32mok: [localhost] => {\u001b[0m\r\n\u001b[0;32m \"msg\": \"Hello World!\"\u001b[0m\r\n\u001b[0;32m}\u001b[0m",
"start_line": 7,
"end_line": 10,
"verbosity": 0
} With this we can consider this issue as verified. |
ISSUE TYPE
SUMMARY
Proposal to eliminate the need to do a query on every job event save to obtain the database id of the host it is operating on.
This logic would be replaced:
awx/awx/main/models/events.py
Lines 354 to 367 in 112f896
The host id can be obtained in the script data if using these parameters
/api/v2/inventories/45/script/?towervars=1&hostvars=1
, example:This proposal is to apply those parameters to the normal pre-job-run inventory script generation. Then when saving events, obtain
remote_tower_id
from hostvars. This will have to be done in ansible-runner. That will need to be added into the event data, then discovered in the event saving code, and used instead of the query to obtain the host id.Related to or maybe part of #4209 #5443. This can be done and tested separately before the main feature work. Ping @chrismeyersfsu
The text was updated successfully, but these errors were encountered: