Skip to content

Commit 0bd0578

Browse files
Merge pull request #89633 from dagiro/cats163
cats163
2 parents dd952ce + bc7bcc0 commit 0bd0578

File tree

1 file changed

+36
-30
lines changed

1 file changed

+36
-30
lines changed

articles/hdinsight/spark/apache-spark-intellij-tool-debug-remotely-through-ssh.md

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
title: 'Azure Toolkit for IntelliJ: Debug Spark applications remotely through SSH '
33
description: Step-by-step guidance on how to use HDInsight Tools in Azure Toolkit for IntelliJ to debug applications remotely on HDInsight clusters through SSH
44
keywords: debug remotely intellij, remote debugging intellij, ssh, intellij, hdinsight, debug intellij, debugging
5-
ms.service: hdinsight
65
author: hrasheed-msft
76
ms.author: hrasheed
87
ms.reviewer: jasonh
8+
ms.service: hdinsight
99
ms.custom: hdinsightactive,hdiseo17may2017
1010
ms.topic: conceptual
1111
ms.date: 11/25/2017
@@ -41,17 +41,17 @@ This article provides step-by-step guidance on how to use HDInsight Tools in [Az
4141

4242
c. In the **Build tool** list, select either of the following, according to your need:
4343

44-
- **Maven**, for Scala project-creation wizard support
44+
- **Maven**, for Scala project-creation wizard support.
4545

46-
- **SBT**, for managing the dependencies and building for the Scala project
46+
- **SBT**, for managing the dependencies and building for the Scala project.
4747

48-
![Create a debug project](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-create-projectfor-debug-remotely.png)
48+
![Intellij Create New Project Spark](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-create-projectfor-debug-remotely.png)
49+
50+
d. Select **Next**.
4951

50-
d. Select **Next**.
51-
5252
1. In the next **New Project** window, do the following:
5353

54-
![Select the Spark SDK](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-new-project.png)
54+
![Intellij New Project select Spark version](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-new-project.png)
5555

5656
a. Enter a project name and project location.
5757

@@ -64,90 +64,96 @@ This article provides step-by-step guidance on how to use HDInsight Tools in [Az
6464
1. Select **src** > **main** > **scala** to open your code in the project. This example uses the **SparkCore_wasbloTest** script.
6565

6666
### Prerequisite for Windows
67-
While you're running the local Spark Scala application on a Windows computer, you might get an exception, as explained in [SPARK-2356](https://issues.apache.org/jira/browse/SPARK-2356). The exception occurs because WinUtils.exe is missing on Windows.
67+
While you're running the local Spark Scala application on a Windows computer, you might get an exception, as explained in [SPARK-2356](https://issues.apache.org/jira/browse/SPARK-2356). The exception occurs because WinUtils.exe is missing on Windows.
6868

6969
To resolve this error, [download the executable](https://public-repo-1.hortonworks.com/hdp-win-alpha/winutils.exe) to a location such as **C:\WinUtils\bin**. Then, add the environment variable **HADOOP_HOME**, and set the value of the variable to **C:\WinUtils**.
7070

7171
### Scenario 2: Perform local run
72+
7273
1. Open the **SparkCore_wasbloTest** script, right-click the script editor, and then select the option **Run '[Spark Job]XXX'** to perform local run.
74+
7375
1. Once local run completed, you can see the output file save to your current project explorer **data** > **__default__**.
7476

75-
![Local run result](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/spark-local-run-result.png)
77+
![Intellij Project local run result](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/spark-local-run-result.png)
78+
7679
1. Our tools have set the default local run configuration automatically when you perform the local run and local debug. Open the configuration **[Spark on HDInsight] XXX** on the upper right corner, you can see the **[Spark on HDInsight]XXX** already created under **Apache Spark on HDInsight**. Switch to **Locally Run** tab.
7780

78-
![Local run configuration](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/local-run-configuration.png)
81+
![Intellij Run debug configurations local run](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/local-run-configuration.png)
82+
7983
- [Environment variables](#prerequisite-for-windows): If you already set the system environment variable **HADOOP_HOME** to **C:\WinUtils**, it can auto detect that no need to manually add.
8084
- [WinUtils.exe Location](#prerequisite-for-windows): If you have not set the system environment variable, you can find the location by clicking its button.
8185
- Just choose either of two options and, they are not needed on MacOS and Linux.
86+
8287
1. You can also set the configuration manually before performing local run and local debug. In the preceding screenshot, select the plus sign (**+**). Then select the **Apache Spark on HDInsight** option. Enter information for **Name**, **Main class name** to save, then click the local run button.
8388

8489
### Scenario 3: Perform local debugging
8590
1. Open the **SparkCore_wasbloTest** script, set breakpoints.
86-
1. Right-click the script editor, and then select the option **Debug '[Spark on HDInsight]XXX'** to perform local debugging.
87-
88-
91+
1. Right-click the script editor, and then select the option **Debug '[Spark on HDInsight]XXX'** to perform local debugging.
8992

9093
## Learn how to perform remote run and debugging
9194
### Scenario 1: Perform remote run
9295

9396
1. To access the **Edit Configurations** menu, select the icon in the upper-right corner. From this menu, you can create or edit the configurations for remote debugging.
9497

95-
![Edit configurations](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-edit-configurations.png)
98+
![HDI Intellij edit configurations](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-edit-configurations.png)
9699

97100
1. In the **Run/Debug Configurations** dialog box, select the plus sign (**+**). Then select the **Apache Spark on HDInsight** option.
98101

99-
![Add new configuration](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-add-new-Configuration.png)
102+
![Intellij Add new configuration](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-add-new-Configuration.png)
103+
100104
1. Switch to **Remotely Run in Cluster** tab. Enter information for **Name**, **Spark cluster**, and **Main class name**. Then Click **Advanced configuration (Remote Debugging)**. Our tools support debug with **Executors**. The **numExectors**, the default value is 5. You'd better not set higher than 3.
101105

102-
![Run debug configurations](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-run-debug-configurations.png)
106+
![Intellij Run debug configurations](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-run-debug-configurations.png)
103107

104108
1. In the **Advanced Configuration (Remote Debugging)** part, select **Enable Spark remote debug**. Enter the SSH username, and then enter a password or use a private key file. If you want to perform remote debug, you need to set it. There is no need to set it if you just want to use remote run.
105109

106-
![Enable Spark remote debug](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-enable-spark-remote-debug.png)
110+
![Intellij Advanced Configuration enable spark remote debug](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-enable-spark-remote-debug.png)
107111

108-
1. The configuration is now saved with the name you provided. To view the configuration details, select the configuration name. To make changes, select **Edit Configurations**.
112+
1. The configuration is now saved with the name you provided. To view the configuration details, select the configuration name. To make changes, select **Edit Configurations**.
109113

110114
1. After you complete the configurations settings, you can run the project against the remote cluster or perform remote debugging.
111-
112-
![Remote run button](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/perform-remote-run-button.png)
115+
116+
![Intellij Debug Remote Spark Job Remote run button](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/perform-remote-run-button.png)
113117

114118
1. Click the **Disconnect** button that the submission logs not appear in the left panel. However, it is still running on the backend.
115119

116-
![Remote run result](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/spark-remote-run-result.png)
120+
![Intellij Debug Remote Spark Job Remote run result](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/spark-remote-run-result.png)
117121

118122
### Scenario 2: Perform remote debugging
119123
1. Set up breaking points, and then Click the **Remote debug** icon. The difference with remote submission is that SSH username/password need to be configured.
120124

121-
![Select the debug icon](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debug-icon.png)
125+
![Intellij Debug Remote Spark Job debug icon](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debug-icon.png)
122126

123127
1. When the program execution reaches the breaking point, you see a **Driver** tab and two **Executor** tabs in the **Debugger** pane. Select the **Resume Program** icon to continue running the code, which then reaches the next breakpoint. You need to switch to the correct **Executor** tab to find the target executor to debug. You can view the execution logs on the corresponding **Console** tab.
124128

125-
![Debugging tab](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debugger-tab.png)
129+
![Intellij Debug Remote Spark Job Debugging tab](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debugger-tab.png)
126130

127131
### Scenario 3: Perform remote debugging and bug fixing
132+
128133
1. Set up two breaking points, and then select the **Debug** icon to start the remote debugging process.
129134

130-
1. The code stops at the first breaking point, and the parameter and variable information are shown in the **Variables** pane.
135+
1. The code stops at the first breaking point, and the parameter and variable information are shown in the **Variables** pane.
131136

132137
1. Select the **Resume Program** icon to continue. The code stops at the second point. The exception is caught as expected.
133138

134-
![Throw error](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-throw-error.png)
139+
![Intellij Debug Remote Spark Job throw error](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-throw-error.png)
135140

136141
1. Select the **Resume Program** icon again. The **HDInsight Spark Submission** window displays a "job run failed" error.
137142

138-
![Error submission](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-error-submission.png)
143+
![Intellij Debug Remote Spark Job Error submission](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-error-submission.png)
139144

140-
1. To dynamically update the variable value by using the IntelliJ debugging capability, select **Debug** again. The **Variables** pane appears again.
145+
1. To dynamically update the variable value by using the IntelliJ debugging capability, select **Debug** again. The **Variables** pane appears again.
141146

142-
1. Right-click the target on the **Debug** tab, and then select **Set Value**. Next, enter a new value for the variable. Then select **Enter** to save the value.
147+
1. Right-click the target on the **Debug** tab, and then select **Set Value**. Next, enter a new value for the variable. Then select **Enter** to save the value.
143148

144-
![Set value](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-set-value1.png)
149+
![Intellij Debug Remote Spark Job set value](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-set-value1.png)
145150

146151
1. Select the **Resume Program** icon to continue to run the program. This time, no exception is caught. You can see that the project runs successfully without any exceptions.
147152

148-
![Debug without exception](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debug-without-exception.png)
153+
![Intellij Debug Remote Spark Job without exception](./media/apache-spark-intellij-tool-debug-remotely-through-ssh/hdinsight-debug-without-exception.png)
149154

150155
## <a name="seealso"></a>Next steps
156+
151157
* [Overview: Apache Spark on Azure HDInsight](apache-spark-overview.md)
152158

153159
### Demo

0 commit comments

Comments
 (0)