Viewing the Session List (Discarded)

Function

This API is used to view the list of sessions in a cluster in the project.

URI

  • URI format

    GET /v2.0/{project_id}/sessions

  • 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

Table 2 Request parameters

Parameter

Mandatory

Type

Description

cluster_name

No

String

Name of a DLI cluster, which is used to identify a cluster. If this parameter is left unspecified, all sessions in the current project are returned.

from

No

Integer

ID of the start session.

size

No

Integer

Number of obtained sessions.

Response

Table 3 Response parameters

Parameter

Mandatory

Type

Description

from

No

Integer

ID of the start session.

total

No

Integer

Total number of sessions.

sessions

No

Array of objects

Session information. For details about the parameters, see Table 3 in Creating a Session (Discarded).

create_time

No

Long

Time when a session is set up. The timestamp is expressed in milliseconds.

Example

  • Example request
    None
  • Example response (successful request)
    {
        "from": 0,
        "total": 1,
        "sessions": [
            {
                "id": "f28a0d0c-0a37-4bd4-8d1d-1416031e5151",
                "appId": "application_1521602145695_0044",
                "name": null,
                "owner": null,
                "proxyUser": null,
                "state": "idle",
                "kind": "spark",
                "log": [
                    "\t ApplicationMaster RPC port: 0",
                    "\t queue: default",
                    "\t queue user: mls",
                    "\t start time: 1521685195140",
                    "\t final status: UNDEFINED",
                    "\t tracking URL: https://xxx-cluster-75-0008:26001/proxy/application_1521602145695_0044/",
                    "\t user: mls | org.apache.spark.internal.Logging$class.logInfo(Logging.scala:54)",
                    "2018-03-22 10:20:08,305 | INFO  | pool-1-thread-1 | Shutdown hook called | org.apache.spark.internal.Logging$class.logInfo(Logging.scala:54)",
                    "2018-03-22 10:20:08,307 | INFO  | pool-1-thread-1 | Deleting directory /tmp/spark-43a8dcab-e315-4c09-bb2d-7b2dab71d588 | org.apache.spark.internal.Logging$class.logInfo(Logging.scala:54)",
                    "\nYARN Diagnostics: "
                ],
                "sc_type": "A",
                "cluster_name": "test_cluster",
                "create_time": 1531906043036
            }
        ]
    }

    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.