Skip to content

Commit f318050

Browse files
committed
changes for socket client
2 parents e21ed06 + 6c70518 commit f318050

3 files changed

Lines changed: 479 additions & 0 deletions

File tree

src/client/jedi/commands.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use strict";
2+
3+
export class Commands {
4+
public static ExitCommandBytes: Buffer = new Buffer("exit");
5+
public static PingBytes: Buffer = new Buffer("ping");
6+
public static ListKernelSpecsBytes: Buffer = new Buffer("lsks");
7+
public static StartKernelBytes: Buffer = new Buffer("strk");
8+
public static ShutdownKernelBytes: Buffer = new Buffer("stpk");
9+
public static RestartKernelBytes: Buffer = new Buffer("rstk");
10+
public static InterruptKernelBytes: Buffer = new Buffer("itpk");
11+
public static RunCodeBytes: Buffer = new Buffer("run ");
12+
}
13+
14+
export namespace ResponseCommands {
15+
export const Pong = 'PONG';
16+
export const ListKernelsSpecs = 'LSKS';
17+
export const Error = 'EROR';
18+
export const KernelStarted = 'STRK';
19+
export const KernelShutdown = 'STPK';
20+
export const KernelRestarted = 'RSTK';
21+
export const KernelInterrupted = 'ITPK';
22+
export const RunCode = 'RUN ';
23+
export const ShellResult = 'SHEL';
24+
export const IOPUBMessage = 'IOPB';
25+
}

src/client/jedi/contracts.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"use strict";
2+
3+
import { KernelspecMetadata, Kernelspec, ParsedIOMessage } from '../contracts';
4+
import * as Rx from 'rx';
5+
6+
export interface IJupyterClientAdapter {
7+
getAllKernelSpecs(): Promise<{ [key: string]: Kernelspec }>;
8+
startKernel(kernelSpec: KernelspecMetadata): Promise<[string, any, string]>;
9+
shutdownkernel(kernelUUID: string): Promise<any>;
10+
interruptKernel(kernelUUID: string): Promise<any>;
11+
restartKernel(kernelUUID: string): Promise<any>;
12+
runCode(code: string): Rx.IObservable<ParsedIOMessage>;
13+
on(event: string | symbol, listener: Function): this;
14+
}
15+
16+
export enum KernelCommand {
17+
shutdown, restart, interrupt
18+
}

0 commit comments

Comments
 (0)