

# job\_runs

The `job_runs` system table contains one row for each AWS Glue job run in your account and Region, for jobs running AWS Glue version 6.1 or later.

AWS Glue writes a row when a job run reaches a terminal state. AWS Glue does not write data while a job run is in progress.

## Table location
<a name="glue-system-table-job-runs-location"></a>

You query system tables like any other Amazon S3 Tables. The following SQL query returns 10 sample rows from the `job_runs` table:

```sql
SELECT * FROM "s3tablescatalog/aws-glue"."metadata"."job_runs" LIMIT 10
```

## Columns
<a name="glue-system-table-job-runs-columns"></a>

The following table describes the columns in the `job_runs` system table.


| **Column** | **Type** | **Description** | 
| --- | --- | --- | 
| `job_name` | string | The name of the AWS Glue job. | 
| `execution_id` | string | The identifier that AWS Glue assigned to this job run (the job run ID). | 
| `attempt_number` | int | The retry attempt number of this run. | 
| `account_id` | string | The AWS account that owns the job run. | 
| `region_name` | string | The AWS Region where the job run ran. | 
| `platform_enum` | string | The platform that ran the job run. Always `glue`. | 
| `job_arn` | string | The Amazon Resource Name (ARN) of the AWS Glue job. | 
| `job_mode_enum` | string | How the job was authored. Valid values are `SCRIPT`, `VISUAL`, and `NOTEBOOK`. | 
| `engine_enum` | string | The processing engine that ran the job run. Valid values are `SPARK` for `glueetl` and `gluestreaming` jobs, `PYTHON` for `pythonshell` jobs, and `RAY` for `glueray` jobs. | 
| `release_label` | string | The AWS Glue version the run used, for example `glue-6.1`. | 
| `job_driver_type_enum` | string | The kind of AWS Glue job. Valid values are `glueetl`, `gluestreaming`, `pythonshell`, and `glueray`. | 
| `job_config_json` | string | The run's effective arguments as JSON, with secrets redacted. | 
| `worker_count` | int | The number of workers allocated to the run. Null for capacity-based runs. | 
| `worker_type_enum` | string | The worker type the run used, for example `G.1X`. | 
| `execution_class_enum` | string | The execution class the run used. Valid values are `STANDARD` and `FLEX`. | 
| `dpu_seconds` | double | The Data Processing Unit (DPU)-seconds the run consumed. Null when AWS Glue does not report it for the run's version or mode. | 
| `submitter_arn` | string | The ARN of the IAM principal that called `StartJobRun`. Null when the run was not started through `StartJobRun`. | 
| `execution_role_arn` | string | The ARN of the IAM role the run used. | 
| `on_behalf_of_subject` | string | The identifier of the end user the run acted for under trusted identity propagation, as propagated by the identity provider (for example, an email address). Null when trusted identity propagation is off. | 
| `on_behalf_of_issuer` | string | The identity provider that issued the end user's identity. Null when not propagated. | 
| `final_state_enum` | string | The run's final state, as AWS Glue reports it in the console and API. | 
| `error_message` | string | The error message for a run that did not succeed. Null otherwise. | 
| `start_time` | timestamp with time zone | When the run started. | 
| `completion_time` | timestamp with time zone | When the run reached its final state. This is a partition column (by day). | 
| `schema_version` | string | The version identifier for this row's field set. | 
| `ingest_time` | timestamp with time zone | When this row was written to the table. | 

## Example queries
<a name="glue-system-table-job-runs-examples"></a>

The following examples show common queries against the `job_runs` table.

### Failed job runs in the past 24 hours
<a name="glue-system-table-job-runs-examples-failed"></a>

The following SQL query shows failed job runs in the past 24 hours:

```sql
SELECT job_name, execution_id, final_state_enum, error_message, completion_time
FROM "s3tablescatalog/aws-glue"."metadata"."job_runs"
WHERE completion_time >= CURRENT_TIMESTAMP - INTERVAL '1' DAY
    AND final_state_enum IN ('FAILED', 'TIMEOUT', 'ERROR')
ORDER BY completion_time DESC
```

### Top 10 jobs by DPU-seconds in the past 30 days
<a name="glue-system-table-job-runs-examples-dpu"></a>

The following SQL query shows the top 10 jobs by DPU-seconds in the past 30 days:

```sql
SELECT job_name, COUNT(*) AS runs, SUM(dpu_seconds) / 3600.0 AS dpu_hours
FROM "s3tablescatalog/aws-glue"."metadata"."job_runs"
WHERE completion_time >= CURRENT_TIMESTAMP - INTERVAL '30' DAY
GROUP BY job_name
ORDER BY dpu_hours DESC
LIMIT 10
```

### Job runs for one team by name prefix
<a name="glue-system-table-job-runs-examples-team"></a>

The following SQL query shows job runs for one team by job name prefix in the past 7 days. Replace `finance-` with your team's job name prefix:

```sql
SELECT job_name, final_state_enum, COUNT(*) AS runs
FROM "s3tablescatalog/aws-glue"."metadata"."job_runs"
WHERE completion_time >= CURRENT_TIMESTAMP - INTERVAL '7' DAY
    AND job_name LIKE 'finance-%'
GROUP BY job_name, final_state_enum
```

### Who started job runs, and on which role
<a name="glue-system-table-job-runs-examples-who"></a>

The following SQL query shows who started job runs and which role they used in the past 30 days:

```sql
SELECT submitter_arn, execution_role_arn, COUNT(*) AS runs, SUM(dpu_seconds) AS dpu_seconds
FROM "s3tablescatalog/aws-glue"."metadata"."job_runs"
WHERE completion_time >= CURRENT_TIMESTAMP - INTERVAL '30' DAY
GROUP BY submitter_arn, execution_role_arn
ORDER BY dpu_seconds DESC
```