Skip to content

Conversation

@KevinYang21
Copy link
Member

@KevinYang21 KevinYang21 commented Nov 25, 2018

Jira

  • My PR addresses the following Airflow Jira issues and references them in the PR title.

Description

Summary of major changes:

  • Celery executor will create a process pool to enqueue celery task in parallel.
  • Scheduler job will not pass TaskInstance to executor when trying to queue command, instead it passes SimpleTaskInstance, in order to enable parallel enqueuing.
  • Scheduler no longer checks task instance state before enqueuing because worker already checks task instance state before executing. Our cluster has been requeuing everything for a long time and there should be no risk removing that redundant check.

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

tests/executors/test_celery_executor.py:TestCeleryExecutor.test_error_sending_task
tests/jobs.py:SchedulerJobTest.test_change_state_for_tasks_failed_to_execute

Also updated existing failing unit test.

The change has been running in Airbnb internal cluster for 3 months+.

Before:
Before (32k tasks should run on 13:30 but didn't get >30k running tasks until 13:41):
screen shot 2018-08-31 at 3 26 48 pm

After (32k tasks should run on 15:10 and got them all running at 15:14):
screen shot 2018-08-31 at 3 26 11 pm

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes git diff upstream/master -u -- "*.py" | flake8 --diff

@KevinYang21 KevinYang21 force-pushed the kevin_yang_parallelize_enqueue branch 8 times, most recently from 70232e9 to 33ce56d Compare November 27, 2018 07:27
@KevinYang21 KevinYang21 changed the title [WIP][AIRFLOW-2761] Parallelize enqueue in celery executor [AIRFLOW-2761] Parallelize enqueue in celery executor Nov 27, 2018
@codecov-io
Copy link

codecov-io commented Nov 27, 2018

Codecov Report

Merging #4234 into master will increase coverage by 0.01%.
The diff coverage is 82.48%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4234      +/-   ##
==========================================
+ Coverage   77.82%   77.84%   +0.01%     
==========================================
  Files         201      201              
  Lines       16367    16455      +88     
==========================================
+ Hits        12738    12809      +71     
- Misses       3629     3646      +17
Impacted Files Coverage Δ
airflow/utils/timeout.py 78.57% <100%> (+0.79%) ⬆️
airflow/models.py 92.29% <100%> (ø) ⬆️
airflow/executors/base_executor.py 95.16% <100%> (+1.41%) ⬆️
airflow/executors/celery_executor.py 76.92% <68.51%> (-3.69%) ⬇️
airflow/utils/dag_processing.py 59.53% <86.11%> (+1.67%) ⬆️
airflow/jobs.py 77.66% <93.93%> (+0.29%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fd409d...554b4cf. Read the comment docs.

@KevinYang21 KevinYang21 force-pushed the kevin_yang_parallelize_enqueue branch 2 times, most recently from 93b5333 to d93d295 Compare November 27, 2018 10:18
@KevinYang21
Copy link
Member Author

Finally got this long overdue PR out :D
@Fokko @ashb @feng-tao @XD-DENG @kaxil @saguziel @aoen @YingboWang PTAL

@ashb
Copy link
Member

ashb commented Nov 27, 2018

Awesome, always love the detail in your PR descriptions 💖

@XD-DENG
Copy link
Member

XD-DENG commented Nov 27, 2018

Hi @KevinYang21 , haven’t got time to check details now. A few very minor points above first.

@KevinYang21 KevinYang21 force-pushed the kevin_yang_parallelize_enqueue branch from d93d295 to 554b4cf Compare November 27, 2018 21:39
@kaxil kaxil merged commit 1d53f93 into apache:master Nov 28, 2018
@kaxil
Copy link
Member

kaxil commented Nov 28, 2018

@Fokko Thoughts on including this to 1.10.2 ???

@KevinYang21
Copy link
Member Author

I would vote +1 to include so that we have a complete story around scaling in 1.10.2

@feng-tao
Copy link
Member

hey @KevinYang21 , I discussed with Max and heard that Airbnb run 2000+ dag in prod daily. I wonder what's the setup look like? Do you guys do multi airflow clusters?

@feng-tao
Copy link
Member

BTW, pr nicely done!

@KevinYang21
Copy link
Member Author

@feng-tao ty and ty for the reviews you have done. We have ~1600 active DAGs after some recent pruning and we don't do multi cluster. I shared some of our setup in a thread from the dev mail list. I'm happy to share more details if you'd like. In fact I think it would be a good idea for us to have a short meet up( maybe lunch on either side) to discuss more efficiently. Or if the schedule is tight we can do a webex too.

@feng-tao
Copy link
Member

thanks @KevinYang21 . Yeah, let me go back and check with the team. It definitely helps to share and learn more from Airbnb's experience.

elizabethhalper pushed a commit to cse-airflow/incubator-airflow that referenced this pull request Dec 7, 2018
aliceabe pushed a commit to aliceabe/incubator-airflow that referenced this pull request Jan 3, 2019
ashb pushed a commit to ashb/airflow that referenced this pull request Mar 7, 2019
@will-beta
Copy link

@KevinYang21 hi, how do you guys get >30k running tasks in Airbnb internal cluster?
We can only get 20 or so running tasks in our internal cluster, because the 16-vCores PostgreSQL server our airflow is using keeps at 90% CPU consumption all the time, and we don't know how to make this down a little bit.
So curious!
Thanks in advance!

wmorris75 pushed a commit to modmed-external/incubator-airflow that referenced this pull request Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants