Apache Mesos HTTP API – example IPython notebook

The new Apache Mesos HTTP API

We are currently in the process of releasing Mesos 0.24 which introduces a new HTTP API for Frameworks, which are now able to interact with the Scheduler using only JSON payloads.

This simplifies the interaction between Frameworks and Mesos, while maintaining the highly scalable and reliable nature of the platform: the interactions and resource allocation policies remain the same, so the new API will feel very familiar to anyone who has already developed Mesos Frameworks in the past.

The IPython Notebook

In order to show some of the features of the new API, I have created a simple IPython Notebook that very simply registers with a running Mesos Master, accepts an Offer for resources and then launches a simple command on the Agent Node.

To experiment with it, you will need to either build from source a recent 0.24 release candidate (currently, the 0.24-rc1 tag is available) or wait for a Mesosphere Package distribution to be available (it will be shortly after the community votes for the 0.24.0 to be released).

How to follow along

Once you have installed (or built) Mesos in your system (I recommend to do so in a Ubuntu 14.04 VM, using, e.g. VirtualBox) you can do the following:

git clone git@github.com:massenz/zk-mesos.git
cd zk-mesos
mkvirtualenv mesos
pip install -r requirements.txt
ipython notebook

this should open a new tab in your browser from where you can open the notebooks/HTTP API Tests notebook – if that doesn’t happen, just navigate to http://localhost:8888 from your browser.

I also recommend to keep another tab or window open to the Mesos UI (if you have launched mesos as suggested there, it will be at http://localhost:5051) which will show you the launched Framework(s) and the Task(s) that you launch; also, by following the links in the UI to the Tasks, you will be able to access the Sandbox and view the commands output in the stdout/stderr windows.

Future work

I plan to continue to add to this notebook; there is still a lot of functionality to explore, especially around Persistent Storage new functionality that adds the functionality necessary in Mesos to support Stateful Services that write to local disk and will need to access it back across restarts/failures.

Please let me know what you’d like to see here, and I will try my best to do it!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: