Skip to content

Commit 223ce4c

Browse files
committed
More logging for kernelspec problems (#10132)
* More logging for kernelspec problems * Actually capture the exception on the new code * Not actually using output if first exception still there. * Actually only return output on one of the expected calls. * Fix nightly flake
1 parent 05e6637 commit 223ce4c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

src/client/datascience/jupyter/interpreter/jupyterCommand.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ export class InterpreterJupyterKernelSpecCommand extends InterpreterJupyterComma
203203

204204
const defaultAction = () => {
205205
if (exception) {
206+
traceError(`Exception attempting to enumerate kernelspecs: `, exception);
206207
throw exception;
207208
}
208209
return output;
@@ -218,10 +219,12 @@ export class InterpreterJupyterKernelSpecCommand extends InterpreterJupyterComma
218219
try {
219220
if (args.join(' ').toLowerCase() === 'list --json') {
220221
// Try getting kernels using python script, if that fails (even if there's output in stderr) rethrow original exception.
221-
return this.getKernelSpecList(interpreter, options);
222+
output = await this.getKernelSpecList(interpreter, options);
223+
return output;
222224
} else if (args.join(' ').toLowerCase() === '--version') {
223225
// Try getting kernelspec version using python script, if that fails (even if there's output in stderr) rethrow original exception.
224-
return this.getKernelSpecVersion(interpreter, options);
226+
output = await this.getKernelSpecVersion(interpreter, options);
227+
return output;
225228
}
226229
} catch (innerEx) {
227230
traceError('Failed to get a list of the kernelspec using python script', innerEx);

src/client/datascience/jupyter/interpreter/jupyterInterpreterDependencyService.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { CancellationToken } from 'vscode';
88
import { IApplicationShell } from '../../../common/application/types';
99
import { Cancellation, createPromiseFromCancellation, wrapCancellationTokens } from '../../../common/cancellation';
1010
import { ProductNames } from '../../../common/installer/productNames';
11+
import { traceError } from '../../../common/logger';
1112
import { IInstaller, InstallerResponse, Product } from '../../../common/types';
1213
import { Common, DataScience } from '../../../common/utils/localize';
1314
import { noop } from '../../../common/utils/misc';
@@ -275,7 +276,8 @@ export class JupyterInterpreterDependencyService {
275276
return command
276277
.exec(['--version'], { throwOnStdErr: true })
277278
.then(() => true)
278-
.catch(() => {
279+
.catch(e => {
280+
traceError(`Kernel spec not found: `, e);
279281
sendTelemetryEvent(Telemetry.KernelSpecNotFound);
280282
return false;
281283
});

src/test/datascience/variableexplorer.functional.test.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,16 @@ myDict = {'a': 1}`;
184184
{ name: 'myDict', value: "{'a': 1}", supportsDataExplorer: true, type: 'dict', size: 54, shape: '', count: 0, truncated: false },
185185
{ name: 'myList', value: '[1, 2, 3]', supportsDataExplorer: true, type: 'list', size: 54, shape: '', count: 0, truncated: false },
186186
// Set can vary between python versions, so just don't both to check the value, just see that we got it
187-
{ name: 'mySet', value: undefined, supportsDataExplorer: true, type: 'set', size: 54, shape: '', count: 0, truncated: false }
187+
{
188+
name: 'mySet',
189+
value: undefined,
190+
supportsDataExplorer: false,
191+
type: 'set',
192+
size: 54,
193+
shape: '',
194+
count: 0,
195+
truncated: false
196+
}
188197
];
189198
verifyVariables(wrapper, targetVariables);
190199
},

0 commit comments

Comments
 (0)