Skip to content

Commit 9cb8041

Browse files
committed
[KYUUBI #3076][Subtask][#3039] Add the docs for rest api - Batch Resource
### _Why are the changes needed?_ Add the docs for batch resource rest api. Close #3076 ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [x] Add screenshots for manual tests if appropriate ![image](https://user-images.githubusercontent.com/6757692/178957570-b0b9b006-a9a0-413d-bf74-c9c744d1fd50.png) - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #3075 from turboFei/rest_api. Closes #3076 970498e [Fei Wang] Cap 445fde2 [Fei Wang] nit 4b0306d [Fei Wang] refactor b4a5a74 [Fei Wang] add rest api docs Authored-by: Fei Wang <fwang12@ebay.com> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent 6a6044b commit 9cb8041

File tree

2 files changed

+125
-1
lines changed

2 files changed

+125
-1
lines changed

docs/client/rest/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,5 @@ RESTful APIs and Clients
2020
.. toctree::
2121
:maxdepth: 2
2222

23-
hive_beeline
23+
rest_api
2424

docs/client/rest/rest_api.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
<!--
2+
- Licensed to the Apache Software Foundation (ASF) under one or more
3+
- contributor license agreements. See the NOTICE file distributed with
4+
- this work for additional information regarding copyright ownership.
5+
- The ASF licenses this file to You under the Apache License, Version 2.0
6+
- (the "License"); you may not use this file except in compliance with
7+
- the License. You may obtain a copy of the License at
8+
-
9+
- http://www.apache.org/licenses/LICENSE-2.0
10+
-
11+
- Unless required by applicable law or agreed to in writing, software
12+
- distributed under the License is distributed on an "AS IS" BASIS,
13+
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
- See the License for the specific language governing permissions and
15+
- limitations under the License.
16+
-->
17+
18+
# REST API v1
19+
20+
Note that: now the api version is v1 and the base uri is `/api/v1`.
21+
22+
## Batch Resource
23+
24+
### GET /batches
25+
26+
Returns all the batches.
27+
28+
#### Request Parameters
29+
30+
| Name | Description | Type |
31+
| :--------- |:--------------------------------------------------------------------------------------------------------| :----- |
32+
| batchType | The batch type, such as spark/flink, if no batchType is specified,<br/> return all types | String |
33+
| batchState | The valid batch state can be one of the following:<br/> PENDING, RUNNING, FINISHED, ERROR, CANCELED | String |
34+
| batchUser | The user name that created the batch | String |
35+
| createTime | Return the batch that created after this timestamp | Long |
36+
| endTime | Return the batch that ended before this timestamp | Long |
37+
| from | The start index to fetch sessions | Int |
38+
| size | Number of sessions to fetch | Int |
39+
40+
#### Response Body
41+
42+
| Name | Description | Type |
43+
| :------ | :---------------------------------- | :--- |
44+
| from | The start index of fetched sessions | Int |
45+
| total | Number of sessions fetched | Int |
46+
| batches | [Batch](#batch) List | List |
47+
48+
### POST /batches
49+
50+
#### Request Body
51+
52+
| Name | Description | Type |
53+
| :-------- |:---------------------------------------------------|:-----------------|
54+
| batchType | The batch type, such as Spark, Flink | String |
55+
| resource | The resource containing the application to execute | Path (required) |
56+
| className | Application main class | String(required) |
57+
| name | The name of this batch. | String |
58+
| conf | Configuration properties | Map of key=val |
59+
| args | Command line arguments for the application | List of Strings |
60+
61+
62+
#### Response Body
63+
64+
The created [Batch](#batch) object.
65+
66+
### GET /batches/{batchId}
67+
68+
Returns the batch information.
69+
70+
#### Response Body
71+
72+
The [Batch](#batch).
73+
74+
### DELETE /batches/${batchId}
75+
76+
Kill the batch if it is still running.
77+
78+
#### Request Parameters
79+
80+
| Name | Description | Type |
81+
| :---------------------- | :---------------------------- | :--------------- |
82+
| hive.server2.proxy.user | the proxy user to impersonate | String(optional) |
83+
84+
#### Response Body
85+
86+
| Name | Description | Type |
87+
| :------ |:--------------------------------------| :------ |
88+
| success | Whether killed the batch successfully | Boolean |
89+
| msg | The kill batch message | String |
90+
91+
### GET /batches/${batchId}/localLog
92+
93+
Gets the local log lines from this batch.
94+
95+
#### Request Parameters
96+
97+
| Name | Description | Type |
98+
| :--- | :-------------------------------- | :--- |
99+
| from | Offset | Int |
100+
| size | Max number of log lines to return | Int |
101+
102+
#### Response Body
103+
104+
| Name | Description | Type |
105+
| :-------- | :---------------- |:--------------|
106+
| logRowSet | The log lines | List of sting |
107+
| rowCount | The log row count | Int |
108+
109+
### Batch
110+
111+
| Name | Description | Type |
112+
| :------------- |:------------------------------------------------------------------| :----- |
113+
| id | The batch id | String |
114+
| user | The user created the batch | String |
115+
| batchType | The batch type | String |
116+
| name | The batch name | String |
117+
| appId | The batch application Id | String |
118+
| appUrl | The batch application tracking url | String |
119+
| appState | The batch application state | String |
120+
| appDiagnostic | The batch application diagnostic | String |
121+
| kyuubiInstance | The kyuubi instance that created the batch | String |
122+
| state | The kyuubi batch operation state | String |
123+
| createTime | The batch create time | Long |
124+
| endTime | The batch end time, if it has not been terminated, the value is 0 | Long |

0 commit comments

Comments
 (0)