Troubleshoot a Spark workload
Analyzes Spark workload failures and generates code fix recommendations.
/plugin marketplace add aws-samples/aws-emr-utilities/plugin install spark-analysis@aws-emr-utilities<execution-id> <execution-type-id> --profile <name> --region <region> [--platform <type>]Use the Spark workload analysis script to analyze the specified workload. The script uses a Strands Agent with MCP tools to perform deep analysis and generate code fix recommendations.
Parse the user's input to extract:
jr_abc123)s-1234567890ABC)j-ABC123)glue, emr_serverless, or emr_ec2
IMPORTANT: Before running the analysis script, you MUST use the AskUserQuestion tool to gather any missing required information. Do NOT proceed with default values without confirming with the user.
If --region is NOT provided in the arguments:
If --profile is NOT provided in the arguments:
If --platform is not specified, determine it automatically:
jr_ → gluej- → emr_ec2app pattern → emr_serverlessUse the Glob tool to find the analysis script:
Pattern: **/spark-troubleshooting-claude-plugin/scripts/troubleshoot_spark_workload.py
The script is located in the scripts/ directory of the spark-troubleshooting-claude-plugin folder within the workspace.
Once you have the full script path, run:
uv run <full-script-path> \
--execution-id <execution-id> \
--execution-type-id <execution-type-id> \
--platform-type <platform-type> \
--profile <profile> \
--region <region>
IMPORTANT:
/Volumes/workplace/.../scripts/troubleshoot_spark_workload.py)$CLAUDE_PLUGIN_ROOT - this environment variable is not reliably set--profile and --region with the values gathered from the userWait for the analysis to complete (may take up to 3 minutes) and present the results.
Present the analysis results with:
If the script returns an error:
/spark-analysis:troubleshoot-spark-workload jr_abc123 my-glue-job --profile prod-account --region us-west-2
/spark-analysis:troubleshoot-spark-workload s-1234567890ABC j-CLUSTERID123 --platform emr_ec2 --profile prod-account --region us-west-2
/spark-analysis:troubleshoot-spark-workload jr_def456 my-job --profile prod-account --region us-west-2