Rewrite Spark UI link when using unified connection (#4362)

* Rewrite Spark UI link when using unified connection

* Add more robust error checking
This commit is contained in:
Chris LaFreniere
2019-03-08 17:34:47 -08:00
committed by GitHub
parent 4d6271c161
commit 1e989060f9
9 changed files with 52 additions and 25 deletions

View File

@@ -88,6 +88,12 @@ export enum Platform {
Others
}
export interface IEndpoint {
serviceName: string;
ipAddress: string;
port: number;
}
export function getOSPlatform(): Platform {
switch (process.platform) {
case 'win32':

View File

@@ -242,7 +242,7 @@ export class JupyterSession implements nb.ISession {
//Update server info with bigdata endpoint - Unified Connection
if (connection.providerName === SQL_PROVIDER) {
let clusterEndpoint: IEndpoint = await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT);
let clusterEndpoint: utils.IEndpoint = await this.getClusterEndpoint(connection.id, KNOX_ENDPOINT);
if (!clusterEndpoint) {
let kernelDisplayName: string = await this.getKernelDisplayName();
return Promise.reject(new Error(localize('connectionNotValid', 'Spark kernels require a connection to a SQL Server big data cluster master instance.')));
@@ -303,12 +303,12 @@ export class JupyterSession implements nb.ISession {
return port;
}
private async getClusterEndpoint(profileId: string, serviceName: string): Promise<IEndpoint> {
private async getClusterEndpoint(profileId: string, serviceName: string): Promise<utils.IEndpoint> {
let serverInfo: ServerInfo = await connection.getServerInfo(profileId);
if (!serverInfo || !serverInfo.options) {
return undefined;
}
let endpoints: IEndpoint[] = serverInfo.options['clusterEndpoints'];
let endpoints: utils.IEndpoint[] = serverInfo.options['clusterEndpoints'];
if (!endpoints || endpoints.length === 0) {
return undefined;
}
@@ -320,12 +320,6 @@ interface ICredentials {
'url': string;
}
interface IEndpoint {
serviceName: string;
ipAddress: string;
port: number;
}
interface ISparkMagicConfig {
kernel_python_credentials: ICredentials;
kernel_scala_credentials: ICredentials;