[AIRFLOW-2430] Extend query batching to additional slow queries#3324
[AIRFLOW-2430] Extend query batching to additional slow queries#3324gsilk wants to merge 1 commit into
Conversation
526d766 to
8bd93b4
Compare
Codecov Report
@@ Coverage Diff @@
## master #3324 +/- ##
==========================================
+ Coverage 76.11% 76.12% +0.01%
==========================================
Files 197 197
Lines 14741 14749 +8
==========================================
+ Hits 11220 11228 +8
Misses 3521 3521
Continue to review full report at Codecov.
|
08f08a9 to
27713de
Compare
|
Nice! Can you add some unit tests to the new functions you have added in |
|
Thanks for the feedback! I added a few unit tests, as well as sanity checks for the chunk_size argument in the helper methods. |
There was a problem hiding this comment.
Maybe set a default value in this for the configuration templates?
There was a problem hiding this comment.
My PR uses an existing config parameter that was used to implement batching, but for only -one- of the problematic queries. I've simply refactored and extended that approach.
So, the config parameter is actually already in the template, but the default is 0.
If we leave it at 0, Airflow's current behavior will be preserved. However, it might make sense to change the default to 512, which I've found to work well in practice.
WDYT?
There was a problem hiding this comment.
Yes, please add it to the config with a description what the configuration parameter does. I think it would be good to set it to 512, since it will improve performance.
There was a problem hiding this comment.
I've set it to 512 as a default, and added a more detailed comment
66ad43c to
239a4f2
Compare
Closes apache#3324 from gsilk/batch-inserts
Make sure you have checked all steps below.
JIRA
Description
This fix extends the query batching introduced by an earlier commit, along with a helper method for easily doing batched queries. It is necessary to help scale the scheduler to a large number of tasks. See JIRA issue for more details.
Tests
There is already test coverage for reset_state_for_orphaned_tasks(), and the max_tis_per_query config is already tested by test_execute_task_instances_limit
Commits
Documentation
Code Quality
git diff upstream/master -u -- "*.py" | flake8 --diff