From f73d81bc13477d988222743792836e17a9af97af Mon Sep 17 00:00:00 2001 From: Leila Lali Date: Mon, 18 May 2020 17:12:02 -0700 Subject: [PATCH] ML- Fixed the issue with wrong title in predict page (#10467) * Fixed the issue with wrong title in predict page * Fixed the type of ml settings * Increased timeout * Fixed the bug with R package management and Windows auth * fixed the tests * fixed a typo --- extensions/machine-learning/package.json | 44 ++++++++++--------- extensions/machine-learning/package.nls.json | 24 +++++----- .../machine-learning/src/common/constants.ts | 21 ++++----- .../src/common/processService.ts | 2 +- .../sqlRPackageManageProvider.ts | 3 +- .../sqlRPackageManageProvider.test.ts | 9 +++- .../views/externalLanguages/languagesTable.ts | 2 +- .../models/manageModels/currentModelsTable.ts | 2 +- .../views/models/prediction/predictWizard.ts | 1 + 9 files changed, 59 insertions(+), 49 deletions(-) diff --git a/extensions/machine-learning/package.json b/extensions/machine-learning/package.json index e3238bfad0..bc13b757d0 100644 --- a/extensions/machine-learning/package.json +++ b/extensions/machine-learning/package.json @@ -10,7 +10,9 @@ "azdata": ">=1.13.0" }, "activationEvents": [ - "onCommand:mls.command.managePackages", + "onCommand:ml.command.managePackages", + "onCommand:ml.command.predictModel", + "onCommand:ml.command.importModel", "onDashboardOpen" ], "license": "https://raw.githubusercontent.com/Microsoft/azuredatastudio/master/LICENSE.txt", @@ -28,66 +30,66 @@ "contributes": { "configuration": { "type": "object", - "title": "%mls.configuration.title%", + "title": "%ml.configuration.title%", "properties": { "machineLearning.enablePython": { "type": "boolean", - "default": "true", - "description": "%mls.enablePython.description%" + "default": true, + "description": "%ml.enablePython.description%" }, "machineLearning.enableR": { "type": "boolean", - "default": "false", - "description": "%mls.enableR.description%" + "default": false, + "description": "%ml.enableR.description%" }, "machineLearning.pythonPath": { "type": "string", "default": "", - "description": "%mls.pythonPath.description%" + "description": "%ml.pythonPath.description%" }, "machineLearning.rPath": { "type": "string", "default": "", - "description": "%mls.rPath.description%" + "description": "%ml.rPath.description%" } } }, "commands": [ { - "command": "mls.command.managePackages", - "title": "%mls.command.managePackages%", + "command": "ml.command.managePackages", + "title": "%ml.command.managePackages%", "icon": { "light": "./images/installPackages.svg", "dark": "./images/installPackages.svg" } }, { - "command": "mls.command.predictModel", - "title": "%mls.command.predictModel%", + "command": "ml.command.predictModel", + "title": "%ml.command.predictModel%", "icon": { "light": "./images/makePredictions.svg", "dark": "./images/makePredictions.svg" } }, { - "command": "mls.command.manageModels", - "title": "%mls.command.manageModels%" + "command": "ml.command.manageModels", + "title": "%ml.command.manageModels%" }, { - "command": "mls.command.importModel", - "title": "%mls.command.importModel%", + "command": "ml.command.importModel", + "title": "%ml.command.importModel%", "icon": { "light": "./images/registerModel.svg", "dark": "./images/registerModel.svg" } }, { - "command": "mls.command.dependencies", - "title": "%mls.command.dependencies%" + "command": "ml.command.dependencies", + "title": "%ml.command.dependencies%" }, { - "command": "mls.command.enableExternalScript", - "title": "%mls.command.enableExternalScript%" + "command": "ml.command.enableExternalScript", + "title": "%ml.command.enableExternalScript%" } ], "dashboard.tabs": [ @@ -109,7 +111,7 @@ "col": 0, "widget": { "tasks-widget": [ - "mls.command.managePackages" + "ml.command.managePackages" ] } }, diff --git a/extensions/machine-learning/package.nls.json b/extensions/machine-learning/package.nls.json index 7d919e0730..ba5bacdba1 100644 --- a/extensions/machine-learning/package.nls.json +++ b/extensions/machine-learning/package.nls.json @@ -5,16 +5,16 @@ "title.documents": "Documents", "title.configurations": "Configurations", "title.endpoints": "Endpoints", - "mls.command.managePackages": "Manage packages in database", - "mls.command.manageLanguages": "Manage external languages", - "mls.command.predictModel": "Make prediction", - "mls.command.manageModels": "Manage models", - "mls.command.importModel": "Import model", - "mls.configuration.title": "Machine Learning Configurations", - "mls.pythonPath.description": "Local path to a preexisting Python installation used by Machine Learning.", - "mls.enablePython.description": "Enable Python package management in database.", - "mls.enableR.description": "Enable R package management in database.", - "mls.rPath.description": "Local path to a preexisting R installation used by Machine Learning.", - "mls.command.dependencies": "Install Machine Learning Dependencies", - "mls.command.enableExternalScript": "Enable External script" + "ml.command.managePackages": "Manage packages in database", + "ml.command.manageLanguages": "Manage external languages", + "ml.command.predictModel": "Make prediction", + "ml.command.manageModels": "Manage models", + "ml.command.importModel": "Import model", + "ml.configuration.title": "Machine Learning Configurations", + "ml.pythonPath.description": "Local path to a preexisting Python installation used by Machine Learning.", + "ml.enablePython.description": "Enable Python package management in database.", + "ml.enableR.description": "Enable R package management in database.", + "ml.rPath.description": "Local path to a preexisting R installation used by Machine Learning.", + "ml.command.dependencies": "Install Machine Learning Dependencies", + "ml.command.enableExternalScript": "Enable External script" } diff --git a/extensions/machine-learning/src/common/constants.ts b/extensions/machine-learning/src/common/constants.ts index 71565acfb2..beec925c82 100644 --- a/extensions/machine-learning/src/common/constants.ts +++ b/extensions/machine-learning/src/common/constants.ts @@ -14,8 +14,8 @@ export const pythonLanguageName = 'Python'; export const rLanguageName = 'R'; export const rLPackagedFolderName = 'r_packages'; -export const mlEnableMlsCommand = 'mls.command.enableMls'; -export const mlDisableMlsCommand = 'mls.command.disableMls'; +export const mlEnableMlsCommand = 'ml.command.enableMls'; +export const mlDisableMlsCommand = 'ml.command.disableMls'; export const extensionOutputChannel = 'Machine Learning'; export const notebookExtensionName = 'Microsoft.notebook'; export const azureSubscriptionsCommand = 'azure.accounts.getSubscriptions'; @@ -24,13 +24,13 @@ export const signInToAzureCommand = 'azure.resource.signin'; // Tasks, commands // -export const mlManageLanguagesCommand = 'mls.command.manageLanguages'; -export const mlsPredictModelCommand = 'mls.command.predictModel'; -export const mlManageModelsCommand = 'mls.command.manageModels'; -export const mlImportModelCommand = 'mls.command.importModel'; -export const mlManagePackagesCommand = 'mls.command.managePackages'; -export const mlsDependenciesCommand = 'mls.command.dependencies'; -export const mlsEnableExternalScriptCommand = 'mls.command.enableExternalScript'; +export const mlManageLanguagesCommand = 'ml.command.manageLanguages'; +export const mlsPredictModelCommand = 'ml.command.predictModel'; +export const mlManageModelsCommand = 'ml.command.manageModels'; +export const mlImportModelCommand = 'ml.command.importModel'; +export const mlManagePackagesCommand = 'ml.command.managePackages'; +export const mlsDependenciesCommand = 'ml.command.dependencies'; +export const mlsEnableExternalScriptCommand = 'ml.command.enableExternalScript'; export const notebookCommandNew = 'notebook.command.new'; // Configurations @@ -104,6 +104,7 @@ export const extLangInstallTabTitle = localize('extLang.installTabTitle', "Insta export const extLangLanguageCreatedDate = localize('extLang.languageCreatedDate', "Installed"); export const extLangLanguagePlatform = localize('extLang.languagePlatform', "Platform"); export const deleteTitle = localize('extLang.delete', "Delete"); +export const editTitle = localize('editTitle', "Edit"); export const extLangInstallButtonText = localize('extLang.installButtonText', "Install"); export const extLangCancelButtonText = localize('extLang.CancelButtonText', "Cancel"); export const extLangDoneButtonText = localize('extLang.DoneButtonText', "Close"); @@ -129,7 +130,7 @@ export const modelsListEmptyMessage = localize('models.modelsListEmptyMessage', export const modelsListEmptyDescription = localize('models.modelsListEmptyDescription', "Use import wizard to add models to this table"); export const databaseName = localize('databaseName', "Models database"); export const databaseToStoreInfo = localize('databaseToStoreInfo', "Select a database to store the new model."); -export const tableToStoreInfo = localize('tableToStoreInfo', "Select an existing table that conforms the model schema or create a new one to store the new model."); +export const tableToStoreInfo = localize('tableToStoreInfo', "Select an existing table that conforms the model schema or create a new one to store the imported model."); export const tableName = localize('tableName', "Models table"); export const modelTableInfo = localize('modelTableInfo', "Select a model table to view the list of existing / imported models."); export const modelDatabaseInfo = localize('modelDatabaseInfo', "Select a database where existing / imported models are stored."); diff --git a/extensions/machine-learning/src/common/processService.ts b/extensions/machine-learning/src/common/processService.ts index 9dc050cf4c..2a66ef0d18 100644 --- a/extensions/machine-learning/src/common/processService.ts +++ b/extensions/machine-learning/src/common/processService.ts @@ -6,7 +6,7 @@ import * as vscode from 'vscode'; import * as childProcess from 'child_process'; -const ExecScriptsTimeoutInSeconds = 600000; +const ExecScriptsTimeoutInSeconds = 1800000; export class ProcessService { public timeout = ExecScriptsTimeoutInSeconds; diff --git a/extensions/machine-learning/src/packageManagement/sqlRPackageManageProvider.ts b/extensions/machine-learning/src/packageManagement/sqlRPackageManageProvider.ts index 14548379e9..841067224b 100644 --- a/extensions/machine-learning/src/packageManagement/sqlRPackageManageProvider.ts +++ b/extensions/machine-learning/src/packageManagement/sqlRPackageManageProvider.ts @@ -69,7 +69,8 @@ export class SqlRPackageManageProvider extends SqlPackageManageProviderBase impl if (connection) { let database = databaseName ? `, database="${databaseName}"` : ''; - let connectionParts = `server="${connection.serverName}", uid="${connection.userName}", pwd="${credentials[azdata.ConnectionOptionSpecialType.password]}"${database}`; + const auth = connection.userName ? `, uid="${connection.userName}", pwd="${credentials[azdata.ConnectionOptionSpecialType.password]}"` : ''; + let connectionParts = `server="${connection.serverName}"${auth}${database}`; let rCommandScript = scriptMode === ScriptMode.Install ? 'sql_install.packages' : 'sql_remove.packages'; let scripts: string[] = [ diff --git a/extensions/machine-learning/src/test/packageManagement/sqlRPackageManageProvider.test.ts b/extensions/machine-learning/src/test/packageManagement/sqlRPackageManageProvider.test.ts index d46eb3b584..1fb5d01917 100644 --- a/extensions/machine-learning/src/test/packageManagement/sqlRPackageManageProvider.test.ts +++ b/extensions/machine-learning/src/test/packageManagement/sqlRPackageManageProvider.test.ts @@ -100,7 +100,8 @@ describe('SQL R Package Manager', () => { let connection = new azdata.connection.ConnectionProfile(); connection.serverName = 'serverName'; connection.databaseName = 'databaseName'; - let credentials = { [azdata.ConnectionOptionSpecialType.password]: 'password' }; + connection.userName = 'user'; + let credentials = { [azdata.ConnectionOptionSpecialType.password]: 'password', [azdata.ConnectionOptionSpecialType.userName]: 'user' }; testContext.apiWrapper.setup(x => x.getCurrentConnection()).returns(() => { return Promise.resolve(connection); }); testContext.apiWrapper.setup(x => x.getCredentials(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(credentials); }); testContext.processService.setup(x => x.execScripts(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((path, scripts: string[]) => { @@ -139,7 +140,11 @@ describe('SQL R Package Manager', () => { let connection = new azdata.connection.ConnectionProfile(); connection.serverName = 'serverName'; connection.databaseName = 'databaseName'; - let credentials = { [azdata.ConnectionOptionSpecialType.password]: 'password' }; + connection.userName = 'user'; + let credentials = { + [azdata.ConnectionOptionSpecialType.password]: 'password', + [azdata.ConnectionOptionSpecialType.userName]: 'user' + }; testContext.apiWrapper.setup(x => x.getCurrentConnection()).returns(() => { return Promise.resolve(connection); }); testContext.apiWrapper.setup(x => x.getCredentials(TypeMoq.It.isAny())).returns(() => { return Promise.resolve(credentials); }); testContext.processService.setup(x => x.execScripts(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((path, scripts: string[]) => { diff --git a/extensions/machine-learning/src/views/externalLanguages/languagesTable.ts b/extensions/machine-learning/src/views/externalLanguages/languagesTable.ts index 3fe1dda8a1..1d9469be54 100644 --- a/extensions/machine-learning/src/views/externalLanguages/languagesTable.ts +++ b/extensions/machine-learning/src/views/externalLanguages/languagesTable.ts @@ -138,7 +138,7 @@ export class LanguagesTable extends LanguageViewBase { let editLanguageButton = this._modelBuilder.button().withProperties({ label: '', - title: constants.deleteTitle, + title: constants.editTitle, iconPath: { dark: this.asAbsolutePath('images/dark/edit_inverse.svg'), light: this.asAbsolutePath('images/light/edit.svg') diff --git a/extensions/machine-learning/src/views/models/manageModels/currentModelsTable.ts b/extensions/machine-learning/src/views/models/manageModels/currentModelsTable.ts index 3216f12e76..2649caf60e 100644 --- a/extensions/machine-learning/src/views/models/manageModels/currentModelsTable.ts +++ b/extensions/machine-learning/src/views/models/manageModels/currentModelsTable.ts @@ -287,7 +287,7 @@ export class CurrentModelsTable extends ModelViewBase implements IDataComponent< editButton = this._modelBuilder.button().withProperties({ label: '', - title: constants.deleteTitle, + title: constants.editTitle, iconPath: { dark: this.asAbsolutePath('images/dark/edit_inverse.svg'), light: this.asAbsolutePath('images/light/edit.svg') diff --git a/extensions/machine-learning/src/views/models/prediction/predictWizard.ts b/extensions/machine-learning/src/views/models/prediction/predictWizard.ts index dae96f9dfa..10fc50a876 100644 --- a/extensions/machine-learning/src/views/models/prediction/predictWizard.ts +++ b/extensions/machine-learning/src/views/models/prediction/predictWizard.ts @@ -40,6 +40,7 @@ export class PredictWizard extends ModelViewBase { * Opens a dialog to manage packages used by notebooks. */ public async open(): Promise { + this.modelSourceType = ModelSourceType.RegisteredModels; this.modelSourcePage = new ModelSourcePage(this._apiWrapper, this, [ModelSourceType.RegisteredModels, ModelSourceType.Local, ModelSourceType.Azure]); this.columnsSelectionPage = new ColumnsSelectionPage(this._apiWrapper, this); this.modelBrowsePage = new ModelBrowsePage(this._apiWrapper, this, false);