c h e d u l e r M a s t e r A g e n t E x e c u t o r Scheduler API Executor API Framework API Master API Agent API O p e r a t o r O p e r a t o r Operator API Internal API
1.1 - RPC based • Based on Calls, Responses and Events • Client opens connections to the master/agent • One (or more) connection(s) to send Calls • A Call might get a Response, stream of Events, or no response
R O T O C O L • Every call is a HTTP POST request • Content-Type: application/json or application/x-protobuf • Successful SUBSCRIBE call results in a “200 OK” streaming response • Record-IO formatted events • Persistent connection • “Mesos-Stream-Id” header (schedulers only for now) • All successful non-SUBSCRIBE calls result in “202 Accepted” • Must include “Mesos-Stream-Id" header (schedulers only for now)
OK Content-Type: application/json Transfer-Encoding: chunked Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af <event length>{ "type": "SUBSCRIBED", "subscribed": { "framework_id": { "value": "12220-3440-12532-2345" }, "heartbeat_interval_seconds": 15 } }<more events> <more events> SUBSCRIBE Streaming Response M a s t e r S c h e d u l e r
h e d u l e r M a s t e r Offers Event <event-length> { "type" : "OFFERS", "offers" : [ { "offer_id":{"value": "12214-23523-O235235"}, "framework_id":{"value": "12124-235325-32425"}, "agent_id":{"value": "12325-23523-S23523"}, "hostname":"agent.host", "resources":[...], "attributes":[...], "executor_ids":[] } ] } A g e n t
h e d u l e r M a s t e r ACCEPT POST /api/v1/scheduler HTTP/1.1 Mesos-Stream-Id: 130ae4e3-6b13-4ef4-baa9-9f2e85c3e9af { "framework_id" : {"value" : "12220-3440-12532-2345"}, "type" : "ACCEPT", "accept" : { "offer_ids" : [ {"value" : "12220-3440-12532-O12"}, {"value" : "12220-3440-12532-O12"} ], "operations" : [ {"type" : "LAUNCH", "launch" : {...}} ], "filters" : {...} } } A g e n t
h e d u l e r M a s t e r E x e c u t o r SUBSCRIBE POST /api/v1/executor HTTP/1.1 { "type": "SUBSCRIBE", "executor_id": { "value": "387aa966-8fc5-4428-a794-5a868a60d3eb" }, "framework_id": { "value": "49154f1b-8cf6-4421-bf13-8bd11dccd1f1" } } A g e n t
h e d u l e r HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked <event length> { "type" : "SUBSCRIBED", "subscribed" : {…} } <more events> Streaming Response S c h e d u l e r M a s t e r E x e c u t o r A g e n t E x e c u t o r SUBSCRIBE
h e d u l e r HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked <event-length> { "type": "LAUNCH", "launch": (…) } <more events> Launch Event S c h e d u l e r M a s t e r E x e c u t o r A g e n t E x e c u t o r
I S C O N N E C T I O N S & PA R T I T I O N S • Master tracks the persistent subscription connection • Reconnect within framework failover timeout • Periodic HEARTBEAT events sent by master
A P I • Similar to Framework API • Some Calls get Responses • Streaming support! • Subscribe to events happening on the cluster e.g., SUBSCRIBED, TASK_ADDED, TASK_UPDATED • SUBSCRIBED includes the snapshot of the state
e r a t o r M a s t e r SUBSCRIBE Streaming Response HTTP/1.1 200 OK Content-Type: application/json Transfer-Encoding: chunked <event length>{ "type" : “SUBSCRIBED”, “subscribed" : { “get_state" : { “get_tasks” : {} “get_executors” : {} “get_frameworks” : {} “get_agents” : {} } } }<more events>
e r a t o r M a s t e r TASK_ADDED Event <event-length> { "type": "TASK_ADDED", "task_added": { "task": { "name": "dummy-task", "task_id": {"value": "12344-my-task"}, "agent_id": {"value": “1424-32423-S0”}, … } } }<more events>
e r a t o r M a s t e r TASK_UPDATED Event <event length>{ "type" : “TASK_UPDATED”, “task_updated" : { "task_id" : { "value" : “12344-my-task"}, “framework_id" : { "value" : “1144-12-123"}, "agent_id" : { "value" : "1424-32423-S0"}, "state" : "TASK_RUNNING", } }<more events>
I C Y • Upgrade from any minor version to any minor version! • 1.2 —> 1.8 (no need to go through 1.3 to 1.7) • Caveat: Doesn’t apply to deprecated features • Deprecation period for a feature is 6 months
? S c h e d u l e r M a s t e r A g e n t E x e c u t o r /api/v1/scheduler /api/v1/executor /api/v1/agent /api/v1 /api/v1 O p e r a t o r O p e r a t o r