Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remote debug guidance #259

Merged
merged 4 commits into from
Feb 12, 2020
Merged

Conversation

Ngone51
Copy link
Member

@Ngone51 Ngone51 commented Feb 6, 2020

Debug in IntelliJ directly is somehow difficult. For example, it will easily fail on compile if user don't generate source files from SqlBase.g4 manually, which can be confused for beginning user. So, this PR suggests to use remote debug for better experience.

Note I added the guidance after the IDE Setup > IntelliJ section:

r_d_1

r_d_2

@@ -1,4 +1,5 @@
.idea/
target/
.DS_Store
.jekyll-cache/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's generated in jekyll 4.0.0.

@Ngone51
Copy link
Member Author

Ngone51 commented Feb 6, 2020

cc @cloud-fan @HyukjinKwon

```
sbt > set javaOptions in Test += "-agentlib:jdwp=transport=dt_socket,server=n,suspend=n,address=localhost:5005"
```
Set breakpoints and run the test, e.g.:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set breakpoints with IntelliJ and run the test with SBT

@cloud-fan
Copy link
Contributor

thanks for adding! cc @srowen @dongjoon-hyun as well

@@ -435,6 +435,44 @@ Error:(147, 9) value q is not a member of StringContext
q"""
^
```
<h4>Debug Spark with SBT and IntelliJ</h4>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the content below is just about Remote debug unit tests on SBT with IntelliJ.
And of course, we can provide an example with some application here.

runMain exampleFoo

Otherwise, the title is too big here.

@dongjoon-hyun
Copy link
Member

Thank you for pinging me, @cloud-fan .

@@ -435,6 +435,44 @@ Error:(147, 9) value q is not a member of StringContext
q"""
^
```
<h4>Debug Spark with SBT and IntelliJ</h4>
Debug Spark directly inside IntelliJ is somehow difficult. But with remote debug functionality which provided by IntelliJ,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this, Debug Spark directly inside IntelliJ is somehow difficult. because adding a guide is enough.

@Ngone51
Copy link
Member Author

Ngone51 commented Feb 10, 2020

Kindly ping @cloud-fan @dongjoon-hyun @gengliangwang @srowen

Hi all, I've updated according to your comments and update the screenshots. PTAL, thanks!

@@ -435,6 +435,46 @@ Error:(147, 9) value q is not a member of StringContext
q"""
^
```
<h4>Remote Debug Unit Test</h4>
Copy link
Contributor

@cloud-fan cloud-fan Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should make it more general: "Debug Spark Remotely".

Running SBT unit test is just one way to trigger the IntelliJ debugging, users can go other ways like running pyspark tests, as long as they set the java options correctly.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for @cloud-fan 's point.

@@ -435,6 +435,46 @@ Error:(147, 9) value q is not a member of StringContext
q"""
^
```
<h4>Remote Debug Unit Test</h4>
This part will show you how to debug unit test in SBT with the help of remote debug functionality which provided by IntelliJ.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part will show you how to debug Spark remotely with IntelliJ.


<img src="/images/intellij_start_remote_debug.png" style="width: 75%; max-width: 660px;" />

<h5>Debug Test in SBT</h5>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trigger the remote debugging

<img src="/images/intellij_remote_debug_configuration.png" style="width: 75%; max-width: 660px;" />

Normally, the default values should be good enough to use. Make sure that you choose <b>Listen to remote JVM</b>
as <i>Debugger mode</i> and select the right <i>Command line arguments for remote JVM</i> as per your JDK version.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

select the right JDK version to generate proper <i>Command line arguments for remote JVM</i>

<img src="/images/intellij_start_remote_debug.png" style="width: 75%; max-width: 660px;" />

<h5>Debug Test in SBT</h5>

Copy link
Contributor

@cloud-fan cloud-fan Feb 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, there are 2 steps:
1. Set JVM options using the <i>Command line arguments for remote JVM</i> generated in the last step.
2. Start the Spark execution (SBT test, pyspark test, spark-shell, etc.)

The following is an example of how to trigger the remote debugging using SBT unit tests.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, we could move this overall instruction to under the first level tile Debug Spark Remotely?

```
sbt > project core
```
Set javaOptions by copy pasting the following:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy pasting the <i>Command line arguments for remote JVM</i>

debug in IntelliJ as usual.

To exit remote debug mode (so that you don't have to keep starting the remote debugger),
type "session clear" in SBT console - while you're in a project.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove -?

@cloud-fan cloud-fan merged commit 2be8d58 into apache:asf-site Feb 12, 2020
@cloud-fan
Copy link
Contributor

thanks, merged!

@Ngone51
Copy link
Member Author

Ngone51 commented Feb 12, 2020

thanks all!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants