View a markdown version of this page

sessions - Amazon EMR

sessions

The sessions system table contains one aggregated row for each interactive session that reaches a terminal state, such as terminated or failed. It covers Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless in your account and Region. To follow a session through its state changes, see session_lifecycle.

Table location

You query system tables like any other tables in Amazon S3 Tables. The catalog name contains a slash and a hyphen, so you must enclose it in double quotation marks. The following SQL query uses the fully qualified name of the sessions table.

SELECT * FROM "s3tablescatalog/aws-emr"."metadata"."sessions" LIMIT 10

Columns

The following table describes the columns in the sessions system table.

Column Type Description
session_key string Unique identifier for a single session, the same on every event belonging to that session.
account_id string The AWS account that owns the session.
region_name string The AWS Region where the session ran.
platform_enum string Compute platform that ran the session. Valid values are emr_ec2, emr_eks, and emr_serverless.
compute_id string Identifier of the compute resource that ran the session.
compute_arn string ARN of the compute named in compute_id.
session_id string Identifier the platform assigned to this session.
session_arn string Full ARN of the session, as returned by the service API.
session_name string Name that you gave the session when you submitted it. Null if you created the session without a name.
session_type_enum string Kind of session the row describes. Valid values are spark, spark_connect, livy, jupyter_enterprise_gateway, trino, and hive.
engine_enum string Processing engine that ran the session. Valid values are spark, trino, and hive.
release_label string The Amazon EMR release used by the compute resource.
application_conf_json string (JSON) The session's submitted application configuration. Null when the session ran with the compute resource's own configuration.
monitoring_conf_json string (JSON) The session's submitted monitoring configuration. Null when monitoring was not configured for the session.
idle_timeout_minutes long How long the session may stay idle before the platform terminates it.
client_request_token string Idempotency token the caller supplied on the create-session request. Null when the caller supplied no token.
submitter_arn string ARN of the IAM user or role that submitted the session. Null if you created the session without a runtime role.
execution_role_arn string ARN of the IAM role the session used while running. Null when the session ran with the compute resource's own permissions.
final_state_enum string The session's state exactly as the platform reports it, matching what you would see in the service console or API.
state_reason_message string Readable explanation of why the session is in its current state. Null when the platform reports no reason for the final state.
error_category string Broad category of a failure. Null when the session has not failed.
creation_time timestamp Time that you created the session.
start_time timestamp When the session first became available to accept work. Null when the session failed while starting.
termination_request_time timestamp When termination of the session was requested. Null when no termination has been requested.
end_time timestamp When the session ended, whether it terminated normally or failed.
queue_duration long How long the session waited before it started running, in milliseconds. On Amazon EMR Serverless this excludes provisioning time. Null on Amazon EMR on EC2 and Amazon EMR on EKS when the session never started, and on Amazon EMR Serverless when the session was never queued.
execution_duration long How long the session spent running, in milliseconds, excluding time spent waiting. Null when the session never started.
session_duration long Total time from creation to end, in milliseconds.
requested_capacity_json string (JSON) Spark capacity the session requested, projected from its submitted configuration. Null when the session requested no explicit capacity.
vcpu_seconds double Allocated vCPU-seconds. Null for Amazon EMR on EC2 and Amazon EMR on EKS.
memory_gb_seconds double Allocated memory. Null for Amazon EMR on EC2 and Amazon EMR on EKS.
schema_version string Version identifier for this row's field set.
ingest_time timestamp When this row was written to the table.

Example queries

The following examples show common queries against the sessions table.

Sessions by type and final state

The following SQL query groups sessions by platform, type, and final state over the past 7 days, with a count and average duration for each group.

SELECT platform_enum, session_type_enum, final_state_enum, COUNT(*) AS sessions, AVG(session_duration) / 60000.0 AS avg_minutes FROM "s3tablescatalog/aws-emr"."metadata"."sessions" WHERE end_time >= current_timestamp - INTERVAL '7' DAY GROUP BY platform_enum, session_type_enum, final_state_enum

Failed sessions in the past 24 hours, with reason

The following SQL query lists sessions that failed in the past 24 hours and the reason reported for each.

SELECT platform_enum, compute_id, session_id, session_name, final_state_enum, state_reason_message, end_time FROM "s3tablescatalog/aws-emr"."metadata"."sessions" WHERE end_time >= current_timestamp - INTERVAL '1' DAY AND final_state_enum = 'FAILED' ORDER BY end_time DESC