As a SW/Ops/DB Engineer

riywo’s technology memo

Mesos Tutorial 3

To understand development of Mesos Framework, I developed a simple useless framework example called msh.

Usage

At first, you should distribute this directory to the all slaves on the same location.

Then, you can run msh command on any server. For example:

$ cat /etc/hosts | ./msh -- cat -n 2>/dev/null
     1  127.0.0.1 localhost
     2
     3  # The following lines are desirable for IPv6 capable hosts
     4  ::1 ip6-localhost ip6-loopback
     5  fe00::0 ip6-localnet
     6  ff00::0 ip6-mcastprefix
     7  ff02::1 ip6-allnodes
     8  ff02::2 ip6-allrouters
     9  ff02::3 ip6-allhosts

Internal

  • msh launches a msh-executor using one of resource offers
  • msh-executor starts the given command as a subprocess
  • msh reads its stdin and send the input to the slave as FrameworkMessage
  • msh-executor receives messages and write them to the subprocess.stdin
  • msh-executor reads the subprocess.stdout and sends the output to msh as FrameworkMessage
  • Each other sends a message ‘EOF’ as a signal of end of the pipe
  • msh prints received message

TODO

  • work with no stdin
  • streaming pipe
  • pipe multiple tasks like UNIX shell
  • interactive shell
  • error handling

Conclusion

Development of Mesos framework in Python is very easy. I hope this toy project is useful for someone who is interested in Mesos.

Comments