-
Notifications
You must be signed in to change notification settings - Fork 300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add interrupt_mode & getSpec #3951
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
import type { Kernel, KernelMessage, ServerConnection } from '@jupyterlab/services'; | ||
import { Kernel, KernelMessage, ServerConnection } from '@jupyterlab/services'; | ||
// tslint:disable: no-any no-require-imports | ||
import cloneDeep = require('lodash/cloneDeep'); | ||
import * as uuid from 'uuid/v4'; | ||
import { isTestExecution } from '../../common/constants'; | ||
import { traceError } from '../../common/logger'; | ||
import { IDisposable } from '../../common/types'; | ||
import { swallowExceptions } from '../../common/utils/misc'; | ||
import { getNameOfKernelConnection } from '../jupyter/kernels/helpers'; | ||
import { IKernelProcess } from '../kernel-launcher/types'; | ||
import { IWebSocketLike } from '../kernelSocketWrapper'; | ||
import { IKernelSocket } from '../types'; | ||
import { RawSocket } from './rawSocket'; | ||
// tslint:disable: no-any no-require-imports | ||
|
||
export function suppressShutdownErrors(realKernel: any) { | ||
// When running under a test, mark all futures as done so we | ||
|
@@ -111,7 +113,16 @@ export class RawKernel implements Kernel.IKernel { | |
await this.kernelProcess.dispose(); | ||
this.socket.dispose(); | ||
} | ||
public getSpec(): Promise<Kernel.ISpecModel> { | ||
public async getSpec(): Promise<Kernel.ISpecModel> { | ||
if (this.kernelProcess.kernelConnectionMetadata.kind === 'startUsingKernelSpec') { | ||
const kernelSpec = cloneDeep(this.kernelProcess.kernelConnectionMetadata.kernelSpec) as any; | ||
const resources = 'resources' in kernelSpec ? kernelSpec.resources : {}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When using raw kernels, we have the kernel spec, hence return that. |
||
return { | ||
...kernelSpec, | ||
resources | ||
}; | ||
} | ||
traceError('Fetching kernel spec from raw kernel using JLab API'); | ||
return this.realKernel.getSpec(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This API doesn't work, |
||
} | ||
public sendShellMessage<T extends KernelMessage.ShellMessageType>( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the spec. If interrupt_mode = 'message' we should send a message to the kernel to interrupt. Rust is one such kernel.
Not fixing this, just exposing this information so we can use it when fixing other realted issues