Creating a Session (Discarded)
Function
This API is used to create a session in a queue of a project.
URI
- URI format
- Parameter description
Table 1 URI parameter Parameter
Mandatory
Description
project_id
Yes
Project ID, which is used for resource isolation. For details about how to obtain its value, see Obtaining a Project ID.
Request
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| kind | Yes | String | Session type. Only Spark parameters are supported. Spark sessions support Scala jobs. |
| cluster_name | Yes | String | Cluster name. Set this parameter to the cluster name of the DLI cluster that has been created. |
| sc_type | No | String | Compute resource type. Currently, resource types A, B, and C are available. If this parameter is not specified, the minimum configuration (type A) is used. For details about resource types, see Table 5. |
| jars | No | Array of strings | Name of the package that is of the JAR type and has been uploaded to the DLI resource management system. |
| pyFiles | No | Array of strings | Name of the package that is of the PyFile type and has been uploaded to the DLI resource management system. |
| files | No | Array of strings | Name of the package that is of the file type and has been uploaded to the DLI resource management system. |
| modules | No | Array of strings | Name of the dependent system resource module. You can view the module name using the API related to Querying Resource Packages in a Group. |
| resources | No | Array of strings | JSON object list, including the name and type of the JSON package that has been uploaded to the DLI resource management system. |
| groups | No | Array of strings | JSON object list, including the user group resource. For details about the format, see the request example. |
| conf | No | Array of objects | Session configuration items. |
| name | No | String | Session name. The value contains a maximum of 128 characters. |
| heartbeatTimeoutInSecond | No | Integer | Unit for the timeout interval for disabling a session after the session is idle for a long time. The unit is second. |
| driverMemory | No | String | Driver memory of the Spark application, for example, 2 GB and 2048 MB. This configuration item replaces the default parameter in sc_type. The unit must be provided. Otherwise, the startup fails. |
| driverCores | No | Integer | Number of CPU cores of the Spark application driver. This configuration item replaces the default parameter in sc_type. |
| executorMemory | No | String | Executor memory of the Spark application, for example, 2 GB and 2048 MB. This configuration item replaces the default parameter in sc_type. The unit must be provided. Otherwise, the startup fails. |
| executorCores | No | Integer | Number of CPU cores of each Executor in the Spark application. This configuration item replaces the default parameter in sc_type. |
| numExecutors | No | Integer | Number of Executors in a Spark application. This configuration item replaces the default parameter in sc_type. |
Response
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| id | No | String | Session ID, which is a UUID string. |
| appId | No | String | Application ID of a session. |
| name | No | String | Name of a session. |
| owner | No | String | User to which a session belongs. |
| proxyUser | No | String | Proxy user (resource tenant) to which the session belongs. |
| kind | No | String | Session type. Only Spark parameters are supported. |
| log | No | Array of strings | Session log information. |
| state | No | String | Session status. For details, see Table 4. |
| sc_type | No | String | Type of a computing resource. For details about resource types, see Table 5. If the computing resource type is customized, value CUSTOMIZED is returned. |
| cluster_name | No | String | Cluster where the session resides. |
| create_time | No | Long | Time when a session is set up. Unit: ms. |
| update_time | No | Long | Time when a session is updated. Unit: ms. |
Example
- Example request
{ "kind": "spark", "cluster_name": "test_cluster", "sc_type": "A", "jars": [ "group.tesddws/gsjdbc4.jar" ], "resources": [ { "name": "group.tesddws/gsjdbc3.jar", "type": "jar" } ], "groups": [ { "name": "group.tesddws", "resources": [ { "name": "gsjdbc2.jar", "type": "jar" } ] } ] } - Example response (successful request)
{ "id": "f28a0d0c-0a37-4bd4-8d1d-1416031e5151", "appId": null, "name": null, "owner": null, "proxyUser": null, "state": "starting", "kind": "spark", "log": [ "stdout: ", "\nstderr: ", "\nYARN Diagnostics: " ], "sc_type": "A", "cluster_name": "test_cluster", "create_time": 1531906043036, "update_time": 0 }
If an error occurs when this API is invoked, the system does not return the result similar to the preceding example, but returns the error code and error information. For details, see Error Code.
Last Article: Session-related APIs (Discarded)
Next Article: Viewing the Session List (Discarded)
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.