@@ -143,7 +143,6 @@ protected void execute(ExecutionEnvironment environment, Callback callback, RunP
143143 ctrlSubject );
144144 final SparkBatchJobDebugProcessHandler driverDebugHandler =
145145 new SparkBatchJobDebugProcessHandler (project , driverDebugProcess , debugEventSubject );
146- driverDebugHandler .getRemoteDebugProcess ().start ();
147146
148147 // Prepare an independent submission console
149148 final ConsoleViewImpl submissionConsole = new ConsoleViewImpl (project , true );
@@ -177,7 +176,10 @@ protected void execute(ExecutionEnvironment environment, Callback callback, RunP
177176 break ;
178177 }
179178 },
180- err -> submissionConsole .print (ExceptionUtils .getRootCauseMessage (err ), ConsoleViewContentType .ERROR_OUTPUT ),
179+ err -> {
180+ submissionConsole .print (ExceptionUtils .getRootCauseMessage (err ), ConsoleViewContentType .ERROR_OUTPUT );
181+ jobDriverEnvReady .setError ("The Spark job remote debug is cancelled due ot " + ExceptionUtils .getRootCauseMessage (err ));
182+ },
181183 () -> {
182184 if (Optional .ofNullable (driverDebugHandler .getUserData (ProcessHandler .TERMINATION_REQUESTED ))
183185 .orElse (false )) {
@@ -279,6 +281,8 @@ protected void execute(ExecutionEnvironment environment, Callback callback, RunP
279281 ExecutionManager .getInstance (project ).startRunProfile (new RunProfileStarter () {
280282 @ Override
281283 public Promise <RunContentDescriptor > executeAsync (@ NotNull RunProfileState state , @ NotNull ExecutionEnvironment env ) throws ExecutionException {
284+ driverDebugHandler .getRemoteDebugProcess ().start ();
285+
282286 return jobDriverEnvReady
283287 .then (forkEnv -> Observable .fromCallable (() -> doExecute (state , forkEnv ))
284288 .subscribeOn (schedulers .dispatchUIThread ()).toBlocking ().singleOrDefault (null ))
0 commit comments