7.2 Airflow Executor#

Introduction to Executor#

../../_images/7_2_1.png
  • Executor๋Š” worker์—๊ฒŒ task๋ฅผ ์‹คํ–‰์‹œํ‚ค๋Š” ์—ญํ• ์ž…๋‹ˆ๋‹ค.

  • ์‹ค์ œ task์˜ ์‹คํ–‰์€ ์Šค์ผ€์ค„๋Ÿฌ ๋‚ด๋ถ€์—์„œ ์ˆ˜ํ–‰ํ•  ์ˆ˜๋„, ์™ธ๋ถ€์˜ worker์—๊ฒŒ ์‹คํ–‰์„ ๋งก๊ธธ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ๋‹ค์–‘ํ•œ ์ข…๋ฅ˜๊ฐ€ ์žˆ์œผ๋ฉฐ, ์ง์ ‘ machine ์„ pooling ํ•ด์„œ ๊ด€๋ฆฌํ•˜๋Š” ๊ฒฝ์šฐ์—๋Š” Celery Executor๋ฅผ, k8s ํ™˜๊ฒฝ ํ•˜์—์„œ๋Š” Kubernetes Exceutor ๋ฅผ ๊ฐ€์žฅ ๋งŽ์ด ์„ ํƒํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.

Sequential Executor (๊ธฐ๋ณธ ์ œ๊ณต)#

../../_images/7_2_2.png
  • Airflow๋ฅผ ์ฒ˜์Œ ์„ค์น˜ ์‹œ, ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.

  • ๊ธฐ๋ณธ DataBase์ธ SQLite์™€ ํ™œ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์ž‘์—…์„ ์ˆœ์ฐจ์ ์œผ๋กœ ์ง„ํ–‰ํ•˜๋Š” ๋‹จ์ผ ์Šค๋ ˆ๋“œ ๊ธฐ๋ฐ˜์œผ๋กœ ๋ณ‘๋ ฌ์ฒ˜๋ฆฌ๊ฐ€ ๋ถˆ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์Šค์ผ€์ผ ์ธ์•„์›ƒ์ด ๋ถˆ๊ฐ€๋Šฅ ํ•ฉ๋‹ˆ๋‹ค.

  • ์ฃผ๋กœ ์ดˆ๊ธฐ ๊ฐœ๋ฐœ ๋ฐ ํ…Œ์ŠคํŠธ ํ™˜๊ฒฝ์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.

Local Executor#

../../_images/7_2_3.png
  • ๋กœ์ปฌ์—์„œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰์‹œ์ผœ task๋ฅผ ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ์‹์ž…๋‹ˆ๋‹ค.

  • ๋ณ‘๋ ฌ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์Šค์ผ€์ผ๋ง ํ•˜๊ธฐ ์ ํ•ฉํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

  • ํ”„๋กœ๋•์…˜ ๋ ˆ๋ฒจ์—์„œ๋Š” ์ ๋‹นํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

Celery Executor#

../../_images/7_2_4.png
  • Celery ๋ฐฑ์—”๋“œ(RabbitMQ, Redis)๋ฅผ ํ™œ์šฉํ•ฉ๋‹ˆ๋‹ค.

  • ๋ถ„์‚ฐ task ์ฒ˜๋ฆฌ๊ฐ€ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ์ˆ˜ํ‰์  ์Šค์ผ€์ผ๋ง ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

  • ๋‚ด๊ฒฐํ•จ์„ฑ์„ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  • ํ”„๋กœ๋•์…˜ ๋ ˆ๋ฒจ์—๋„ ์ ํ•ฉํ•ฉ๋‹ˆ๋‹ค.

Kubernetes Executor#

../../_images/7_2_5.png
  • K8s ํ™˜๊ฒฝ์—์„œ ์ˆ˜ํ–‰ํ•ด์•ผ ํ•  ์‹œ์ ์ด ๋œ ํƒœ์Šคํฌ๋ฅผ ์Šค์ผ€์ค„๋Ÿฌ๊ฐ€ ์ฐพ๊ณ , Executor๊ฐ€ ๋™์ ์œผ๋กœ Airflow ์›Œ์ปค๋ฅผ POD ํ˜•ํƒœ๋กœ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

  • ๋ฆฌ์†Œ์Šค๋ฅผ ๊ฐœ๋ณ„ task์— ํ• ๋‹น ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.