The next step is to accept the offer from the Mesos Master and launch a custom task on our running Mesos agent. This brings us into contact with another part of the Mesos architecture: an Executor. An Executor is the process on the Mesos agent which is used to launch and monitor a task. While it is possible to write a custom Executor, for this example we’ll just be using the Mesos provided one.
Mesos provides a simple executor that can execute shell commands and Docker containers on behalf of the framework scheduler; enough functionality for a wide variety of framework requirements.
To use the default executor, we simply need to include a command as a top-level field under task_infos. If we wanted to use a custom executor, we would nest command inside an executor node.
Command below. Remember to update the values for:
In terminal 4:
(due to the size of this outrageous JSON blob I recommend dropping this command into POSTMAN to avoid weird copy/paste issues in a terminal)
Mesos responds with a 202 indicating that it Accepted the request but has not processed it. This is a good example of the Actor model, one-way communication implemented by Mesos.
Flipping thru the open terminals here is some interesting output:
Master node:
In our Framework terminal:
Back in the browser at http://localhost:5050/#/, we should see the shell hello world loop task under active tasks! Clicking into the sandbox, then the stdout will reveal our looping terminal output.
We’ve just deployed a task! Are you feeling the cloud??
Acknowledge a status update from Mesos
To be a good citizen we need to acknowledge the status update from Mesos. (the Framework terminal will indicate that )
In Terminal 4:
Flipping to the Master node terminal:
Nice.
Launch a Docker container
Now scroll back up a bit and you will find another Offer from the Mesos master. Let’s accept that offer and launch a Docker task!