Remote Debugging Scala Spark Jobs with VsCode
Asked Answered
S

0

7

I'd like to have the ability to remote debug a Spark job written in Scala running in a docker container with VsCode. This is what I have so far,

  1. VsCode with scala-metals v0.8 installed
  2. This debug launch configuration
  3. I spin up a spark cluster with docker-compose up
  4. I submit a spark job to the cluster started above with the following command
docker exec -it -e SPARK_SUBMIT_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=4000 -w /spark spark-job-starter_master_1 bin/spark-submit --class example.StarterSparkJob /build/example.jar 

After doing so I see the output Listening for transport dt_socket at address: 4000

  1. I attempt to launch the debugger from VsCode, but I get the error.
Debugger failed to attach: handshake failed - received >Content-Length< - expected >JDWP-Handshake<

The full details of the code are here https://github.com/aedenj/spark-job-starter/tree/vscode-debug-setup. Your guidance is appreciated.

Shoop answered 1/2, 2020 at 22:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.