Skip to content

Commit

Permalink
more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Jun 28, 2022
1 parent 07a64d5 commit 9d61910
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/kernels/ipywidgets/baseIPyWidgetScriptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export abstract class BaseIPyWidgetScriptManager implements IIPyWidgetScriptMana
const config = widgetConfigs.reduce((prev, curr) => Object.assign(prev || {}, curr), {});
traceInfoIfCI(`config in getWidgetModuleMappingsImpl = ${JSON.stringify(config)}`);
// Exclude entries that are not required (widgets that we have already bundled with our code).
if (config) {
if (config && Object.keys(config).length) {
delete config['jupyter-js-widgets'];
delete config['@jupyter-widgets/base'];
delete config['@jupyter-widgets/controls'];
Expand Down
16 changes: 14 additions & 2 deletions src/kernels/ipywidgets/remoteIPyWidgetScriptManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as path from '../../platform/vscode-path/path';
import * as dedent from 'dedent';
import { ExtensionMode, Uri } from 'vscode';
import { IExtensionContext, IHttpClient } from '../../platform/common/types';
import { traceError } from '../../platform/logging';
import { traceError, traceInfoIfCI } from '../../platform/logging';
import { executeSilently, isPythonKernelConnection } from '../helpers';
import { IKernel, RemoteKernelConnectionMetadata } from '../types';
import { IIPyWidgetScriptManager } from './types';
Expand Down Expand Up @@ -79,10 +79,16 @@ export class RemoteIPyWidgetScriptManager extends BaseIPyWidgetScriptManager imp
del __vsc_nbextension_Folder
del __vsc_nbextension_widgets`;
if (!this.kernel.session) {
traceInfoIfCI('No Kernel session to get list of widget entry points');
return [];
}
const promises: Promise<nbformat.IOutput[]>[] = [];
promises.push(executeSilently(this.kernel.session, code));
promises.push(
executeSilently(this.kernel.session, code, {
traceErrors: true,
traceErrorsMessage: 'Failed to get widget entry points from remote kernel'
})
);
// A bug was identified in our code that resulted in a deadlock.
// While the widgets are loading this code gets executed, however the kernel execution is blocked waiting for kernel messages to be completed on the UI side
// This is how we synchronize messages between the UI and kernel - i.e. we wait for kernel messages to be handled completely.
Expand All @@ -101,10 +107,16 @@ export class RemoteIPyWidgetScriptManager extends BaseIPyWidgetScriptManager imp

const outputs = await Promise.race(promises);
if (outputs.length === 0) {
traceInfoIfCI('Unable to get widget entry points, no outputs after running the code');
return [];
}
const output = outputs[0] as nbformat.IStream;
if (output.output_type !== 'stream' || output.name !== 'stdout') {
traceInfoIfCI(
`Unable to get widget entry points, no stream & stdout outputs after running the code, but got ${JSON.stringify(
outputs
)}`
);
return [];
}
try {
Expand Down

0 comments on commit 9d61910

Please sign in to comment.