Skip to content

Commit 9d71095

Browse files
shengyfuDonJayamanne
authored andcommitted
No need to define pysparkPath (#540)
* No need to define pysparkPath Based on Don's suggestion, environment specific pythonPath can be defined. * Adding "onCommand:python.updateSparkLibrary"
1 parent 957f1c5 commit 9d71095

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

package.json

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
"onCommand:jupyter.execCurrentCell",
5151
"onCommand:jupyter.execCurrentCellAndAdvance",
5252
"onCommand:python.displayHelp",
53-
"onCommand:python.buildWorkspaceSymbols"
53+
"onCommand:python.buildWorkspaceSymbols",
54+
"onCommand:python.updateSparkLibrary"
5455
],
5556
"main": "./out/client/extension",
5657
"contributes": {
@@ -419,7 +420,15 @@
419420
"type": "python",
420421
"request": "launch",
421422
"stopOnEntry": true,
422-
"pythonPath": "${config.python.pysparkPath}",
423+
"osx": {
424+
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
425+
},
426+
"windows": {
427+
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit.cmd"
428+
},
429+
"linux": {
430+
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit"
431+
},
423432
"program": "${file}",
424433
"cwd": "${workspaceRoot}",
425434
"debugOptions": [
@@ -567,11 +576,6 @@
567576
"default": "python",
568577
"description": "Path to Python, you can use a custom version of Python by modifying this setting to include the full path."
569578
},
570-
"python.pysparkPath": {
571-
"type": "string",
572-
"default": "${env.SPARK_HOME}/bin/spark-submit",
573-
"description": "Path to spark-submit executable, you can use a custom version of Spark by modifying this setting to include the full path."
574-
},
575579
"python.jediPath": {
576580
"type": "string",
577581
"default": "",

src/client/providers/updateSparkLibraryProvider.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ function updateSparkLibrary() {
1919
}, reason => {
2020
vscode.window.showErrorMessage(`Failed to update ${extraLibPath}. Error: ${reason.message}`);
2121
console.error(reason);
22-
});
23-
if (IS_WINDOWS) {
24-
const pysparkPath = 'pysparkPath';
25-
console.log('Overriding ' + pysparkPath);
26-
pythonConfig.update(pysparkPath, path.join(sparkHomePath, 'bin', 'spark-submit.cmd')).then(() => {
27-
//Done
28-
}, reason => {
29-
vscode.window.showErrorMessage(`Failed to update ${pysparkPath}. Error: ${reason.message}`);
30-
console.error(reason);
31-
});
32-
}
22+
});
3323
vscode.window.showInformationMessage(`Make sure you have SPARK_HOME environment variable set to the root path of the local spark installation!`);
3424
}

0 commit comments

Comments
 (0)