Skip to content

Commit 1dc5195

Browse files
committed
Set pyspark launch path based on OS
1 parent 1db9954 commit 1dc5195

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@
419419
"type": "python",
420420
"request": "launch",
421421
"stopOnEntry": true,
422-
"pythonPath": "${env.SPARK_HOME}/bin/spark-submit",
422+
"pythonPath": "${config.python.pysparkPath}",
423423
"program": "${file}",
424424
"cwd": "${workspaceRoot}",
425425
"debugOptions": [
@@ -567,6 +567,11 @@
567567
"default": "python",
568568
"description": "Path to Python, you can use a custom version of Python by modifying this setting to include the full path."
569569
},
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+
},
570575
"python.jediPath": {
571576
"type": "string",
572577
"default": "",

src/client/providers/updateSparkLibraryProvider.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { Commands } from '../common/constants';
33
import * as vscode from "vscode";
44
import * as path from 'path';
5+
import { IS_WINDOWS } from '../common/utils';
56

67
export function activateUpdateSparkLibraryProvider(): vscode.Disposable {
78
console.log('Register command python.updateSparkLibrary');
@@ -19,4 +20,14 @@ function updateSparkLibrary() {
1920
vscode.window.showErrorMessage(`Failed to update ${extraLibPath}. Error: ${reason.message}`);
2021
console.error(reason);
2122
});
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+
}
2233
}

0 commit comments

Comments
 (0)