Skip to content

Commit

Permalink
Add loging
Browse files Browse the repository at this point in the history
  • Loading branch information
AnastasiaSliusar committed Dec 10, 2024
1 parent b923607 commit f34efbb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ try {
console.log(`Could not fetch xeus/kernels.json: ${err}`);
throw err;
}

console.log('kernel_list', kernel_list);
const plugins = kernel_list.map(
(kernel): JupyterLiteServerPlugin<void | IEmpackEnvMetaFile> => {
return {
Expand Down
8 changes: 7 additions & 1 deletion src/web_worker_kernel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,21 @@ export class WebWorkerKernel implements IKernel {
}

async handleMessage(msg: KernelMessage.IMessage): Promise<void> {
console.log('handleMessage');
this._parent = msg;
this._parentHeader = msg.header;
await this._sendMessageToWorker(msg);
}

private async _sendMessageToWorker(msg: any): Promise<void> {
console.log('_sendMessageToWorker');
if (msg.header.msg_type !== 'input_reply') {
this._executeDelegate = new PromiseDelegate<void>();
}

await this._remoteKernel.processMessage({ msg, parent: this.parent });
if (msg.header.msg_type !== 'input_reply') {
console.log('processMessage');
return await this._executeDelegate.promise;
}
}
Expand Down Expand Up @@ -165,6 +168,7 @@ export class WebWorkerKernel implements IKernel {
* @param msg The worker message to process.
*/
private _processCoincidentWorkerMessage(msg: any): void {
console.log('_processCoincidentWorkerMessage');
if (!msg.data?.header) {
return;
}
Expand All @@ -188,6 +192,7 @@ export class WebWorkerKernel implements IKernel {
* @param msg The worker message to process.
*/
private _processComlinkWorkerMessage(msg: any): void {
console.log('_processComlinkWorkerMessage');
if (!msg.header) {
return;
}
Expand Down Expand Up @@ -255,6 +260,7 @@ export class WebWorkerKernel implements IKernel {
}

private async initFileSystem(options: WebWorkerKernel.IOptions) {
console.log('initFileSystem');
let driveName: string;
let localPath: string;

Expand All @@ -268,7 +274,7 @@ export class WebWorkerKernel implements IKernel {
}

await this._remoteKernel.ready();

console.log('driveName',driveName);
await this._remoteKernel.mount(
driveName,
'/drive',
Expand Down
6 changes: 6 additions & 0 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ export class XeusRemoteKernel {
}

async processMessage(event: any): Promise<void> {
console.log('???processMessage??');
const msg_type = event.msg.header.msg_type;

await globalThis.ready;
Expand All @@ -97,8 +98,10 @@ export class XeusRemoteKernel {
}

if (msg_type === 'input_reply') {
console.log('msg_type',msg_type)
resolveInputReply(event.msg);
} else {
console.log('notify_listener');
rawXServer.notify_listener(event.msg);
}
}
Expand Down Expand Up @@ -156,7 +159,9 @@ export class XeusRemoteKernel {
await waitRunDependency();

rawXKernel = new globalThis.Module.xkernel();
console.log('rawXKernel',rawXKernel);
rawXServer = rawXKernel.get_server();
console.log('rawXServer',rawXServer);
if (!rawXServer) {
console.error('Failed to start kernel!');
}
Expand All @@ -180,6 +185,7 @@ export class XeusRemoteKernel {
* @param callback the callback to register
*/
registerCallback(callback: (msg: any) => void): void {
console.log('registerCallback');
this._sendWorkerMessage = callback;
}

Expand Down

0 comments on commit f34efbb

Please sign in to comment.