Skip to content

Commit

Permalink
ML- Fixed the issue with wrong title in predict page (microsoft#10467)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
llali authored May 19, 2020
1 parent c98eaaf commit f73d81b
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 49 deletions.
44 changes: 23 additions & 21 deletions extensions/machine-learning/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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": [
Expand All @@ -109,7 +111,7 @@
"col": 0,
"widget": {
"tasks-widget": [
"mls.command.managePackages"
"ml.command.managePackages"
]
}
},
Expand Down
24 changes: 12 additions & 12 deletions extensions/machine-learning/package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
21 changes: 11 additions & 10 deletions extensions/machine-learning/src/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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
Expand Down Expand Up @@ -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");
Expand All @@ -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.");
Expand Down
2 changes: 1 addition & 1 deletion extensions/machine-learning/src/common/processService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[]) => {
Expand Down Expand Up @@ -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[]) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export class PredictWizard extends ModelViewBase {
* Opens a dialog to manage packages used by notebooks.
*/
public async open(): Promise<void> {
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);
Expand Down

0 comments on commit f73d81b

Please sign in to comment.