Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to launch a mesos task on a particular executor?

Tags:

mesos

I am writing a mesos framework and I want to execute my tasks using my custom executor. I went through a couple of other mesos framework codebases (chronos and marathon) and wrote a scheduler that execute shell commands using the default command executor. Now I want to replace the default executor with something custom. The problem is I can not figure out how to register an executor with the slave. The documentation on building a framework states that it should be an executable and you can provide the path using executorInfo but I don't see exactly how to do it. Also, what's the point of having the Executor interface that every executor has to implement and at the same time requiring an executable on top of all that? What are the arguments to the executable?

like image 849
user1639848 Avatar asked Oct 03 '22 03:10

user1639848


1 Answers

The executor executable links against the mesos library and the executor interfaces / callbacks are the only way for you to be notified when events like registration, reregistration and disconnect happens in the slave or when launchTask or killTask requests are issued by your framework.

It is wired up in two pieces (just like frameworks are), consisting of an ExecutorDriver and your executor implementation.

If you take a look at mesos/executor.hpp, you'll notice that the constructor requires a pointer to an executor. For example

class MyExecutor : public Executor {
  /* Implement registered, reregistered, ... */
}

MesosExecutorDriver* driver = new MesosExecutorDriver(new MyExecutor());
driver->run();
// As long as the executor is running, the callbacks in MyExecutor will
// be invoked by the mesos slave when events and requests are received.

The different callbacks will provide you with the necessary protocol buffers (defined in mesos.proto) e.g. A TaskInfo in launchTask, TaskID in killTask and so on.

When it gets to the framework side and you want to register your own executor, try to take a look at https://github.com/mesosphere/mesos-go/blob/master/src/mesos.apache.org/example_framework/main.go .

Hope this helps and let me know if I need to expand on any of the above.

like image 141
Niklas Quarfot Nielsen Avatar answered Oct 07 '22 23:10

Niklas Quarfot Nielsen