You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mesos.apache.org by Wenzhao Zhang <wz...@ncsu.edu> on 2017/07/20 13:23:12 UTC

How to launch a framework via Mesos REST API

Hi, Everyone:

I'm wondering how to launch a framework (e.g. a  docker app) via Mesos'
REST API?  I just checked all the HTTP endpoints
<http://mesos.apache.org/documentation/latest/endpoints/>.  But don't see
anything helpful.

The reason for this question is that, I've tried Marathon
<https://mesosphere.github.io/marathon/>, which just need a Mesos master's
address, and we can launch a framework over Mesos  via Marathon's REST API.

I think Marathon takes advantages over Mesos's API.  But I don't want to
involve Marathon.  I want to launch a framework directly via Mesos REST
API.  Could someone please help? What's the best approach?

Thanks
Wenzhao

Re: How to launch a framework via Mesos REST API

Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Thanks so much for the clarification, Benjamin.

Wenzhao


On Fri, Jul 21, 2017 at 11:22 AM, Benjamin Bannier <
benjamin.bannier@mesosphere.io> wrote:

> Hi Wenzhao,
>
> > I agree your statement, Marathon is only a management layer over Mesos.
>
> I believe I did not write that.
>
> > But, we can run a framework on Mesos via invoking Marathon's REST API.
> > How does this happen?  I think Marathon internally calls Mesos's API to
> start the framework.  But I don't see Mesos REST API to create a
> framework.  I only know to run a framework via "mesos-execute" command.
> >
> > Or maybe Marathon implements its own scheduler, and execute a framework
> by itself?
>
> You are still mixing a few things up:
>
> * Marathon is a Mesos framework. A framework primarily consists of a
> scheduler.
> * `mesos-execute` creates a one-off framework. That framework will submit
> and manage the given task(s). The framework is stopped when the task(s)
> finish.
> * There are different APIs. One of them is the scheduler API which
> frameworks use to talk to Mesos, another one the operator API which can be
> use to administrate Mesos. One cannot start tasks with the operator API.
>
> The documentation contains a lot of this, including diagrams making things
> clearer,
>
>   https://mesos.apache.org/documentation/
>
> I’d especially encourage you to read the architecture overview,
>
>   https://mesos.apache.org/documentation/latest/architecture/
>
> and the documentation of the operator HTTP API,
>
>   https://mesos.apache.org/documentation/latest/operator-http-api/
>
>
> Cheers and HTH,
>
> Benjamin

Re: How to launch a framework via Mesos REST API

Posted by Benjamin Bannier <be...@mesosphere.io>.
Hi Wenzhao,

> I agree your statement, Marathon is only a management layer over Mesos. 

I believe I did not write that.

> But, we can run a framework on Mesos via invoking Marathon's REST API.  
> How does this happen?  I think Marathon internally calls Mesos's API to start the framework.  But I don't see Mesos REST API to create a framework.  I only know to run a framework via "mesos-execute" command. 
> 
> Or maybe Marathon implements its own scheduler, and execute a framework by itself?

You are still mixing a few things up:

* Marathon is a Mesos framework. A framework primarily consists of a scheduler.
* `mesos-execute` creates a one-off framework. That framework will submit and manage the given task(s). The framework is stopped when the task(s) finish.
* There are different APIs. One of them is the scheduler API which frameworks use to talk to Mesos, another one the operator API which can be use to administrate Mesos. One cannot start tasks with the operator API.

The documentation contains a lot of this, including diagrams making things clearer,

  https://mesos.apache.org/documentation/

I’d especially encourage you to read the architecture overview,

  https://mesos.apache.org/documentation/latest/architecture/

and the documentation of the operator HTTP API,

  https://mesos.apache.org/documentation/latest/operator-http-api/


Cheers and HTH,

Benjamin

Re: How to launch a framework via Mesos REST API

Posted by Wenzhao Zhang <wz...@ncsu.edu>.
Hi, Benjamin:

Thanks for the feedback.
I agree your statement, Marathon is only a management layer over Mesos.

But, we can run a framework on Mesos via invoking Marathon's REST API.
How does this happen?  I think Marathon internally calls Mesos's API to
start the framework.  But I don't see Mesos REST API to create a
framework.  I only know to run a framework via "mesos-execute" command.

Or maybe Marathon implements its own scheduler, and execute a framework by
itself?

Thanks
Wenzhao


On Fri, Jul 21, 2017 at 8:28 AM, Benjamin Bannier <
benjamin.bannier@mesosphere.io> wrote:

> Hi Wenzhao,
>
> I am not sure I understand you exactly.
>
> All Mesos tasks (the stuff running on and managed by Mesos agents) always
> belong to a framework; this framework launches and supervises them, and
> manages their lifetime. It is not possible to start tasks without a
> framework.
>
> Marathon is a framework. Usually the framework process is not started as a
> Mesos task, but instead started by e.g., init.d/systemd, so the framework
> itself is not supervised by Mesos. Users can start Mesos tasks by e.g.,
> hitting Marathon endpoints. Marathon then starts a task with Mesos and
> makes sure that the task keeps running (similar to how e.g., systemd might
> make sure that the Marathon framework process is running).
>
> Frameworks can talk to Mesos with two different APIs (often called v0 and
> v1); v0 is a C++ API while v1 communicates over HTTP. v1 is not a REST API.
>
> To launch Mesos tasks you will need a framework. You can either write a
> framework yourself, or use an existing one (there’s one list of some
> frameworks here, https://mesos.apache.org/documentation/latest/frameworks/
> ).
>
>
> Cheers,
>
> Benjamin

Re: How to launch a framework via Mesos REST API

Posted by Benjamin Bannier <be...@mesosphere.io>.
Hi Wenzhao,

I am not sure I understand you exactly.

All Mesos tasks (the stuff running on and managed by Mesos agents) always belong to a framework; this framework launches and supervises them, and manages their lifetime. It is not possible to start tasks without a framework.

Marathon is a framework. Usually the framework process is not started as a Mesos task, but instead started by e.g., init.d/systemd, so the framework itself is not supervised by Mesos. Users can start Mesos tasks by e.g., hitting Marathon endpoints. Marathon then starts a task with Mesos and makes sure that the task keeps running (similar to how e.g., systemd might make sure that the Marathon framework process is running).

Frameworks can talk to Mesos with two different APIs (often called v0 and v1); v0 is a C++ API while v1 communicates over HTTP. v1 is not a REST API. 

To launch Mesos tasks you will need a framework. You can either write a framework yourself, or use an existing one (there’s one list of some frameworks here, https://mesos.apache.org/documentation/latest/frameworks/).


Cheers,

Benjamin