Airflow 공식 문서에서 Airflow Executor를 읽고 번역 및 정리한 글이다.
SequentialExecutor 을 사용할 수 있지만, parallel task가 실행되지 않기에 production 용도로서는 적합하지 않다. some Airflow features (e.g. running sensors)은 제대로 동작하지 않을 수 있다. ⇒ 따라서 작은 단일 머신으로 설치한다면 LocalExecutor 을 사용해야하고 multi-machine/cloud installation를 위해서는 remote executor 중 하나를 사용하는 것이 좋다.하나의 airflow 시스템(클러스터)에서 여러 종류의 Executor를 사용하는 것에 관한 설명.
! Multiple Executors configuration 는 현재 lpha/experimental feature로서, 예고없이 변경될 수 있다.
Starting with version 2.10.0, Airflow can now operate with a multi-executor configuration. Each executor has its own set of pros and cons, often they are trade-offs between latency, isolation and compute efficiency among other properties (see here for comparisons of executors). Running multiple executors allows you to make better use of the strengths of all the available executors and avoid their weaknesses. In other words, you can use a specific executor for a specific set of tasks where its particular merits and benefits make the most sense for that use case.
Configuration
[core]
executor = 'KubernetesExecutor,my.custom.module.ExecutorClass'
Multiple Executors는 잘 사용하지 않을거 같아서 자세한 내용은 스킵. 필요하다면 해당 링크 참조
All Airflow executors는 a common interface를 구현하여 플러그형으로 사용할 수 있으며, All Airflow executors는 Airflow 내 모든 기능과 통합에 대해 접근할 수 있다. 주로 Airflow 스케줄러가 executor와 통신하기 위해 이 interface를 사용하지만 로깅, CLI, 백필과 같은 다른 구성 요소도 이 인터페이스를 사용한다. The public interface는 BaseExecutor이다. 세부적이고 최신 interface는 코드를 통해 확인할 수 있지만, 주요사항을 요약하였다. (For more information about Airflow’s public interface see Public Interface of Airflow.)
custom executor를 사용하는 케이스
custom executor도 현재 사용할 일이 없어서 자세한 내용은 스킵함. 필요하다면 해당 링크 참조
현재는 하나의 host에서 docker를 이용하여 local executor와 celery executor를 사용하는 것을 고민중이기에 이 측면에 대하여 위 글을 읽고 생각을 정리해본다.
하나의 서버에서 local executor로 사용하는 것보다는 host의 자원이 꽤 풍족한 경우 celery executor를 활용하는 것이 좋을 거 같다. 각 컨테이너 별로 cpu 자원을 설정하는 경우, local executor는 스케줄러 컨테이너에서 task가 처리되고 worker만을 스케일링 할 수 없지만 celery executor로는 각 컨테이너에 대한 자원을 알맞게 설정할 수 있고 worker를 스케일링 할 수 있기에 작업량이 많거나 적어지는 경우 스케일을 조정하여 효율적으로 자원을 활용할 수 있을거라 생각하기 때문이다. 또한 celery executor를 통해 여러개의 worker를 뛰우면 비교적 안정적으로 운영이 가능하지 않을까 싶다. 물론 여러 개의 서버가 있는게 속도가 더욱 빠르고 안정적이겠지만…