View a markdown version of this page

job_lifecycle - Amazon EMR

job_lifecycle

The job_lifecycle system table contains one row for each job state change across Amazon EMR on EC2, Amazon EMR on EKS, and Amazon EMR Serverless in your account and Region. Each row records a single transition, so you can follow a job through its states from submission to a terminal state. States appear exactly as the service reports them. For one aggregated row for each finished job attempt, see job_runs.

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 job_lifecycle table.

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

Columns

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

Column Type Description
job_key string Unique identifier for a single job, the same on every event belonging to that job.
job_name string Name that you gave the job when you submitted it. Null if you submitted the job without a name.
job_id string Identifier the platform assigned to this job.
account_id string The AWS account that owns the job.
region_name string The AWS Region where the job ran.
attempt_number int Retry attempt number.
event_time timestamp When this lifecycle event occurred.
engine_enum string Processing engine that ran the job. Valid values are spark, hive, trino, custom_jar, and other.
job_driver_type_enum string Kind of workload the job represents. Valid values are spark, pyspark, spark_submit_job, spark_sql_job, hive, hive_cli, stream, trino_session, and custom_jar.
release_label string The Amazon EMR release used by the compute resource. Null for clusters launched with an AMI version rather than a release label.
state_enum string The job's state exactly as the platform reports it, matching what you would see in the service console or API.
platform_enum string Compute platform that ran the job. Valid values are emr_ec2, emr_eks, and emr_serverless.
compute_id string Identifier of the compute resource that ran the job.
submitter_arn string ARN of the IAM user or role that submitted the job. Null if you submitted the job without a runtime role.
creation_time timestamp Time that you created the job.
start_time timestamp When the job began running. Null when the job never started, including a job cancelled while queued.
is_terminal boolean True when the job has finished and no further events will be recorded for it.
state_reason_message string Readable explanation of why the job is in its current state. Null for platforms that don't report this message.
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 job_lifecycle table.

Timeline of one job across attempts

The following SQL query traces one job through its state changes across attempts. Replace the following value.

  • job-key is the key of the job you want to trace.

SELECT event_time, attempt_number, state_enum, is_terminal, state_reason_message FROM "s3tablescatalog/aws-emr"."metadata"."job_lifecycle" WHERE event_time >= current_timestamp - INTERVAL '7' DAY AND job_key = 'job-key' ORDER BY event_time

Jobs whose latest recorded state is not terminal

The following SQL query returns jobs whose most recent recorded state isn't terminal.

WITH latest AS ( SELECT *, ROW_NUMBER() OVER ( PARTITION BY job_key, attempt_number ORDER BY event_time DESC, ingest_time DESC) AS rn FROM "s3tablescatalog/aws-emr"."metadata"."job_lifecycle" WHERE event_time >= current_timestamp - INTERVAL '2' DAY) SELECT platform_enum, compute_id, job_id, job_name, state_enum, event_time FROM latest WHERE rn = 1 AND NOT is_terminal

This query reflects the latest delivered transition, which can lag by the delivery delay. For live status, use the platform console or the DescribeStep, DescribeJobRun, or GetJobRun operations.