Scaling Out with Mesos (community contributed)¶
Mesos Executor is deprecated (Jira)
There are two ways you can run airflow as a mesos framework:
Running airflow tasks directly on mesos slaves, requiring each mesos slave to have airflow installed and configured.
Running airflow tasks inside a docker container that has airflow installed, which is run on a mesos slave.
Tasks executed directly on mesos slaves¶
airflow.contrib.executors.mesos_executor.MesosExecutor allows you to schedule airflow tasks on a Mesos cluster.
For this to work, you need a running mesos cluster and you must perform the following
Install airflow on a mesos slave where web server and scheduler will run, let’s refer to this as the “Airflow server”.
On the Airflow server, install mesos python eggs from mesos downloads.
On the Airflow server, use a database (such as mysql) which can be accessed from all mesos slaves and add configuration in
airflow.cfgto point executor parameter to
MesosExecutorand provide related Mesos settings.
On all mesos slaves, install airflow. Copy the
airflow.cfgfrom Airflow server (so that it uses same sql alchemy connection).
On all mesos slaves, run the following for serving logs:
On Airflow server, to start processing/scheduling DAGs on mesos, run:
airflow scheduler -p
Note: We need -p parameter to pickle the DAGs.
You can now see the airflow framework and corresponding tasks in mesos UI. The logs for airflow tasks can be seen in airflow UI as usual.
For more information about mesos, refer to mesos documentation.
For any queries/bugs on
airflow.contrib.executors.mesos_executor.MesosExecutor, please contact @kapil-malik.
Tasks executed in containers on mesos slaves¶
This gist contains all files and configuration changes necessary to achieve the following:
Create a dockerized version of airflow with mesos python eggs installed.
We recommend taking advantage of docker’s multi stage builds in order to achieve this. We have one Dockerfile that defines building a specific version of mesos from source (Dockerfile-mesos), in order to create the python eggs. In the airflow Dockerfile (Dockerfile-airflow) we copy the python eggs from the mesos image.
Create a mesos configuration block within the
The configuration block remains the same as the default airflow configuration (default_airflow.cfg), but has the addition of an option
docker_image_slave. This should be set to the name of the image you would like mesos to use when running airflow tasks. Make sure you have the proper configuration of the DNS record for your mesos master and any sort of authorization if any exists.
airflow.cfgto point the executor parameter to
executor = SequentialExecutor).
Make sure your mesos slave has access to the docker repository you are using for your
The rest is up to you and how you want to work with a dockerized airflow configuration.