mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
SQL Kernel Improvements/Removing Spark Code from Core/Attach to Changes (#3790)
* Scenarios work besides loading saved kernel * Fix compilation issue * Save and load functional * Fix loading kernesl issue when sql kernel is not enabled * Fix language mapping to not be hardcoded any longer * Remove unnecessary comment * PR Comments vol. 1 * Code cleanup, use ConnectionProfile instead of IConnectionProfile when accessing serverName * PR changes vol. 2 * One final comment for PR * Fix linting issue
This commit is contained in:
@@ -20,8 +20,6 @@ let modelId = 0;
|
||||
|
||||
|
||||
export class CellModel implements ICellModel {
|
||||
private static LanguageMapping: Map<string, string>;
|
||||
|
||||
private _cellType: nb.CellType;
|
||||
private _source: string;
|
||||
private _language: string;
|
||||
@@ -37,7 +35,6 @@ export class CellModel implements ICellModel {
|
||||
|
||||
constructor(private factory: IModelFactory, cellData?: nb.ICellContents, private _options?: ICellModelOptions) {
|
||||
this.id = `${modelId++}`;
|
||||
CellModel.CreateLanguageMappings();
|
||||
if (cellData) {
|
||||
// Read in contents if available
|
||||
this.fromJSON(cellData);
|
||||
@@ -238,9 +235,9 @@ export class CellModel implements ICellModel {
|
||||
try {
|
||||
let result = output as nb.IDisplayResult;
|
||||
if (result && result.data && result.data['text/html']) {
|
||||
let nbm = (this as CellModel).options.notebook as NotebookModel;
|
||||
if (nbm.hadoopConnection) {
|
||||
let host = nbm.hadoopConnection.host;
|
||||
let model = (this as CellModel).options.notebook as NotebookModel;
|
||||
if (model.activeConnection) {
|
||||
let host = model.activeConnection.serverName;
|
||||
let html = result.data['text/html'];
|
||||
html = html.replace(/(https?:\/\/mssql-master.*\/proxy)(.*)/g, function (a, b, c) {
|
||||
let ret = '';
|
||||
@@ -321,18 +318,6 @@ export class CellModel implements ICellModel {
|
||||
}
|
||||
}
|
||||
|
||||
private static CreateLanguageMappings(): void {
|
||||
if (CellModel.LanguageMapping) {
|
||||
return;
|
||||
}
|
||||
CellModel.LanguageMapping = new Map<string, string>();
|
||||
CellModel.LanguageMapping['pyspark'] = 'python';
|
||||
CellModel.LanguageMapping['pyspark3'] = 'python';
|
||||
CellModel.LanguageMapping['python'] = 'python';
|
||||
CellModel.LanguageMapping['scala'] = 'scala';
|
||||
CellModel.LanguageMapping['sql'] = 'sql';
|
||||
}
|
||||
|
||||
private get languageInfo(): nb.ILanguageInfo {
|
||||
if (this._options && this._options.notebook && this._options.notebook.languageInfo) {
|
||||
return this._options.notebook.languageInfo;
|
||||
@@ -371,17 +356,15 @@ export class CellModel implements ICellModel {
|
||||
// Otherwise, default to python as the language
|
||||
let languageInfo = this.languageInfo;
|
||||
if (languageInfo) {
|
||||
if (languageInfo.name) {
|
||||
// check the LanguageMapping to determine if a mapping is necessary (example 'pyspark' -> 'python')
|
||||
if (CellModel.LanguageMapping[languageInfo.name]) {
|
||||
this._language = CellModel.LanguageMapping[languageInfo.name];
|
||||
if (languageInfo.codemirror_mode) {
|
||||
let codeMirrorMode: nb.ICodeMirrorMode = <nb.ICodeMirrorMode>(languageInfo.codemirror_mode);
|
||||
if (codeMirrorMode && codeMirrorMode.name) {
|
||||
this._language = codeMirrorMode.name;
|
||||
}
|
||||
else {
|
||||
this._language = languageInfo.name;
|
||||
}
|
||||
}
|
||||
else if (languageInfo.mimetype) {
|
||||
} else if (languageInfo.mimetype) {
|
||||
this._language = languageInfo.mimetype;
|
||||
} else if (languageInfo.name) {
|
||||
this._language = languageInfo.name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,10 +17,8 @@ import { IClientSession, IKernelPreference, IClientSessionOptions } from './mode
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
|
||||
import * as notebookUtils from '../notebookUtils';
|
||||
import * as sparkUtils from '../spark/sparkUtils';
|
||||
import { INotebookManager } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { NotebookConnection } from 'sql/parts/notebook/models/notebookConnection';
|
||||
|
||||
/**
|
||||
* Implementation of a client session. This is a model over session operations,
|
||||
@@ -49,7 +47,6 @@ export class ClientSession implements IClientSession {
|
||||
private _session: nb.ISession;
|
||||
private isServerStarted: boolean;
|
||||
private notebookManager: INotebookManager;
|
||||
private _connection: NotebookConnection;
|
||||
private _kernelConfigActions: ((kernelName: string) => Promise<any>)[] = [];
|
||||
|
||||
constructor(private options: IClientSessionOptions) {
|
||||
@@ -60,10 +57,8 @@ export class ClientSession implements IClientSession {
|
||||
this._kernelChangeCompleted = new Deferred<void>();
|
||||
}
|
||||
|
||||
public async initialize(connection?: NotebookConnection): Promise<void> {
|
||||
public async initialize(): Promise<void> {
|
||||
try {
|
||||
this._kernelConfigActions.push((kernelName: string) => { return this.runTasksBeforeSessionStart(kernelName); });
|
||||
this._connection = connection;
|
||||
this._serverLoadFinished = this.startServer();
|
||||
await this._serverLoadFinished;
|
||||
await this.initializeSession();
|
||||
@@ -114,7 +109,7 @@ export class ClientSession implements IClientSession {
|
||||
} catch (err) {
|
||||
// TODO move registration
|
||||
if (err && err.response && err.response.status === 501) {
|
||||
this.options.notificationService.warn(nls.localize('sparkKernelRequiresConnection', 'Kernel {0} was not found. The default kernel will be used instead.', kernelName));
|
||||
this.options.notificationService.warn(nls.localize('kernelRequiresConnection', 'Kernel {0} was not found. The default kernel will be used instead.', kernelName));
|
||||
session = await this.notebookManager.sessionManager.startNew({
|
||||
path: this.notebookUri.fsPath,
|
||||
kernelName: undefined
|
||||
@@ -256,41 +251,22 @@ export class ClientSession implements IClientSession {
|
||||
return kernel;
|
||||
}
|
||||
|
||||
public async runTasksBeforeSessionStart(kernelName: string): Promise<void> {
|
||||
// TODO we should move all Spark-related code to SparkMagicContext
|
||||
if (this._session && this._connection && this.isSparkKernel(kernelName)) {
|
||||
// TODO may need to reenable a way to get the credential
|
||||
// await this._connection.getCredential();
|
||||
// %_do_not_call_change_endpoint is a SparkMagic command that lets users change endpoint options,
|
||||
// such as user/profile/host name/auth type
|
||||
|
||||
let server = URI.parse(sparkUtils.getLivyUrl(this._connection.host, this._connection.knoxport)).toString();
|
||||
let doNotCallChangeEndpointParams =
|
||||
`%_do_not_call_change_endpoint --username=${this._connection.user} --password=${this._connection.password} --server=${server} --auth=Basic_Access`;
|
||||
let future = this._session.kernel.requestExecute({
|
||||
code: doNotCallChangeEndpointParams
|
||||
}, true);
|
||||
await future.done;
|
||||
public async configureKernel(options: nb.IKernelSpec): Promise<void> {
|
||||
if (this._session) {
|
||||
await this._session.configureKernel(options);
|
||||
}
|
||||
}
|
||||
|
||||
public async updateConnection(connection: NotebookConnection): Promise<void> {
|
||||
public async updateConnection(connection: IConnectionProfile): Promise<void> {
|
||||
if (!this.kernel) {
|
||||
// TODO is there any case where skipping causes errors? So far it seems like it gets called twice
|
||||
return;
|
||||
}
|
||||
this._connection = (connection.connectionProfile.id !== '-1') ? connection : this._connection;
|
||||
// if kernel is not set, don't run kernel config actions
|
||||
// this should only occur when a cell is cancelled, which interrupts the kernel
|
||||
if (this.kernel && this.kernel.name) {
|
||||
await this.runKernelConfigActions(this.kernel.name);
|
||||
if (connection.id !== '-1') {
|
||||
await this._session.configureConnection(connection);
|
||||
}
|
||||
}
|
||||
|
||||
isSparkKernel(kernelName: string): any {
|
||||
return kernelName && kernelName.toLowerCase().indexOf('spark') > -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Kill the kernel and shutdown the session.
|
||||
*
|
||||
|
||||
@@ -17,9 +17,11 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
|
||||
import { CellType, NotebookChangeType } from 'sql/parts/notebook/models/contracts';
|
||||
import { INotebookManager } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { NotebookConnection } from 'sql/parts/notebook/models/notebookConnection';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { IStandardKernelWithProvider } from 'sql/parts/notebook/notebookUtils';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
|
||||
export interface IClientSessionOptions {
|
||||
notebookUri: URI;
|
||||
@@ -131,7 +133,7 @@ export interface IClientSession extends IDisposable {
|
||||
* This will optionally start a session if the kernel preferences
|
||||
* indicate this is desired
|
||||
*/
|
||||
initialize(connection?: NotebookConnection): Promise<void>;
|
||||
initialize(connection?: IConnectionProfile): Promise<void>;
|
||||
|
||||
/**
|
||||
* Change the current kernel associated with the document.
|
||||
@@ -140,6 +142,13 @@ export interface IClientSession extends IDisposable {
|
||||
options: nb.IKernelSpec
|
||||
): Promise<nb.IKernel>;
|
||||
|
||||
/**
|
||||
* Configure the current kernel associated with the document.
|
||||
*/
|
||||
configureKernel(
|
||||
options: nb.IKernelSpec
|
||||
): Promise<void>;
|
||||
|
||||
/**
|
||||
* Kill the kernel and shutdown the session.
|
||||
*
|
||||
@@ -191,12 +200,12 @@ export interface IClientSession extends IDisposable {
|
||||
/**
|
||||
* Updates the connection
|
||||
*/
|
||||
updateConnection(connection: NotebookConnection): void;
|
||||
updateConnection(connection: IConnectionProfile): void;
|
||||
}
|
||||
|
||||
export interface IDefaultConnection {
|
||||
defaultConnection: IConnectionProfile;
|
||||
otherConnections: IConnectionProfile[];
|
||||
defaultConnection: ConnectionProfile;
|
||||
otherConnections: ConnectionProfile[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -348,6 +357,8 @@ export interface INotebookModel {
|
||||
* @param edits The edit operations to perform
|
||||
*/
|
||||
pushEditOperations(edits: ISingleNotebookEditOperation[]): void;
|
||||
|
||||
getApplicableConnectionProviderIds(kernelName: string): string[];
|
||||
}
|
||||
|
||||
export interface NotebookContentChange {
|
||||
@@ -418,16 +429,14 @@ export interface INotebookModelOptions {
|
||||
|
||||
notebookManagers: INotebookManager[];
|
||||
providerId: string;
|
||||
standardKernels: IStandardKernelWithProvider[];
|
||||
defaultKernel: nb.IKernelSpec;
|
||||
|
||||
notificationService: INotificationService;
|
||||
connectionService: IConnectionManagementService;
|
||||
capabilitiesService: ICapabilitiesService;
|
||||
}
|
||||
|
||||
// TODO would like to move most of these constants to an extension
|
||||
export namespace notebookConstants {
|
||||
export const hadoopKnoxProviderName = 'HADOOP_KNOX';
|
||||
export const python3 = 'python3';
|
||||
export const python3DisplayName = 'Python 3';
|
||||
export const defaultSparkKernel = 'pyspark3kernel';
|
||||
export const hostPropName = 'host';
|
||||
export const SQL = 'SQL';
|
||||
}
|
||||
@@ -11,7 +11,6 @@ import { localize } from 'vs/nls';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
export namespace constants {
|
||||
export const hostPropName = 'host';
|
||||
export const userPropName = 'user';
|
||||
export const knoxPortPropName = 'knoxport';
|
||||
export const clusterPropName = 'clustername';
|
||||
@@ -52,7 +51,7 @@ export class NotebookConnection {
|
||||
* preference to the built in port.
|
||||
*/
|
||||
private ensureHostAndPort(): void {
|
||||
this._host = this.connectionProfile.options[constants.hostPropName];
|
||||
this._host = this.connectionProfile.serverName;
|
||||
this._knoxPort = NotebookConnection.getKnoxPortOrDefault(this.connectionProfile);
|
||||
// determine whether the host has either a ',' or ':' in it
|
||||
this.setHostAndPort(',');
|
||||
|
||||
152
src/sql/parts/notebook/models/notebookContexts.ts
Normal file
152
src/sql/parts/notebook/models/notebookContexts.ts
Normal file
@@ -0,0 +1,152 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import { nb } from 'sqlops';
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IDefaultConnection, notebookConstants, INotebookModelOptions } from 'sql/parts/notebook/models/modelInterfaces';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
export class NotebookContexts {
|
||||
private static MSSQL_PROVIDER = 'MSSQL';
|
||||
|
||||
private static get DefaultContext(): IDefaultConnection {
|
||||
let defaultConnection: ConnectionProfile = <any>{
|
||||
providerName: NotebookContexts.MSSQL_PROVIDER,
|
||||
id: '-1',
|
||||
serverName: localize('selectConnection', 'Select connection')
|
||||
};
|
||||
|
||||
return {
|
||||
// default context if no other contexts are applicable
|
||||
defaultConnection: defaultConnection,
|
||||
otherConnections: [defaultConnection]
|
||||
};
|
||||
}
|
||||
|
||||
private static get LocalContext(): IDefaultConnection {
|
||||
let localConnection: ConnectionProfile = <any>{
|
||||
providerName: NotebookContexts.MSSQL_PROVIDER,
|
||||
id: '-1',
|
||||
serverName: localize('localhost', 'localhost')
|
||||
};
|
||||
|
||||
return {
|
||||
// default context if no other contexts are applicable
|
||||
defaultConnection: localConnection,
|
||||
otherConnections: [localConnection]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the applicable contexts for a given kernel
|
||||
* @param connectionService connection management service
|
||||
* @param connProviderIds array of connection provider ids applicable for a kernel
|
||||
* @param kernelChangedArgs kernel changed args (both old and new kernel info)
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getContextsForKernel(connectionService: IConnectionManagementService, connProviderIds: string[], kernelChangedArgs?: nb.IKernelChangedArgs, profile?: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
let connections: IDefaultConnection = this.DefaultContext;
|
||||
if (!profile) {
|
||||
if (!kernelChangedArgs || !kernelChangedArgs.newValue ||
|
||||
(kernelChangedArgs.oldValue && kernelChangedArgs.newValue.id === kernelChangedArgs.oldValue.id)) {
|
||||
// nothing to do, kernels are the same or new kernel is undefined
|
||||
return connections;
|
||||
}
|
||||
}
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name && connProviderIds.length < 1) {
|
||||
return connections;
|
||||
} else {
|
||||
connections = await this.getActiveContexts(connectionService, connProviderIds, profile);
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all active contexts and sort them
|
||||
* @param apiWrapper ApiWrapper
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getActiveContexts(connectionService: IConnectionManagementService, connProviderIds: string[], profile: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
let defaultConnection: ConnectionProfile = NotebookContexts.DefaultContext.defaultConnection;
|
||||
let activeConnections: ConnectionProfile[] = await connectionService.getActiveConnections();
|
||||
if (activeConnections && activeConnections.length > 0) {
|
||||
activeConnections = activeConnections.filter(conn => conn.id !== '-1');
|
||||
}
|
||||
// If no connection provider ids exist for a given kernel, the attach to should show localhost
|
||||
if (connProviderIds.length === 0) {
|
||||
return NotebookContexts.LocalContext;
|
||||
}
|
||||
// If no active connections exist, show "Select connection" as the default value
|
||||
if (activeConnections.length === 0) {
|
||||
return NotebookContexts.DefaultContext;
|
||||
}
|
||||
// Filter active connections by their provider ids to match kernel's supported connection providers
|
||||
else if (activeConnections.length > 0) {
|
||||
let connections = activeConnections.filter(connection => {
|
||||
return connProviderIds.includes(connection.providerName);
|
||||
});
|
||||
if (connections && connections.length > 0) {
|
||||
defaultConnection = connections[0];
|
||||
if (profile && profile.options) {
|
||||
if (connections.find(connection => connection.serverName === profile.serverName)) {
|
||||
defaultConnection = connections.find(connection => connection.serverName === profile.serverName);
|
||||
}
|
||||
}
|
||||
}
|
||||
activeConnections = [];
|
||||
connections.forEach(connection => activeConnections.push(connection));
|
||||
}
|
||||
if (defaultConnection === NotebookContexts.DefaultContext.defaultConnection) {
|
||||
let newConnection = <ConnectionProfile><any>{
|
||||
providerName: 'SQL',
|
||||
id: '-2',
|
||||
serverName: localize('addConnection', 'Add new connection')
|
||||
};
|
||||
activeConnections.push(newConnection);
|
||||
}
|
||||
|
||||
return {
|
||||
otherConnections: activeConnections,
|
||||
defaultConnection: defaultConnection
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param specs kernel specs (comes from session manager)
|
||||
* @param connectionInfo connection profile
|
||||
* @param savedKernelInfo kernel info loaded from
|
||||
*/
|
||||
public static getDefaultKernel(specs: nb.IAllKernels, connectionInfo: IConnectionProfile, savedKernelInfo: nb.IKernelInfo): nb.IKernelSpec {
|
||||
let defaultKernel: nb.IKernelSpec;
|
||||
if (specs) {
|
||||
// find the saved kernel (if it exists)
|
||||
if (savedKernelInfo) {
|
||||
defaultKernel = specs.kernels.find((kernel) => kernel.name === savedKernelInfo.name);
|
||||
}
|
||||
// if no saved kernel exists, use the default KernelSpec
|
||||
if (!defaultKernel) {
|
||||
defaultKernel = specs.kernels.find((kernel) => kernel.name === specs.defaultKernel);
|
||||
}
|
||||
if (defaultKernel) {
|
||||
return defaultKernel;
|
||||
}
|
||||
}
|
||||
|
||||
// If no default kernel specified (should never happen), default to SQL
|
||||
if (!defaultKernel) {
|
||||
defaultKernel = {
|
||||
name: notebookConstants.SQL,
|
||||
display_name: notebookConstants.SQL
|
||||
};
|
||||
}
|
||||
return defaultKernel;
|
||||
}
|
||||
}
|
||||
@@ -17,13 +17,13 @@ import { NotebookChangeType, CellType } from 'sql/parts/notebook/models/contract
|
||||
import { nbversion } from '../notebookConstants';
|
||||
import * as notebookUtils from '../notebookUtils';
|
||||
import { INotebookManager, SQL_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_PROVIDER } from 'sql/workbench/services/notebook/common/notebookService';
|
||||
import { SparkMagicContexts } from 'sql/parts/notebook/models/sparkMagicContexts';
|
||||
import { NotebookContexts } from 'sql/parts/notebook/models/notebookContexts';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { NotebookConnection } from 'sql/parts/notebook/models/notebookConnection';
|
||||
import { INotification, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { ISingleNotebookEditOperation } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
|
||||
/*
|
||||
* Used to control whether a message in a dialog/wizard is displayed as an error,
|
||||
@@ -58,11 +58,12 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
private _savedKernelInfo: nb.IKernelInfo;
|
||||
private readonly _nbformat: number = nbversion.MAJOR_VERSION;
|
||||
private readonly _nbformatMinor: number = nbversion.MINOR_VERSION;
|
||||
private _hadoopConnection: NotebookConnection;
|
||||
private _defaultKernel: nb.IKernelSpec;
|
||||
private _activeConnection: ConnectionProfile;
|
||||
private _activeCell: ICellModel;
|
||||
private _providerId: string;
|
||||
private _isNewNotebook: boolean = true;
|
||||
private _defaultKernel: nb.IKernelSpec;
|
||||
private _kernelDisplayNameToConnectionProviderIds: Map<string, string[]> = new Map<string, string[]>();
|
||||
private _kernelDisplayNameToNotebookProviderIds: Map<string, string> = new Map<string, string>();
|
||||
|
||||
constructor(private notebookOptions: INotebookModelOptions, startSessionImmediately?: boolean, private connectionProfile?: IConnectionProfile) {
|
||||
super();
|
||||
@@ -74,6 +75,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
this._trustedMode = false;
|
||||
this._providerId = notebookOptions.providerId;
|
||||
this.notebookOptions.standardKernels.forEach(kernel => {
|
||||
this._kernelDisplayNameToConnectionProviderIds.set(kernel.name, kernel.connectionProviderIds);
|
||||
this._kernelDisplayNameToNotebookProviderIds.set(kernel.name, kernel.notebookProvider);
|
||||
});
|
||||
this._defaultKernel = notebookOptions.defaultKernel;
|
||||
}
|
||||
|
||||
public get notebookManagers(): INotebookManager[] {
|
||||
@@ -171,10 +177,6 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
return this._trustedMode;
|
||||
}
|
||||
|
||||
public get isNewNotebook(): boolean {
|
||||
return this._isNewNotebook;
|
||||
}
|
||||
|
||||
public get providerId(): string {
|
||||
return this._providerId;
|
||||
}
|
||||
@@ -188,8 +190,8 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
}
|
||||
|
||||
public get hadoopConnection(): NotebookConnection {
|
||||
return this._hadoopConnection;
|
||||
public get activeConnection(): IConnectionProfile {
|
||||
return this._activeConnection;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -207,6 +209,14 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
return this._onClientSessionReady.event;
|
||||
}
|
||||
|
||||
public getApplicableConnectionProviderIds(kernelDisplayName: string): string[] {
|
||||
let ids = [];
|
||||
if (kernelDisplayName) {
|
||||
ids = this._kernelDisplayNameToConnectionProviderIds.get(kernelDisplayName);
|
||||
}
|
||||
return !ids ? [] : ids;
|
||||
}
|
||||
|
||||
public async requestModelLoad(isTrusted: boolean = false): Promise<void> {
|
||||
try {
|
||||
this._trustedMode = isTrusted;
|
||||
@@ -223,9 +233,12 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
version: ''
|
||||
};
|
||||
if (contents) {
|
||||
this._isNewNotebook = false;
|
||||
this._defaultLanguageInfo = this.getDefaultLanguageInfo(contents);
|
||||
this._savedKernelInfo = this.getSavedKernelInfo(contents);
|
||||
this.setProviderIdForKernel(this._savedKernelInfo);
|
||||
if (this._savedKernelInfo) {
|
||||
this._defaultKernel = this._savedKernelInfo;
|
||||
}
|
||||
if (contents.cells && contents.cells.length > 0) {
|
||||
this._cells = contents.cells.map(c => factory.createCell(c, { notebook: this, isTrusted: isTrusted }));
|
||||
}
|
||||
@@ -338,15 +351,15 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (!this._activeClientSession) {
|
||||
this._activeClientSession = clientSession;
|
||||
}
|
||||
let profile = this.connectionProfile as IConnectionProfile;
|
||||
let profile = new ConnectionProfile(this.notebookOptions.capabilitiesService, this.connectionProfile);
|
||||
|
||||
if (this.isValidKnoxConnection(profile)) {
|
||||
this._hadoopConnection = new NotebookConnection(this.connectionProfile);
|
||||
if (this.isValidConnection(profile)) {
|
||||
this._activeConnection = profile;
|
||||
} else {
|
||||
this._hadoopConnection = undefined;
|
||||
this._activeConnection = undefined;
|
||||
}
|
||||
|
||||
clientSession.initialize(this._hadoopConnection);
|
||||
clientSession.initialize(this._activeConnection);
|
||||
this._sessionLoadFinished = clientSession.ready.then(async () => {
|
||||
if (clientSession.isInErrorState) {
|
||||
this.setErrorState(clientSession.errorMessage);
|
||||
@@ -360,8 +373,10 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
});
|
||||
}
|
||||
|
||||
private isValidKnoxConnection(profile: IConnectionProfile | connection.Connection) {
|
||||
return profile && profile.providerName === notebookConstants.hadoopKnoxProviderName && profile.options[notebookConstants.hostPropName] !== undefined;
|
||||
private isValidConnection(profile: IConnectionProfile | connection.Connection) {
|
||||
let standardKernels = this.notebookOptions.standardKernels.find(kernel => this._savedKernelInfo && kernel.name === this._savedKernelInfo.display_name);
|
||||
let connectionProviderIds = standardKernels ? standardKernels.connectionProviderIds : undefined;
|
||||
return profile && connectionProviderIds && connectionProviderIds.find(provider => provider === profile.providerName) !== undefined;
|
||||
}
|
||||
|
||||
public get languageInfo(): nb.ILanguageInfo {
|
||||
@@ -380,45 +395,49 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
|
||||
public doChangeKernel(kernelSpec: nb.IKernelSpec): Promise<void> {
|
||||
this.findProviderIdForKernel(kernelSpec);
|
||||
return this._activeClientSession.changeKernel(kernelSpec)
|
||||
.then((kernel) => {
|
||||
kernel.ready.then(() => {
|
||||
if (kernel.info) {
|
||||
this.updateLanguageInfo(kernel.info.language_info);
|
||||
}
|
||||
}, err => undefined);
|
||||
return this.updateKernelInfo(kernel);
|
||||
}).catch((err) => {
|
||||
this.notifyError(localize('changeKernelFailed', 'Failed to change kernel: {0}', notebookUtils.getErrorMessage(err)));
|
||||
// TODO should revert kernels dropdown
|
||||
});
|
||||
this.setProviderIdForKernel(kernelSpec);
|
||||
if (this._activeClientSession && this._activeClientSession.isReady) {
|
||||
return this._activeClientSession.changeKernel(kernelSpec)
|
||||
.then((kernel) => {
|
||||
this.updateKernelInfo(kernel);
|
||||
kernel.ready.then(() => {
|
||||
if (kernel.info) {
|
||||
this.updateLanguageInfo(kernel.info.language_info);
|
||||
}
|
||||
}, err => undefined);
|
||||
}).catch((err) => {
|
||||
this.notifyError(localize('changeKernelFailed', 'Failed to change kernel: {0}', notebookUtils.getErrorMessage(err)));
|
||||
// TODO should revert kernels dropdown
|
||||
});
|
||||
}
|
||||
this.notifyError(localize('noActiveClientSessionFound', 'No active client session was found.'));
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
public changeContext(host: string, newConnection?: IConnectionProfile): void {
|
||||
public changeContext(server: string, newConnection?: IConnectionProfile): void {
|
||||
try {
|
||||
if (!newConnection) {
|
||||
newConnection = this._activeContexts.otherConnections.find((connection) => connection.options['host'] === host);
|
||||
newConnection = this._activeContexts.otherConnections.find((connection) => connection.serverName === server);
|
||||
}
|
||||
if (!newConnection && this._activeContexts.defaultConnection.options['host'] === host) {
|
||||
if (!newConnection && (this._activeContexts.defaultConnection.serverName === server)) {
|
||||
newConnection = this._activeContexts.defaultConnection;
|
||||
}
|
||||
SparkMagicContexts.configureContext();
|
||||
this._hadoopConnection = new NotebookConnection(newConnection);
|
||||
this.refreshConnections(newConnection);
|
||||
this._activeClientSession.updateConnection(this._hadoopConnection);
|
||||
let newConnectionProfile = new ConnectionProfile(this.notebookOptions.capabilitiesService, newConnection);
|
||||
this._activeConnection = newConnectionProfile;
|
||||
this.refreshConnections(newConnectionProfile);
|
||||
this._activeClientSession.updateConnection(this._activeConnection);
|
||||
} catch (err) {
|
||||
let msg = notebookUtils.getErrorMessage(err);
|
||||
this.notifyError(localize('changeContextFailed', 'Changing context failed: {0}', msg));
|
||||
}
|
||||
}
|
||||
|
||||
private refreshConnections(newConnection: IConnectionProfile) {
|
||||
if (this.isValidKnoxConnection(newConnection) &&
|
||||
this._hadoopConnection.connectionProfile.id !== '-1' &&
|
||||
this._hadoopConnection.connectionProfile.id !== this._activeContexts.defaultConnection.id) {
|
||||
private refreshConnections(newConnection: ConnectionProfile) {
|
||||
if (this.isValidConnection(newConnection) &&
|
||||
this._activeConnection.id !== '-1' &&
|
||||
this._activeConnection.id !== this._activeContexts.defaultConnection.id) {
|
||||
// Put the defaultConnection to the head of otherConnections
|
||||
if (this.isValidKnoxConnection(this._activeContexts.defaultConnection)) {
|
||||
if (this.isValidConnection(this._activeContexts.defaultConnection)) {
|
||||
this._activeContexts.otherConnections = this._activeContexts.otherConnections.filter(conn => conn.id !== this._activeContexts.defaultConnection.id);
|
||||
this._activeContexts.otherConnections.unshift(this._activeContexts.defaultConnection);
|
||||
}
|
||||
@@ -439,18 +458,15 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
try {
|
||||
let sessionManager = this.notebookManager.sessionManager;
|
||||
if (sessionManager) {
|
||||
let defaultKernel = SparkMagicContexts.getDefaultKernel(sessionManager.specs, this.connectionProfile, this._savedKernelInfo, this.notebookOptions.notificationService);
|
||||
this._defaultKernel = defaultKernel;
|
||||
if (!this._defaultKernel) {
|
||||
this._defaultKernel = NotebookContexts.getDefaultKernel(sessionManager.specs, this.connectionProfile, this._savedKernelInfo);
|
||||
}
|
||||
this._clientSessions.forEach(clientSession => {
|
||||
clientSession.statusChanged(async (session) => {
|
||||
if (session && session.defaultKernelLoaded === true) {
|
||||
this._kernelsChangedEmitter.fire(defaultKernel);
|
||||
} else if (session && !session.defaultKernelLoaded) {
|
||||
this._kernelsChangedEmitter.fire({ name: notebookConstants.python3, display_name: notebookConstants.python3DisplayName });
|
||||
}
|
||||
this._kernelsChangedEmitter.fire(session.kernel);
|
||||
});
|
||||
});
|
||||
this.doChangeKernel(defaultKernel);
|
||||
this.doChangeKernel(this._defaultKernel);
|
||||
}
|
||||
} catch (err) {
|
||||
let msg = notebookUtils.getErrorMessage(err);
|
||||
@@ -484,6 +500,15 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
return kernel;
|
||||
}
|
||||
|
||||
private getDisplayNameFromSpecName(kernelid: string): string {
|
||||
let newKernel = this.notebookManager.sessionManager.specs.kernels.find(kernel => kernel.name === kernelid);
|
||||
let newKernelDisplayName;
|
||||
if (newKernel) {
|
||||
newKernelDisplayName = newKernel.display_name;
|
||||
}
|
||||
return newKernelDisplayName;
|
||||
}
|
||||
|
||||
private setErrorState(errMsg: string): void {
|
||||
this._inErrorState = true;
|
||||
let msg = localize('startSessionFailed', 'Could not start session: {0}', errMsg);
|
||||
@@ -499,6 +524,11 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
public async handleClosed(): Promise<void> {
|
||||
try {
|
||||
if (this._activeClientSession) {
|
||||
try {
|
||||
await this._activeClientSession.ready;
|
||||
} catch(err) {
|
||||
this.notifyError(localize('shutdownClientSessionError', 'A client session error occurred when closing the notebook: {0}', err));
|
||||
}
|
||||
await this._activeClientSession.shutdown();
|
||||
this._clientSessions = undefined;
|
||||
this._activeClientSession = undefined;
|
||||
@@ -509,11 +539,13 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
}
|
||||
|
||||
private async loadActiveContexts(kernelChangedArgs: nb.IKernelChangedArgs): Promise<void> {
|
||||
this._activeContexts = await SparkMagicContexts.getContextsForKernel(this.notebookOptions.connectionService, kernelChangedArgs, this.connectionProfile);
|
||||
this._contextsChangedEmitter.fire();
|
||||
if (this.contexts.defaultConnection !== undefined && this.contexts.defaultConnection.options !== undefined) {
|
||||
let defaultHadoopConnection = new NotebookConnection(this.contexts.defaultConnection);
|
||||
this.changeContext(defaultHadoopConnection.host);
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
||||
let kernelDisplayName = this.getDisplayNameFromSpecName(kernelChangedArgs.newValue.name);
|
||||
this._activeContexts = await NotebookContexts.getContextsForKernel(this.notebookOptions.connectionService, this.getApplicableConnectionProviderIds(kernelDisplayName), kernelChangedArgs, this.connectionProfile);
|
||||
this._contextsChangedEmitter.fire();
|
||||
if (this.contexts.defaultConnection !== undefined && this.contexts.defaultConnection.serverName !== undefined) {
|
||||
this.changeContext(this.contexts.defaultConnection.serverName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -555,6 +587,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
display_name: spec.display_name,
|
||||
language: spec.language
|
||||
};
|
||||
this.clientSession.configureKernel(this._savedKernelInfo);
|
||||
} catch (err) {
|
||||
// Don't worry about this for now. Just use saved values
|
||||
}
|
||||
@@ -565,17 +598,27 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
* Set _providerId and _activeClientSession based on a kernelSpec representing new kernel
|
||||
* @param kernelSpec KernelSpec for new kernel
|
||||
*/
|
||||
private findProviderIdForKernel(kernelSpec: nb.IKernelSpec): void {
|
||||
private setProviderIdForKernel(kernelSpec: nb.IKernelSpec): void {
|
||||
let sessionManagerFound: boolean = false;
|
||||
for (let i = 0; i < this.notebookManagers.length; i++) {
|
||||
if (this.notebookManagers[i].sessionManager && this.notebookManagers[i].sessionManager.specs && this.notebookManagers[i].sessionManager.specs.kernels) {
|
||||
let index = this.notebookManagers[i].sessionManager.specs.kernels.findIndex(kernel => kernel.name === kernelSpec.name);
|
||||
if (index >= 0) {
|
||||
this._activeClientSession = this._clientSessions[i];
|
||||
this._providerId = this.notebookManagers[i].providerId;
|
||||
sessionManagerFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If no SessionManager exists, utilize passed in StandardKernels to see if we can intelligently set _providerId
|
||||
if (!sessionManagerFound) {
|
||||
let provider = this._kernelDisplayNameToNotebookProviderIds.get(kernelSpec.display_name);
|
||||
if (provider) {
|
||||
this._providerId = provider;
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Serialize the model to JSON.
|
||||
|
||||
@@ -1,238 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as path from 'path';
|
||||
import { nb } from 'sqlops';
|
||||
|
||||
import * as pfs from 'vs/base/node/pfs';
|
||||
import { localize } from 'vs/nls';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import { IDefaultConnection, notebookConstants, INotebookModelOptions } from 'sql/parts/notebook/models/modelInterfaces';
|
||||
import * as notebookUtils from '../notebookUtils';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
|
||||
const configBase = {
|
||||
'kernel_python_credentials': {
|
||||
'url': ''
|
||||
},
|
||||
'kernel_scala_credentials': {
|
||||
'url': ''
|
||||
},
|
||||
'kernel_r_credentials': {
|
||||
'url': ''
|
||||
},
|
||||
|
||||
'ignore_ssl_errors': true,
|
||||
|
||||
'logging_config': {
|
||||
'version': 1,
|
||||
'formatters': {
|
||||
'magicsFormatter': {
|
||||
'format': '%(asctime)s\t%(levelname)s\t%(message)s',
|
||||
'datefmt': ''
|
||||
}
|
||||
},
|
||||
'handlers': {
|
||||
'magicsHandler': {
|
||||
'class': 'hdijupyterutils.filehandler.MagicsFileHandler',
|
||||
'formatter': 'magicsFormatter',
|
||||
'home_path': ''
|
||||
}
|
||||
},
|
||||
'loggers': {
|
||||
'magicsLogger': {
|
||||
'handlers': ['magicsHandler'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': 0
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
export class SparkMagicContexts {
|
||||
|
||||
public static get DefaultContext(): IDefaultConnection {
|
||||
// TODO NOTEBOOK REFACTOR fix default connection handling
|
||||
let defaultConnection: IConnectionProfile = <any>{
|
||||
providerName: notebookConstants.hadoopKnoxProviderName,
|
||||
id: '-1',
|
||||
options:
|
||||
{
|
||||
host: localize('selectConnection', 'Select connection')
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
// default context if no other contexts are applicable
|
||||
defaultConnection: defaultConnection,
|
||||
otherConnections: [defaultConnection]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all of the applicable contexts for a given kernel
|
||||
* @param apiWrapper ApiWrapper
|
||||
* @param kernelChangedArgs kernel changed args (both old and new kernel info)
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getContextsForKernel(connectionService: IConnectionManagementService, kernelChangedArgs?: nb.IKernelChangedArgs, profile?: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
let connections: IDefaultConnection = this.DefaultContext;
|
||||
if (!profile) {
|
||||
if (!kernelChangedArgs || !kernelChangedArgs.newValue ||
|
||||
(kernelChangedArgs.oldValue && kernelChangedArgs.newValue.id === kernelChangedArgs.oldValue.id)) {
|
||||
// nothing to do, kernels are the same or new kernel is undefined
|
||||
return connections;
|
||||
}
|
||||
}
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
||||
switch (kernelChangedArgs.newValue.name) {
|
||||
case (notebookConstants.python3):
|
||||
// python3 case, use this.DefaultContext for the only connection
|
||||
break;
|
||||
//TO DO: Handle server connections based on kernel type. Right now, we call the same method for all kernel types.
|
||||
default:
|
||||
connections = await this.getActiveContexts(connectionService, profile);
|
||||
}
|
||||
} else {
|
||||
connections = await this.getActiveContexts(connectionService, profile);
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all active contexts and sort them
|
||||
* @param apiWrapper ApiWrapper
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getActiveContexts(connectionService: IConnectionManagementService, profile: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
let defaultConnection: IConnectionProfile = SparkMagicContexts.DefaultContext.defaultConnection;
|
||||
let activeConnections: IConnectionProfile[] = await connectionService.getActiveConnections();
|
||||
// If no connections exist, only show 'n/a'
|
||||
if (activeConnections && activeConnections.length > 0) {
|
||||
// Remove all non-Spark connections
|
||||
activeConnections = activeConnections.filter(conn => conn.providerName === notebookConstants.hadoopKnoxProviderName);
|
||||
}
|
||||
if (activeConnections.length === 0) {
|
||||
return SparkMagicContexts.DefaultContext;
|
||||
}
|
||||
|
||||
// If launched from the right click or server dashboard, connection profile data exists, so use that as default
|
||||
if (profile && profile.options) {
|
||||
let profileConnection = activeConnections.filter(conn => conn.options['host'] === profile.options['host']);
|
||||
if (profileConnection) {
|
||||
defaultConnection = profileConnection[0];
|
||||
}
|
||||
} else {
|
||||
if (activeConnections.length > 0) {
|
||||
defaultConnection = activeConnections[0];
|
||||
} else {
|
||||
// TODO NOTEBOOK REFACTOR change this so it's no longer incompatible with IConnectionProfile
|
||||
defaultConnection = <IConnectionProfile><any>{
|
||||
providerName: notebookConstants.hadoopKnoxProviderName,
|
||||
id: '-1',
|
||||
options:
|
||||
{
|
||||
host: localize('addConnection', 'Add new connection')
|
||||
}
|
||||
};
|
||||
activeConnections.push(defaultConnection);
|
||||
}
|
||||
}
|
||||
return {
|
||||
otherConnections: activeConnections,
|
||||
defaultConnection: defaultConnection
|
||||
};
|
||||
}
|
||||
|
||||
public static async configureContext(): Promise<object> {
|
||||
let sparkmagicConfDir = path.join(notebookUtils.getUserHome(), '.sparkmagic');
|
||||
// TODO NOTEBOOK REFACTOR re-enable this or move to extension. Requires config files to be available in order to work
|
||||
await notebookUtils.mkDir(sparkmagicConfDir);
|
||||
|
||||
// Default to localhost in config file.
|
||||
let creds: ICredentials = {
|
||||
'url': 'http://localhost:8088'
|
||||
};
|
||||
|
||||
let config: ISparkMagicConfig = Object.assign({}, configBase);
|
||||
SparkMagicContexts.updateConfig(config, creds, sparkmagicConfDir);
|
||||
|
||||
let configFilePath = path.join(sparkmagicConfDir, 'config.json');
|
||||
await pfs.writeFile(configFilePath, JSON.stringify(config));
|
||||
|
||||
return { 'SPARKMAGIC_CONF_DIR': sparkmagicConfDir };
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param specs kernel specs (comes from session manager)
|
||||
* @param connectionInfo connection profile
|
||||
* @param savedKernelInfo kernel info loaded from
|
||||
*/
|
||||
public static getDefaultKernel(specs: nb.IAllKernels, connectionInfo: IConnectionProfile, savedKernelInfo: nb.IKernelInfo, notificationService: INotificationService): nb.IKernelSpec {
|
||||
let foundSavedKernelInSpecs;
|
||||
let defaultKernel;
|
||||
if (specs) {
|
||||
defaultKernel = specs.kernels.find((kernel) => kernel.name === specs.defaultKernel);
|
||||
if (savedKernelInfo) {
|
||||
foundSavedKernelInSpecs = specs.kernels.find((kernel) => kernel.name === savedKernelInfo.name);
|
||||
}
|
||||
}
|
||||
let profile = connectionInfo as IConnectionProfile;
|
||||
if (specs && connectionInfo && profile.providerName === notebookConstants.hadoopKnoxProviderName) {
|
||||
// set default kernel to default spark kernel if profile exists
|
||||
// otherwise, set default to kernel info loaded from existing file
|
||||
defaultKernel = !foundSavedKernelInSpecs ? specs.kernels.find((spec) => spec.name === notebookConstants.defaultSparkKernel) : foundSavedKernelInSpecs;
|
||||
} else {
|
||||
// Handle kernels
|
||||
if (savedKernelInfo && savedKernelInfo.name.toLowerCase().indexOf('spark') > -1) {
|
||||
notificationService.warn(localize('sparkKernelRequiresConnection', 'Cannot use kernel {0} as no connection is active. The default kernel of {1} will be used instead.', savedKernelInfo.display_name, defaultKernel.display_name));
|
||||
}
|
||||
}
|
||||
|
||||
// If no default kernel specified (should never happen), default to python3
|
||||
if (!defaultKernel) {
|
||||
defaultKernel = {
|
||||
name: notebookConstants.python3,
|
||||
display_name: notebookConstants.python3DisplayName
|
||||
};
|
||||
}
|
||||
return defaultKernel;
|
||||
}
|
||||
|
||||
private static updateConfig(config: ISparkMagicConfig, creds: ICredentials, homePath: string): void {
|
||||
config.kernel_python_credentials = creds;
|
||||
config.kernel_scala_credentials = creds;
|
||||
config.kernel_r_credentials = creds;
|
||||
config.logging_config.handlers.magicsHandler.home_path = homePath;
|
||||
}
|
||||
}
|
||||
|
||||
interface ICredentials {
|
||||
'url': string;
|
||||
}
|
||||
|
||||
interface ISparkMagicConfig {
|
||||
kernel_python_credentials: ICredentials;
|
||||
kernel_scala_credentials: ICredentials;
|
||||
kernel_r_credentials: ICredentials;
|
||||
ignore_ssl_errors?: boolean;
|
||||
logging_config: {
|
||||
handlers: {
|
||||
magicsHandler: {
|
||||
home_path: string;
|
||||
class?: string;
|
||||
formatter?: string
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
export interface IKernelJupyterID {
|
||||
id: string;
|
||||
jupyterId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user