kaysoky / InverseOfferExampleFramework

Moved into apache/mesos as an example framework: https://github.com/apache/mesos/tree/master/src/examples/inverse_offer_framework.cpp. Originally a hands-on example to match https://mesosphere.com/blog/2015/10/07/mesos-inverse-offers/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A maintenance-tolerant distributed-sleep framework!

Sleep is essential for a person's health and wellbeing, according to the National Sleep Foundation (NSF). Yet millions of people do not get enough sleep and many suffer from lack of sleep. For example, surveys conducted by the NSF (1999-2004) reveal that at least 40 million Americans suffer from over 70 different sleep disorders and 60 percent of adults report having sleep problems a few nights a week or more. Most of those with these problems go undiagnosed and untreated. In addition, more than 40 percent of adults experience daytime sleepiness severe enough to interfere with their daily activities at least a few days each month - with 20 percent reporting problem sleepiness a few days a week or more. Furthermore, 69 percent of children experience one or more sleep problems a few nights or more during a week.

Since sleep is so important, we try to maintain a minimum number of sleep tasks active at all times. However, if our resting places (agents) need cleaning (maintenance), we obviously need to move and sleep elsewhere.

Installation (OSX)

brew install boost
brew install protobuf250
brew install glog
wget -O /usr/local/include/picojson.h https://raw.githubusercontent.com/kazuho/picojson/rel/v1.3.0/picojson.h

Build

make

Start Cluster

This example assumes the cluster is all running locally. Run this to open up loopback interfaces for agents to use:

sudo python loopback.py -n 9 --open

Run this to start a cluster:

python start_mesos.py -n 10 /path/to/mesos/build/bin

Start Framework

example --master <host:port> -n <number of sleep tasks>

Open the Mesos UI

Run:

python schedule.py <host:port>

Watch tasks get moved around.

Perform "Maintenance"

Bring a machine down:

python machine.py <master host:port> <agent host> --down

You'll notice that this also kills the agent. You'll need to restart it manually. However, the agent won't be allowed to register until the machine is brought back up.

Bring a machine back up:

python machine.py <master host:port> <agent host> --up

References

About

Moved into apache/mesos as an example framework: https://github.com/apache/mesos/tree/master/src/examples/inverse_offer_framework.cpp. Originally a hands-on example to match https://mesosphere.com/blog/2015/10/07/mesos-inverse-offers/


Languages

Language:C++ 68.3%Language:Python 30.4%Language:Makefile 1.3%