YARN-9122. Add table of contents to YARN Service API document. Contributed by Zhankun Tang.

This commit is contained in:
Akira Ajisaka 2018-12-15 10:29:47 +09:00
parent b2d7204ed0
commit 26e55d4ceb
No known key found for this signature in database
GPG Key ID: C1EDBB9CA400FD50

View File

@ -14,6 +14,9 @@
# YARN Service API # YARN Service API
<!-- MACRO{toc|fromDepth=0|toDepth=2} -->
## Introduction
Bringing a new service on YARN today is not a simple experience. The APIs of existing Bringing a new service on YARN today is not a simple experience. The APIs of existing
frameworks are either too low level (native YARN), require writing new code (for frameworks with programmatic APIs) frameworks are either too low level (native YARN), require writing new code (for frameworks with programmatic APIs)
or writing a complex spec (for declarative frameworks). or writing a complex spec (for declarative frameworks).
@ -433,9 +436,11 @@ The current status of a submitted service, returned as a response to the GET API
## Examples ## Examples
### Create a simple single-component service with most attribute values as defaults ### Create a simple single-component service with most attribute values as defaults
```
POST URL - http://localhost:8088/app/v1/services POST URL - http://localhost:8088/app/v1/services
```
##### POST Request JSON #### POST Request JSON
```json ```json
{ {
"name": "hello-world", "name": "hello-world",
@ -460,8 +465,10 @@ POST URL - http://localhost:8088/app/v1/services
} }
``` ```
##### GET Response JSON #### GET Response JSON
```
GET URL - http://localhost:8088/app/v1/services/hello-world GET URL - http://localhost:8088/app/v1/services/hello-world
```
Note, lifetime value of -1 means unlimited lifetime. Note, lifetime value of -1 means unlimited lifetime.
@ -522,9 +529,11 @@ Note, lifetime value of -1 means unlimited lifetime.
``` ```
### Update to modify the lifetime of a service ### Update to modify the lifetime of a service
```
PUT URL - http://localhost:8088/app/v1/services/hello-world PUT URL - http://localhost:8088/app/v1/services/hello-world
```
##### PUT Request JSON #### PUT Request JSON
Note, irrespective of what the current lifetime value is, this update request will set the lifetime of the service to be 3600 seconds (1 hour) from the time the request is submitted. Hence, if a a service has remaining lifetime of 5 mins (say) and would like to extend it to an hour OR if an application has remaining lifetime of 5 hours (say) and would like to reduce it down to an hour, then for both scenarios you need to submit the same request below. Note, irrespective of what the current lifetime value is, this update request will set the lifetime of the service to be 3600 seconds (1 hour) from the time the request is submitted. Hence, if a a service has remaining lifetime of 5 mins (say) and would like to extend it to an hour OR if an application has remaining lifetime of 5 hours (say) and would like to reduce it down to an hour, then for both scenarios you need to submit the same request below.
@ -534,9 +543,11 @@ Note, irrespective of what the current lifetime value is, this update request wi
} }
``` ```
### Stop a service ### Stop a service
```
PUT URL - http://localhost:8088/app/v1/services/hello-world PUT URL - http://localhost:8088/app/v1/services/hello-world
```
##### PUT Request JSON #### PUT Request JSON
```json ```json
{ {
"state": "STOPPED" "state": "STOPPED"
@ -544,9 +555,11 @@ PUT URL - http://localhost:8088/app/v1/services/hello-world
``` ```
### Start a service ### Start a service
```
PUT URL - http://localhost:8088/app/v1/services/hello-world PUT URL - http://localhost:8088/app/v1/services/hello-world
```
##### PUT Request JSON #### PUT Request JSON
```json ```json
{ {
"state": "STARTED" "state": "STARTED"
@ -554,9 +567,11 @@ PUT URL - http://localhost:8088/app/v1/services/hello-world
``` ```
### Update to flex up/down the number of containers (instances) of a component of a service ### Update to flex up/down the number of containers (instances) of a component of a service
```
PUT URL - http://localhost:8088/app/v1/services/hello-world/components/hello PUT URL - http://localhost:8088/app/v1/services/hello-world/components/hello
```
##### PUT Request JSON #### PUT Request JSON
```json ```json
{ {
"number_of_containers": 3 "number_of_containers": 3
@ -564,9 +579,11 @@ PUT URL - http://localhost:8088/app/v1/services/hello-world/components/hello
``` ```
Alternatively, you can specify the entire "components" section instead. Alternatively, you can specify the entire "components" section instead.
```
PUT URL - http://localhost:8088/app/v1/services/hello-world PUT URL - http://localhost:8088/app/v1/services/hello-world
##### PUT Request JSON ```
#### PUT Request JSON
```json ```json
{ {
"state": "FLEX", "state": "FLEX",
@ -581,14 +598,18 @@ PUT URL - http://localhost:8088/app/v1/services/hello-world
``` ```
### Destroy a service ### Destroy a service
```
DELETE URL - http://localhost:8088/app/v1/services/hello-world DELETE URL - http://localhost:8088/app/v1/services/hello-world
```
*** ***
### Create a complicated service - HBase ### Create a complicated service - HBase
```
POST URL - http://localhost:8088:/app/v1/services/hbase-app-1 POST URL - http://localhost:8088:/app/v1/services/hbase-app-1
```
##### POST Request JSON #### POST Request JSON
```json ```json
{ {
@ -685,9 +706,11 @@ POST URL - http://localhost:8088:/app/v1/services/hbase-app-1
``` ```
### Create a service requesting GPUs in addition to CPUs and RAM ### Create a service requesting GPUs in addition to CPUs and RAM
```
POST URL - http://localhost:8088/app/v1/services POST URL - http://localhost:8088/app/v1/services
```
##### POST Request JSON #### POST Request JSON
```json ```json
{ {
"name": "hello-world", "name": "hello-world",
@ -719,9 +742,11 @@ POST URL - http://localhost:8088/app/v1/services
``` ```
### Create a service with a component requesting anti-affinity placement policy ### Create a service with a component requesting anti-affinity placement policy
```
POST URL - http://localhost:8088/app/v1/services POST URL - http://localhost:8088/app/v1/services
```
##### POST Request JSON #### POST Request JSON
```json ```json
{ {
"name": "hello-world", "name": "hello-world",
@ -765,8 +790,10 @@ POST URL - http://localhost:8088/app/v1/services
} }
``` ```
##### GET Response JSON #### GET Response JSON
```
GET URL - http://localhost:8088/app/v1/services/hello-world GET URL - http://localhost:8088/app/v1/services/hello-world
```
Note, for an anti-affinity component no more than 1 container will be allocated Note, for an anti-affinity component no more than 1 container will be allocated
in a specific node. In this example, 3 containers have been requested by in a specific node. In this example, 3 containers have been requested by
@ -861,9 +888,11 @@ non-STABLE state.
``` ```
### Create a service with health threshold monitor enabled for a component ### Create a service with health threshold monitor enabled for a component
```
POST URL - http://localhost:8088/app/v1/services POST URL - http://localhost:8088/app/v1/services
```
##### POST Request JSON #### POST Request JSON
```json ```json
{ {
"name": "hello-world", "name": "hello-world",