glue-job-troubleshooter
Diagnoses AWS Glue ETL job failures through a seven-category diagnostic tree — Python script exceptions (KeyError, AttributeError, import errors), job timeout (insufficient DPU, long-running transforms, skewed reads), JDBC connection errors (VPC security group, subnet, network ACL, self-referencing rule), job bookmark errors (not advancing, reprocessing data, partition format change), Data Catalog errors (table not found, partition not found, stale crawler), Spark errors (executor OOM, stage failures, data skew, GC overhead), and DynamicFrame errors (schema mismatch, type coercion). Reads get-job-run ErrorMessage and ExecutionTime, CloudWatch logs (/aws-glue/jobs/), Spark UI exported to S3, and get-job-bookmark state. Emits ROOT_CAUSE_FOUND with the failing probe and positive evidence, NEED_MORE_INFO when a probe requires operator input, or ESCALATE for AWS-side incidents. Use when a Glue job shows FAILED, TIMEOUT, RUNNING past expected duration, or is reprocessing data the bookmark should have skipped.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-24
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- glue-job-troubleshooter
- license
- Apache-2.0
- metadata
- { "tags": "glue, analytics, etl, troubleshoot, spark, data-catalog", "phase": "2", "author": "Jacky Chan — AWS Community Builder", "domain": "aws-cloudops", "family": "Analytics", "version": "0.1.0", "keywords": "AWS Glue, Glue ETL, Glue job failure, Glue job timeout, Glue bookmark, DynamicFrame, Spark OOM, data skew, JDBC connection, Glue Data Catalog, Glue version 4.0, DPU capacity, Glue Spark UI, CloudWatch logs, Glue connection, crawler, partition pruning, Python shell job, Ray job, Analytics", "task_type": "troubleshoot", "complexity": "high", "entry_point": "false", "skill_class": "capability", "when_to_use": "Diagnosing an AWS Glue ETL job that FAILED, hit TIMEOUT, is RUNNING past its expected duration, is reprocessing data the bookmark should have skipped, is throwing Python exceptions, is unable to reach a JDBC source in a VPC, is reporting Spark executor OOM or stage failures, or is surfacing Data Catalog \"table not found\" / \"partition not found\" errors.", "requires_llm": "true", "verdict_shape": "ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE", "when_not_to_use": "Glue Data Quality rule evaluation (use the Data Quality service directly), AWS Lake Formation permission errors (use Lake Formation admin tooling), Glue Studio notebook interactive development (not a job-run diagnosis), or Glue crawler schema inference tuning (use a crawler classification specialist). This skill diagnoses job-run failures, not data quality or governance.", "lifecycle_status": "active", "invocation_schema": "Input: either (a) a Glue JobName + RunId + live-account context, (b) a pasted ErrorMessage from glue:get-job-run, OR (c) a CloudWatch Logs / Spark stage failure excerpt. Output: a deterministic TARGET / VERDICT / REASON / CATEGORY / EVIDENCE / REMEDIATION block per job run, where VERDICT ∈ {ROOT_CAUSE_FOUND, NEED_MORE_INFO, ESCALATE} and CATEGORY ∈ {SCRIPT_EXCEPTION, TIMEOUT_DPU, TIMEOUT_SKEW, JDBC_VPC, JDBC_CRED, BOOKMARK_STALL, CATALOG_MISSING, CATALOG_PARTITION, SPARK_OOM, SPARK_STAGE, DYNAMICFRAME_SCHEMA, DYNAMICFRAME_TYPE, UNKNOWN}.", "supports_pipeline": "true", "invocation_example": "# Minimal valid input (offline classification from ErrorMessage):\nJobName: nightly-sales-aggregation\nRunId: jr_abc123def456\nState: FAILED\nErrorMessage: \"Traceback (most recent call last):\n File \\\"tmp/script.py\\\", line 47, in <module>\n df = df.withColumn('revenue', col('price') * col('qty'))\n ... AttributeError: 'NoneType' object has no attribute '_jvc'\"\nExecutionTime: 42\nGlueVersion: 4.0\nWorkerType: G.1X\nNumberOfWorkers: 5\nEmit the standard diagnostic block (TARGET, VERDICT, REASON,\nCATEGORY, EVIDENCE, REMEDIATION).", "activation_triggers": "Glue job failed, Glue job timeout, Glue bookmark not advancing, Glue reprocessing data, Glue JDBC connection error, Glue Spark OOM, Glue stage failure, Glue table not found, Glue partition not found, DynamicFrame schema mismatch, Glue DPU capacity, Glue job RUNNING too long, Glue version 2.0 vs 3.0 vs 4.0, diagnose Glue ETL failure, Spark UI Glue" }
- description
- Diagnoses AWS Glue ETL job failures through a seven-category diagnostic tree — Python script exceptions (KeyError, AttributeError, import errors), job timeout (insufficient DPU, long-running transforms, skewed reads), JDBC connection errors (VPC security group, subnet, network ACL, self-referencing rule), job bookmark errors (not advancing, reprocessing data, partition format change), Data Catalog errors (table not found, partition not found, stale crawler), Spark errors (executor OOM, stage failures, data skew, GC overhead), and DynamicFrame errors (schema mismatch, type coercion). Reads get-job-run ErrorMessage and ExecutionTime, CloudWatch logs (/aws-glue/jobs/), Spark UI exported to S3, and get-job-bookmark state. Emits ROOT_CAUSE_FOUND with the failing probe and positive evidence, NEED_MORE_INFO when a probe requires operator input, or ESCALATE for AWS-side incidents. Use when a Glue job shows FAILED, TIMEOUT, RUNNING past expected duration, or is reprocessing data the bookmark should have skipped.
- compatibility
- Agent runtime that reads SKILL.md (Claude Code, Cursor, Windsurf, Codex, Gemini). Offline classification works from a pasted job-run ErrorMessage, CloudWatch Logs excerpt, or Spark stage failure summary. Live-account diagnosis uses aws glue get-job-run, get-job-runs, get-job-bookmark, get-connection, aws logs filter-log-events on /aws-glue/jobs, aws s3 cp for Spark UI event logs, aws glue get-table and get-partitions for catalog validation, and aws ec2 describe-security-groups /...
02 资源文件 19
- 参考文档eval/test-cases.yaml8.4 KB
- 参考文档evals/baselines/bookmark-not-advancing-layout-drift.md665 B
- 参考文档evals/baselines/catalog-table-not-found.md761 B
- 参考文档evals/baselines/jdbc-connection-missing-security-group.md715 B
- 参考文档evals/baselines/python-exception-attributeerror-script.md693 B
- 参考文档evals/baselines/spark-oom-stage-skew.md703 B
- 参考文档evals/eval_config.yaml1.8 KB
- 参考文档evals/evals.json4.4 KB
- 参考文档evals/prompts/bookmark-not-advancing-layout-drift.md863 B
- 参考文档evals/prompts/catalog-table-not-found.md936 B
- 参考文档evals/prompts/jdbc-connection-missing-security-group.md1014 B
- 参考文档evals/prompts/python-exception-attributeerror-script.md884 B
- 参考文档evals/prompts/spark-oom-stage-skew.md752 B
- 参考文档examples/README.md7.5 KB
- 参考文档references/advanced-patterns.md4.5 KB
- 参考文档references/diagnostic-commands.md2.1 KB
- 参考文档references/glue-runtime-reference.md10.8 KB
- 参考文档references/worked-examples.md4.6 KB
- 参考文档skill.usf.yaml4.5 KB
03 SKILL.md 正文
Glue Job Troubleshooter
What this skill does
Diagnoses AWS Glue ETL job failures by walking a seven-category decision tree that maps the observed symptom (job FAILED, TIMEOUT, RUNNING too long, or reprocessing bookmarked data) to a specific root cause with positive evidence. The skill is verdict-driven: it never emits a fix without first producing the failing probe that confirms the cause.
STRICT output contract
Every invocation MUST emit exactly one diagnostic block per job run in this shape — no prose before, no commentary after:
TARGET: <job-name>/<run-id> or <job-name> if RunId unknown
VERDICT: ROOT_CAUSE_FOUND | NEED_MORE_INFO | ESCALATE
REASON: <1-2 sentences naming the failing category and the probe>
CATEGORY: SCRIPT_EXCEPTION | TIMEOUT_DPU | TIMEOUT_SKEW |
JDBC_VPC | JDBC_CRED | BOOKMARK_STALL | CATALOG_MISSING |
CATALOG_PARTITION | SPARK_OOM | SPARK_STAGE |
DYNAMICFRAME_SCHEMA | DYNAMICFRAME_TYPE | UNKNOWN
EVIDENCE:
- <observed symptom — ErrorMessage, state, duration>
- <failing probe — command and output that confirms the cause>
- <passing probes — categories ruled out>
REMEDIATION:
1. <specific action with CLI command>
2. <verification command after the fix>
A block missing VERDICT, CATEGORY, EVIDENCE, or REMEDIATION is a contract violation — re-emit the full block. NEVER combine multiple job runs in a single block; one run per block.
Quick start
- Start with
get-job-run— not the script. ErrorMessage and ExecutionTime narrow the category before you open the script. A short ExecutionTime with a Python traceback points to SCRIPT_EXCEPTION; a timeout at the configured Timeout minutes points to TIMEOUT_*; a long run with no traceback points to skew or DPU starvation. - Bookmark problems hide in
get-job-bookmark. If a job that should skip old data is reprocessing it, the bookmark is stale, missing, or tracking the wrong partition column. The bookmark is per-job. - JDBC failures are almost never Glue. They are VPC security group, subnet route table, or self-referencing rule problems on the Glue connection. Verify connection SG, database SG, and route table before assuming a Glue bug.
- Spark OOM is a skew or shuffling problem, not a memory problem.
Throwing more DPU at an OOM rarely fixes it; the fix is salting the
skewed key, repartitioning before a wide transform, or moving to
G.2Xonly if the executor genuinely needs more heap. - Glue version matters. 2.0 = Spark 2.4 / Python 3.7; 3.0 = Spark 3.1 / Python 3.9; 4.0 = Spark 3.3 / Python 3.10. A script that ran on 2.0 may fail on 4.0 because of Spark SQL strictness, PyArrow incompatibility, or removed DataFrameWriter options.
Mindset
A Glue job run is a Spark application wrapped in an AWS-managed control
plane. Most failures are not Glue bugs — they are configuration drift
between the job, the Data Catalog, the VPC, and the source data. The
skill's job is to find the layer that drifted. The fastest path to root
cause is to read get-job-run first, then narrow to the category that
matches the symptom signature, then run the category-specific probe
before opening the script.
Quick reference — verdict thresholds
| Observation | Verdict | Category |
|---|---|---|
ErrorMessage contains Python Traceback |
ROOT_CAUSE_FOUND | SCRIPT_EXCEPTION |
ExecutionTime == Timeout, no traceback |
ROOT_CAUSE_FOUND | TIMEOUT_DPU / TIMEOUT_SKEW |
| Spark UI: one task reads 100x median bytes | ROOT_CAUSE_FOUND | TIMEOUT_SKEW |
ErrorMessage mentions Connection refused / VPC |
ROOT_CAUSE_FOUND | JDBC_VPC |
ErrorMessage mentions Access denied / auth failed |
ROOT_CAUSE_FOUND | JDBC_CRED |
Source grew but get-job-bookmark shows old marker |
ROOT_CAUSE_FOUND | BOOKMARK_STALL |
EntityNotFoundException: Table not found |
ROOT_CAUSE_FOUND | CATALOG_MISSING |
ErrorMessage mentions partition + not found |
ROOT_CAUSE_FOUND | CATALOG_PARTITION |
Spark UI executor: OOM / Container killed by YARN |
ROOT_CAUSE_FOUND | SPARK_OOM |
| Spark UI: failed stage with one slow task | ROOT_CAUSE_FOUND | SPARK_STAGE / TIMEOUT_SKEW |
ResolveChoice / apply_mapping schema errors |
ROOT_CAUSE_FOUND | DYNAMICFRAME_SCHEMA |
ExecutionTime long but job succeeded, no probe run |
NEED_MORE_INFO | (need Spark UI) |
| AWS Health event for Glue in region | ESCALATE | (AWS-side incident) |
Pre-flight: data gate (run before any diagnosis)
Glue diagnosis requires three data sources: job-run metadata (state, ErrorMessage, ExecutionTime, configuration), CloudWatch Logs excerpt for the failing run, and — for performance/skew diagnoses — the Spark UI event log exported to S3.
Data-gate CLI (get-job-run, get-job-runs, CloudWatch Logs, bookmark state, Spark UI event log) moved to references/diagnostic-commands.md — load on demand.
Data-quality short-circuits
| Condition | Effect on diagnosis |
|---|---|
get-job-run returns RunId not found |
Job never started under that id; verify via get-job-runs. |
ErrorMessage is No ErrorReason but State=FAILED |
Need CloudWatch Logs to surface the exception. Emit NEED_MORE_INFO with the log-fetch step. |
| CloudWatch log group missing | Logging disabled (--enable-continuous-cloudwatch-log false). Cannot diagnose script-level failures. NEED_MORE_INFO. |
| Spark UI not enabled | Cannot diagnose skew / OOM / stage failures with evidence. NEED_MORE_INFO; recommend --enable-spark-ui and --spark-event-logs-path for future runs. |
get-job-bookmark returns {} |
Bookmark reset or never written. Reprocessing is expected, not a bug. |
Job still RUNNING (not FAILED) |
Diagnose as TIMEOUT_* candidate; do NOT wait for failure if past SLA. |
When ExecutionTime and CloudWatch Logs disagree, trust CloudWatch for
the failure moment and get-job-run for overall duration. The
ExecutionTime counts the control-plane wrapper; the Spark application
may have failed earlier.
Process — Diagnostic decision tree (apply in order)
Step 0: Non-obvious behaviours that change the diagnosis
Step 0 non-obvious behaviours moved to references/advanced-patterns.md — load on demand.
Step 1: Job failure (Python script exceptions)
Signature: ErrorMessage contains Traceback, OR short
ExecutionTime (< 5 min) with State=FAILED.
Failing probe: CloudWatch Logs for the run, filtered to Traceback.
Probe: references/diagnostic-commands.md — Step 1 Traceback log filter.
| Exception in trace | Root cause | Fix |
|---|---|---|
KeyError: '<column>' |
Schema changed since last crawl | Re-crawl; or fix script to tolerate missing column. |
AttributeError: 'NoneType'... |
DataFrame API on None (read returned empty) | Check source S3 path; check partition filter. |
ImportError: No module named '<pkg>' |
External Python package not installed | Add --additional-python-modules (Glue 3.0+). |
AnalysisException: Path does not exist |
S3 source path wrong or empty | Verify s3:// prefix; check source crawler. |
SparkUpgradeException (date parsing) |
Glue version calendar change | --conf spark.sql.legacy.timeParserPolicy=LEGACY. |
Py4JJavaError (wrapping Java) |
Spark internal — read nested cause | Surface nested Java stack; route to Step 6. |
AnalysisException: cannot resolve '<col>' |
Typo or case-sensitivity | Glue 4.0 is case-sensitive; quote column names. |
Passing probes: ExecutionTime < Timeout (not timeout category); no
"Connection refused" (not JDBC); no YARN kill (not OOM).
Step 2: Job timeout (DPU capacity vs long-running transform)
Signature: ExecutionTime == Timeout (±1 min), State=TIMEOUT
or FAILED, no Python traceback.
Failing probe: compare duration to Timeout; pull Spark UI stage
summary for task progression.
jq '{state: .JobRun.State, exec: .JobRun.ExecutionTime,
timeout: .JobRun.Timeout, workers: .JobRun.NumberOfWorkers,
workerType: .JobRun.WorkerType}' job-run.json
| Observation | Root cause | Fix |
|---|---|---|
All tasks slow; NumberOfWorkers < 5 |
DPU-starved | Raise NumberOfWorkers (min 5 for prod ETL). |
| One task running 50x median | Data skew | Salt the skewed key; repartition before wide transform. |
Many tasks stuck on S3 LIST/HEAD |
Too many small files | Compact source; --conf spark.sql.sources.partitionOverwriteMode=dynamic. |
from_catalog slow, no partition pushdown |
Full scan | Pass push_down_predicate='year=2025 and month>=01'. |
| JDBC read, no partition column | Single-threaded JDBC | Add hashfield / hashexpression predicate. |
G.1X, executor heap exhausted |
Heap pressure | Move to G.2X or tune --executor-memory. |
Long-running Python UDF in map/flatMap |
UDF serial bottleneck | Replace with native Spark SQL; broadcast hot data. |
Step 3: JDBC connection errors (VPC, subnet, security group)
Signature: ErrorMessage mentions Connection refused, timed out, VPC configuration, Network interface, ENI, or Could not connect.
Failing probe: verify Glue connection's SG, subnet route table, and the database SG ingress.
Probe: references/diagnostic-commands.md — Step 3 connection SG / subnet / DB SG / route table.
| Missing config | Symptom | Fix |
|---|---|---|
| DB SG lacks ingress from Glue SG on db port (5432/3306) | Connection refused / timed out |
Add inbound: source = Glue SG, port = db port. |
| Glue SG lacks egress to DB | timed out (egress blocked) |
Add outbound: dest = DB SG / CIDR, port = db port. |
| Glue SG lacks self-referencing rule | Intermittent ENI setup fails | Add inbound: source = Glue SG itself, all ports. |
| Subnet route table missing path to DB subnet | timed out |
Add route via TGW / peering / LPG. |
| Glue subnet in different AZ than single-AZ DB | Connection refused |
Use a Glue connection subnet in the DB's AZ. |
| NACL stateful mismatch | Intermittent | NACLs are stateless; check in+out on both subnets. |
| Glue connection points to deleted subnet | ENI provisioning fails | Recreate connection with current subnet. |
Passing probes: run nc -vz <db-host> <port> from a Glue dev
endpoint or EC2 in the same subnet. If nc succeeds, the path is clear
and the issue is authentication — route to Step "JDBC credentials"
(JDBC_CRED) and check the connection's JDBC URL / Secrets Manager
reference.
Step 4: Job bookmark errors (not advancing, reprocessing data)
Signature: source S3 prefix grew, but job reprocesses files already
run. get-job-bookmark shows old or empty marker.
Failing probe:
aws glue get-job-bookmark --job-name nightly-sales-aggregation \
--run-id $RUN_ID --output json
# Inspect: bookmark["JobBookmarks"]["Attempt"],
# "Args" / "Paths" / "partitionKeys" structure
| Bookmark observation | Root cause | Fix |
|---|---|---|
Returns {} |
Bookmark disabled or reset | --job-bookmark-option=enable; or accept reprocess if disabled intentionally. |
partitionKeys present but source path layout changed |
Layout drift | reset-job-bookmark; update partitionKeys in script. |
Attempt count > 1 across runs |
Bookmark write failing | Add glue:UpdateJobBookmark to job role. |
Source has nested partitions not in partitionKeys |
Job reads all sub-partitions | Recrawl; update partitionKeys. |
| Same S3 key reprocessed | File overwritten in place | Glue bookmarks by key — overwritten files always reprocess. Design for appends. |
| KMS-encrypted bookmark fails to read | Role lacks kms:Decrypt on bookmark CMK |
Add KMS decrypt to job role. |
| Glue 2.0 → 3.0+ upgrade, bookmark unreadable | Bookmark schema changed | reset-job-bookmark once post-upgrade; accept one reprocess. |
Passing probes: IAM policy simulator on the job's role for
glue:GetJobBookmark and glue:UpdateJobBookmark. Both MUST be Allow.
Step 5: Data Catalog errors (table / partition not found)
Signature: ErrorMessage mentions EntityNotFoundException,
Table not found, Database not found, or Partition not found.
Failing probe:
aws glue get-table --database-name analytics_prod \
--name sales_raw --output json
aws glue get-partitions --database-name analytics_prod \
--table-name sales_raw --output json
aws glue get-database --name analytics_prod --output json
| Probe result | Root cause | Fix |
|---|---|---|
get-table returns EntityNotFoundException |
Table missing | Re-run crawler; or fix job table name. |
| Table exists but in a different database | Wrong database_name |
Fix script; database name is case-sensitive. |
get-partitions empty |
Crawler never ran on partitions | Re-crawl; or MSCK REPAIR TABLE via Athena. |
| Partition exists but job can't see it | Role lacks glue:GetPartition |
Add glue:GetPartition(s) to job role. |
from_catalog with stale schema |
Catalog schema != S3 data | Re-crawl; or additional_options={"useCatalogSchema": False}. |
| Cross-account catalog access | Role lacks cross-account glue:* |
Add resource-account IAM; use catalog ARN. |
| Lake Formation tag blocks read | LF DESCRIBE missing |
Grant LF DESCRIBE on table to job role. |
Step 6: Spark errors (executor OOM, stage failures, data skew)
Signature: ErrorMessage mentions OutOfMemoryError, Container killed by YARN, Java heap space, GC overhead limit, or stage
failure with Lost task retries.
Failing probe: Spark UI event log — identify the failed stage, task attempt counts, and executor memory metrics.
Probe: references/diagnostic-commands.md — Step 6 Spark UI event log retrieval.
| Spark symptom | Root cause | Fix |
|---|---|---|
| One task reads 100x median bytes | Data skew | Salt the skewed key: df.withColumn("salt", (rand()*10).cast("int")). |
Container killed by YARN...memory limits |
Executor OOM | G.1X → G.2X; or reduce spark.sql.shuffle.partitions default. |
| Stage retries exhausted (4 attempts) | Speculative task failures | Inspect task stack; often OOM or bad input row. |
GC overhead limit exceeded |
Many small objects / UDF churn | Replace PyRDD UDFs with Spark SQL; broadcast small DFs. |
| Long pause before stage starts | Shuffle write bottleneck | Raise spark.sql.shuffle.partitions (200 → 1000+ for TB). |
| Broadcast join OOM | Broadcast hash table too large | Lower spark.sql.autoBroadcastJoinThreshold (default 10 MB). |
Python worker OOM (map/flatMap) |
UDF returning huge objects | Paginate; or applyInPandas with chunking. |
Passing probes: source volume consistent with previous successful runs; if so, skew is the new factor.
Step 7: DynamicFrame errors (schema mismatch, type coercion)
Signature: log mentions ResolveChoice, apply_mapping,
Cannot coerce, or Category="DYNAMICFRAME".
Failing probe:
aws glue get-table --database-name analytics_prod \
--name sales_raw --output json | jq '.Table.StorageDescriptor.Columns'
| Symptom | Root cause | Fix |
|---|---|---|
ResolveChoice throws CONFlict |
Multiple types across partitions | resolve_choice(spec=...) with explicit cast:double before joins. |
apply_mapping fails on missing column |
Schema drifted | Re-crawl; or from_catalog(additional_options={"useCatalogSchema": False}). |
Cannot coerce type string to int |
Mixed types | Cast via to_number in Spark SQL; or DynamicFrame.unnest(). |
DropField errors on nested struct |
Path doesn't match | Inspect actual nested path with printSchema(). |
| Joins produce unexpected nulls | ResolveChoice not called before join |
resolve_choice on both sides before join. |
SparkSession vs GlueContext mismatch |
Glue 4.0 stricter | Use DynamicFrame for catalog reads; convert to DF only when needed. |
Passing probes: script ran unchanged on prior successful runs; if so, the source schema changed (crawler drift).
Step 8: AWS-side incident escalation
If AWS Health shows an active Glue incident in the job's region during the run window, emit ESCALATE with the AWS Health event ARN. Do NOT continue diagnosing script-level causes when the platform is degraded.
aws health describe-events \
--filter eventStatusCodes=OPEN,services=GLUE \
--region us-east-1 --output json
Step 9: Final verdict
- If a single category's failing probe produced positive evidence, emit ROOT_CAUSE_FOUND with that CATEGORY.
- If two categories overlap (e.g., SCRIPT_EXCEPTION with underlying SPARK_OOM), pick the most-specific category (SPARK_OOM) and note the script layer in EVIDENCE.
- If a probe requires operator input (Spark UI not enabled, log group missing), emit NEED_MORE_INFO with the data gap.
- If AWS Health shows an active Glue incident, emit ESCALATE.
Output format — worked examples
Worked example — script exception
TARGET: nightly-sales-aggregation/jr_abc123def456
VERDICT: ROOT_CAUSE_FOUND
REASON: CloudWatch Logs for the run contain an AttributeError on
line 47 of the script — from_catalog returned None when the table
was empty. ExecutionTime was 42s.
CATEGORY: SCRIPT_EXCEPTION
EVIDENCE:
- State=FAILED, ExecutionTime=42, ErrorMessage="No ErrorReason"
- Failing probe:
aws logs filter-log-events --log-group-name /aws-glue/jobs/output
--log-stream-name jr_abc123def456 --filter-pattern "Traceback"
→ AttributeError: 'NoneType' object has no attribute '_jvc'
at line 47 (df.withColumn('revenue', col('price')*col('qty')))
- Passing probes: ExecutionTime=42 < Timeout=60 (not TIMEOUT_*);
no 'Connection refused' (not JDBC_VPC); no YARN kill (not OOM)
REMEDIATION:
1. Re-crawl to confirm data is present in analytics_prod.sales_raw:
aws glue start-crawler --name sales-raw-crawler
2. Add a None guard in the script before line 47:
if df is None or df.rdd.isEmpty():
logger.warning("source empty; skipping")
return
df = df.withColumn("revenue", col("price") * col("qty"))
3. Re-run with bookmark=enable to skip processed partitions:
aws glue start-job-run --job-name nightly-sales-aggregation \
--arguments '{"--job-bookmark-option":"enable"}'
Worked example — JDBC VPC security group
Full JDBC VPC security-group example moved to references/worked-examples.md — load on demand.
Worked example — bookmark stall
Full bookmark-stall example moved to references/worked-examples.md — load on demand.
Worked example — Spark OOM with data skew
Full Spark OOM data-skew example moved to references/worked-examples.md — load on demand.
Worked example — NEED_MORE_INFO
Full NEED_MORE_INFO example moved to references/worked-examples.md — load on demand.
Anti-Patterns — NEVER do these things
- NEVER recommend raising
NumberOfWorkersto fix an OOM without checking the Spark UI skew ratio. DPU-scale rarely fixes data skew; the hot key stays hot. Checkmax/median task bytes; if > 10x, skew is the cause and salting is the fix. - NEVER recommend
reset-job-bookmarkas a first response to reprocessing complaints. Reset discards the marker and forces a one-time full reprocess. First inspect the existing bookmark; reset only when the source layout actually changed. - NEVER assume a Glue JDBC connection failure is a Glue bug. Glue's ENI is the network interface; the database SG ingress is the most common cause. Verify SG, subnet route, and self-referencing rule before opening an AWS Support ticket.
- NEVER upgrade a Glue 2.0 job to 3.0 / 4.0 in production without running it in dev first. The Spark version change (2.4 → 3.1 → 3.3) tightens SQL strictness, changes the date/time calendar, and may break PyArrow/pandas UDFs.
- NEVER diagnose "table not found" without checking the database name
and IAM role permissions.
EntityNotFoundExceptionfires identically when the table doesn't exist AND when the role lacksglue:GetTable. - NEVER cancel a long-running RUNNING job without first checking the Spark UI for genuine stuckness vs normal progress. Cancelling wastes all work and obscures diagnostic data.
- NEVER edit the script and re-run without reproducing the failure in dev. The fix-and-pray loop on prod data masks whether the fix worked.
- NEVER rely solely on
ErrorMessage. Glue's control plane summary is frequentlyNo ErrorReasoneven when the script threw. Always check CloudWatch Logs. - NEVER recommend
G.2Xas a blanket OOM fix.G.2Xdoubles cost per DPU; if the OOM is skew, the fix is salting (free). - NEVER skip the IAM permission check when diagnosing Data Catalog
errors. The role MUST have
glue:GetTable,glue:GetPartition(s),glue:GetDatabase, and (Lake Formation) the LFDESCRIBEgrant.
Quick navigation
| You want to... | Jump to |
|---|---|
| Diagnose a Python traceback | Step 1 — Script exception |
| Diagnose a job that ran to Timeout | Step 2 — Job timeout |
| Diagnose a JDBC connection failure | Step 3 — JDBC connection |
| Diagnose reprocessing data | Step 4 — Bookmark stall |
| Diagnose "table not found" | Step 5 — Data Catalog |
| Diagnose Spark OOM / skew | Step 6 — Spark errors |
| Diagnose ResolveChoice errors | Step 7 — DynamicFrame |
| Handle missing logs / Spark UI | Pre-flight data gate |
| Handle AWS Health incident | Step 8 — Escalate |
| Look up Glue version / worker types | references/glue-runtime-reference.md |
Expert heuristic — the 60-second triage
60-second triage heuristic moved to references/advanced-patterns.md — load on demand.
Pre-flight safety checks (run before any remediation CLI)
- MANDATORY CONFIRMATION GATE. Before any state-changing operation
(
start-job-run,update-job,reset-job-bookmark,start-crawler,authorize-security-group-ingress), emit and await operator approval. Never auto-execute remediation. - Never
reset-job-bookmarkin production without flagging the one-time full reprocess. Confirm the operator understands the cost. - Never
update-jobto changeGlueVersionoutside a dev window. Glue version changes are non-reversible in the job's history. - Never modify a security group without recording the prior rule set:
aws ec2 describe-security-groups --group-ids $SG_ID \ --output json > sg-backup-$(date +%s).json - One category per maintenance window. Script changes, SG changes, and bookmark resets each alter the failure surface; stacking them obscures which fix produced the recovery.
- Bulk operation safety limit. When diagnosing a fleet of failing jobs, slice into batches of at most 3 jobs; emit per-job REMEDIATION and a single CONFIRM per batch; verify each batch before proceeding. Never emit remediation CLI for more than 3 jobs in one output block.
Verdict semantics
| Verdict | When to emit | Position in workflow |
|---|---|---|
ROOT_CAUSE_FOUND |
A failing probe produced positive evidence for one category. | Primary — terminal for actionable findings. |
NEED_MORE_INFO |
A required probe is unavailable (no logs, no Spark UI, run still RUNNING). | Pre-decision — emit with the specific data gap. |
ESCALATE |
AWS Health shows an active Glue incident in the region during the run. | Pre-decision — surface event ARN; do NOT diagnose script-level causes. |
Recent AWS features (2024-2026)
Recent AWS feature notes moved to references/advanced-patterns.md — load on demand.
References (load on demand)
- references/worked-examples.md — secondary worked examples (JDBC VPC SG, bookmark stall, Spark OOM skew, NEED_MORE_INFO).
- references/advanced-patterns.md — Step 0 non-obvious behaviours, the 60-second triage heuristic, recent AWS features.
- references/diagnostic-commands.md — pre-flight data-gate CLI and per-step probe commands (Steps 1, 3, 6).
- references/glue-runtime-reference.md — Glue version / worker type / runtime mapping.
Domain
AWS CloudOps / Analytics — Glue ETL job failure diagnosis.
AWS documentation
- AWS Glue Developer Guide — https://docs.aws.amazon.com/glue/latest/dg/what-is-glue.html
- Glue job bookmarks — https://docs.aws.amazon.com/glue/latest/dg/monitor-continuations.html
- Glue Spark UI — https://docs.aws.amazon.com/glue/latest/dg/monitor-spark-ui.html
- Glue connection (JDBC) properties — https://docs.aws.amazon.com/glue/latest/dg/setup-connection.html
- Glue worker types — https://docs.aws.amazon.com/glue/latest/dg/add-job.html
- Glue Continuous Logging — https://docs.aws.amazon.com/glue/latest/dg/continuous-logging.html
- Glue Data Catalog — https://docs.aws.amazon.com/glue/latest/dg/populate-data-catalog.html
- Glue version upgrades — https://docs.aws.amazon.com/glue/latest/dg/release-upgrade-glue-30-to-40.html
- AWS Health — https://health.aws.amazon.com/health/status
04 同仓库更多 Skills
xray-tracing-deployer
Deploys AWS X-Ray distributed tracing with production-grade configuration: X-Ray daemon deployment (EC2 systemd, ECS sidecar, EKS DaemonSet, Lambda built-in), SDK instrumentation (Java, Python, Node.js, Go, .NET) with annotations and metadata, sampling rules (default reservoir + rate vs custom rules with URL / method / service-name predicates), service map generation, trace query and retrieval, groups and insights, CloudWatch ServiceLens integration, IAM permissions (PutTraceSegments, GetSamplingRules), and latest features (Lambda Powertools tracing, OpenTelemetry / ADOT Collector support, W3C trace context). Emits a READY_TO_DEPLOY checklist with every configuration item verified. Use when enabling X-Ray on a new application, adding tracing to ECS / EKS / Lambda, validating a sampling configuration, or generating daemon deployment CLI and IaC templates. Triggers: X-Ray, distributed tracing, X-Ray daemon, sampling rules, service map, X-Ray SDK, OpenTelemetry, ADOT, Lambda Powertools, CloudWatch ServiceLens.
wellarchitected-workload-auditor
Audits AWS Well-Architected Tool workloads for review staleness, per-pillar high-risk issue counts, milestone tracking gaps, and remediation plan completeness. Emits a deterministic verdict (STALE_REVIEW | HIGH_RISK | CONFIG_GAP | OK) per workload with per-pillar risk breakdown, milestone trend analysis, and specific remediation. Use when reviewing Well-Architected workloads, checking WA review freshness, auditing high-risk issues per pillar, validating milestone coverage, or tracking remediation plans.
wellarchitected-review-operator
Operates AWS Well-Architected Tool reviews end-to-end — creates workloads, runs pillar reviews (operational excellence, security, reliability, performance, cost optimization, sustainability, Prosperity), answers questions with risk-tier rationale, generates reports and improvement plans, creates milestones, and integrates with Trusted Advisor and Well-Architected Labs. Runs deterministic pre-checks (workload existence, lens availability, pillar coverage), emits the exact update-answer / get-consolidated-report CLI behind a CONFIRM gate, and verifies risk-tier transitions. Emits READY | BLOCKED | COMPLETED. Use when creating a workload, answering pillar questions, generating an improvement plan, creating a milestone, or integrating with Trusted Advisor. Triggers: well-architected tool, well architected review, workload review, pillar, operational excellence, security, reliability, performance, cost optimization, sustainability, prosperity, improvement plan, milestone, trusted advisor.
wafv2-web-acl-deployer
Provisions AWS WAFv2 Web ACLs with correct production defaults: scope selection (CLOUDFRONT vs REGIONAL), managed rule groups (AWSManagedRulesCommonRuleSet, SQLiRuleSet, LinuxRuleSet, WindowsRuleSet, IPReputationList, BotControlRuleSet, AmazonIpReputationList, ATP), custom rules (byte match, IP set, regex pattern, geo match, size constraint, rate-based), rule priority ordering, logging destinations (Kinesis Firehose, CloudWatch Logs, S3), resource association (ALB, API Gateway, CloudFront), rate-based rules with aggregate keys (IP, forwarded IP), Challenge and CAPTCHA actions, and account takeover prevention. Emits a READY_TO_DEPLOY checklist. Use when creating a Web ACL, attaching managed rules, configuring rate limiting, enabling WAF logging, associating a Web ACL with an ALB/API Gateway/CloudFront, or configuring CAPTCHA/Challenge actions. Triggers: create WAF Web ACL, WAFv2, managed rule groups, WAF rate limiting, WAF logging, WAF CAPTCHA, WAF Challenge action, bot control, ATP managed rules.
wafv2-web-acl-auditor
Audits AWS WAFv2 Web ACL configurations to determine whether the ACL provides effective protection: default-action posture (Allow vs Block), managed-rule-group coverage gaps, rule effectiveness (BLOCK vs COUNT, shadow/bypass rules, stale exclusions), rate-based rule correctness, logging and visibility configuration, and text-transformation bypass vectors. Emits a deterministic verdict per Web ACL. Use when reviewing a WAFv2 Web ACL for security posture, checking managed-rule coverage, validating rate-limit configuration, auditing WAF logging, or hardening a WAF before production deployment. Triggers: WAF, WAFv2, Web ACL, managed rule group, AWSManagedRules, rate-based rule, CAPTCHA, Challenge, OverrideAction, Count mode, forwarded IP, Bot Control, ATP, text transformation, WAF logging, WAF visibility, OWASP, SQLi, XSS, RFI.
waf-rule-deployer
Provisions AWS WAFv2 rule sets with production defaults: Web ACL creation (CloudFront scope in us-east-1 vs Regional scope), rule groups (managed vs custom) with capacity planning in WCU (Web ACL Capacity Units, 1500 default per ACL), managed rule groups (AWSManagedRulesCommonRuleSet, AWSManagedRulesSQLiRuleSet, AWSManagedRulesAmazonIpReputationList, AWSManagedRulesLinuxRuleSet, AWSManagedRulesWindowsRuleSet, AWSManagedRulesUnixRuleSet), custom rules (byte-match, regex pattern set, geo-match, rate-based), IP set and regex pattern set resources, rule priority ordering (lowest number evaluated first), action types (allow, block, count, CAPTCHA, Challenge), bot control managed rule group, account takeover. Triggers: create WAF rule, WAF managed rule group, WAF custom rule, WAF byte match, WAF geo match, WAF rate based rule, WAF IP set, WAF regex pattern set, WAF WCU budget, WAF CloudFront ACL, WAF logging Kinesis Firehose, WAF bot control, WAF ATP, WAF label matching, WAF Challenge action, WAF CAPTCHA.