Rest API使用文档


1. 批处理会话

1.1 返回运行中的批处理会话

  • 请求格式:**/batches**
  • 请求类型:**GET**

    1.1.1 请求体

    | Name | Description | Type | | :—- | :—- | :—- | | from | The start index to fetch sessions | int | | size | Number of sessions to fetch | int |

1.1.2 响应体

Name Description Type
from The start index of fetched sessions int
total Number of sessions fetched int
sessions Batch list list

1.2 运行批处理会话

  • 请求格式:**/batches**
  • 请求类型:**POST**

    1.2.1 请求体

    | Name | Description | Type | | :—- | :—- | :—- | | file | File containing the application to execute | path (required) | | proxyUser | User to impersonate when running the job | string | | className | Application Java/Spark main class | string | | args | Command line arguments for the application | list of strings | | jars | jars to be used in this session | list of strings | | pyFiles | Python files to be used in this session | list of strings | | files | files to be used in this session | list of strings | | driverMemory | Amount of memory to use for the driver process | string | | driverCores | Number of cores to use for the driver process | int | | executorMemory | Amount of memory to use per executor process | string | | executorCores | Number of cores to use for each executor | int | | numExecutors | Number of executors to launch for this session | int | | archives | Archives to be used in this session | List of string | | queue | The name of the YARN queue to which submitted | string | | name | The name of this session | string | | conf | Spark configuration properties | Map of key=val |

1.2.1 响应体

Name Description Type
id The session id int
appId The application id of this session string
appInfo The detailed application info Map of key=val
log The log lines list of strings
state The batch state string

1.3 获取批处理会话信息

  • 请求格式:**/batches/{batchId}**
  • 请求类型:**GET**

    1.3.1 响应体

    | Name | Description | Type | | :—- | :—- | :—- | | id | The session id | int | | appId | The application id of this session | string | | appInfo | The detailed application info | Map of key=val | | log | The log lines | list of strings | | state | The batch state | string |

1.4 获取批处理会话状态

  • 请求格式:**/batches/{batchId}/state**
  • 请求类型:**GET**

    1.4.1 响应体

    | Name | Description | Type | | :—- | :—- | :—- | | id | Batch session id | int | | state | The current state of batch session | string |

1.5 停止批处理会话

  • 请求格式:**/batches/{batchId}**
  • 请求类型:**DELETE**

    1.6 获取批处理会话的日志

  • 请求格式:**/batches/{batchId}/log**

  • 请求类型:**GET**

    1.6.1 请求体

    | Name | Description | Type | | :—- | :—- | :—- | | from | Offset | int | | size | Max number of log lines to return | int |

1.6.2 响应体

Name Description Type
id The batch id int
from Offset from start of log int
size Number of log lines int
log The log lines list of strings

2. 其他API介绍

2.1 返回会话详情

  • 请求格式:**/sessions/{sessionId}**
  • 请求类型:**GET**

    2.1.1 响应体:

  • session | Name | Description | Type | | :—- | :—- | :—- | | id | The session id | int | | appId | The application id of this session | string | | owner | Remote user who submitted this session | string | | proxyUser | User to impersonate when running | string | | kind | Session kind (spark, pyspark, sparkr, or sql) | session kind | | log | The log lines | list of strings | | state | The session state | string | | appInfo | The detailed application info | Map of key=val |

2.2 返回会话状态

  • 请求格式:/sessions/{sessionId}/state
  • 请求类型:GET

    2.2.1 响应体

  • 会话详情 | Name | Description | Type | | :—- | :—- | :—- | | id | Session id | int | | state | The current state of session | string |

2.3 停止会话任务

  • 请求格式:/sessions/{sessionId}
  • 请求类型:DELETE

    2.4 获取会话日志

  • 请求格式:/sessions/{sessionId}/log

  • 请求类型:GET

    2.4.1 请求体

    | Name | Description | Type | | :—- | :—- | :—- | | from | Offset | int | | size | Max number of log lines to return | int |

2.4.2 响应体

Name Description Type
id The session id int
from Offset from start of log int
size Max number of log lines int
log The log lines list of strings

2.5 返回会话中的所有语句

  • 请求格式:/sessions/{sessionId}/statements
  • 请求类型:GET

    2.5.1 响应体

    | Name | Description | Type | | :—- | :—- | :—- | | statements | statement list | list |

2.6 运行会话中的一条语句

  • 请求格式:/sessions/{sessionId}/statements
  • 请求类型:POST

    2.6.1 请求体

    | Name | Description | Type | | :—- | :—- | :—- | | code | The code to execute | string | | kind | The kind of code to execute | code kind |

2.6.2 响应体

Name Description Type
id The statement id integer
code The execution code string
state The execution state statement state
output The execution output statement output
progress The execution progress double
started The start time of statement code long
completed The complete time of statement code long