Manually run subquery for parent event updates #14044
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SUMMARY
This reduces the maximum time that may be spent in 2 bulk
.update
queries.What about the size of
set(changed)
? Could that be large? It can scale with the number of tasks run by a playbook, but from experimentation it is very clear that it will not scale with the number of hosts. So imagine that you run 5 tasks (all changed) against 50,000 hosts. This will produce potentially 2,500,000 events withchanged
set to True. However, all those changed events will only have 5 unique parent_uuids.Some people will run playbooks that produce a lot of changed tasks against 1 or 2 hosts, this is true (assume all tasks are changed). But "a lot" here only scales with the volume of automation that people write. 1,000 tasks wouldn't surprise me, and 10,000 might be possible, but I think this code will still work. Beyond that, you stretch credibility. In fact, we already do operations on this scale (and greater) with the recently-added
/api/v2/jobs/132/job_events/children_summary/
, justified by these same arguments.This also adds a DEBUG log because this is only done 1 time for each job and this is frequently of interest.
ISSUE TYPE
COMPONENT NAME