mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 02:48:30 -05:00
Machine Learning Services R Packages (#8870)
* R Package management in Machine learning services extension
This commit is contained in:
@@ -13,9 +13,10 @@ import * as constants from '../common/constants';
|
||||
import { ApiWrapper } from '../common/apiWrapper';
|
||||
import { QueryRunner } from '../common/queryRunner';
|
||||
import { ProcessService } from '../common/processService';
|
||||
import { Config } from '../common/config';
|
||||
import { Config } from '../configurations/config';
|
||||
import { ServerConfigWidget } from '../widgets/serverConfigWidgets';
|
||||
import { ServerConfigManager } from '../serverConfig/serverConfigManager';
|
||||
import { HttpClient } from '../common/httpClient';
|
||||
|
||||
/**
|
||||
* The main controller class that initializes the extension
|
||||
@@ -31,11 +32,12 @@ export default class MainController implements vscode.Disposable {
|
||||
private _queryRunner: QueryRunner,
|
||||
private _processService: ProcessService,
|
||||
private _packageManager?: PackageManager,
|
||||
private _serverConfigManager?: ServerConfigManager
|
||||
private _serverConfigManager?: ServerConfigManager,
|
||||
private _httpClient?: HttpClient
|
||||
) {
|
||||
this._outputChannel = this._apiWrapper.createOutputChannel(constants.extensionOutputChannel);
|
||||
this._rootPath = this._context.extensionPath;
|
||||
this._config = new Config(this._rootPath);
|
||||
this._config = new Config(this._rootPath, this._apiWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,6 +80,9 @@ export default class MainController implements vscode.Disposable {
|
||||
this._apiWrapper.registerCommand(constants.mlManagePackagesCommand, (async () => {
|
||||
await packageManager.managePackages();
|
||||
}));
|
||||
this._apiWrapper.registerCommand(constants.mlsDependenciesCommand, (async () => {
|
||||
await packageManager.installDependencies();
|
||||
}));
|
||||
this._apiWrapper.registerTaskHandler(constants.mlManagePackagesCommand, async () => {
|
||||
await packageManager.managePackages();
|
||||
});
|
||||
@@ -87,12 +92,6 @@ export default class MainController implements vscode.Disposable {
|
||||
this._apiWrapper.registerTaskHandler(constants.mlsDocumentsCommand, async () => {
|
||||
await this.serverConfigManager.openDocuments();
|
||||
});
|
||||
|
||||
try {
|
||||
await packageManager.installDependencies();
|
||||
} catch (err) {
|
||||
this._outputChannel.appendLine(err);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,15 +99,18 @@ export default class MainController implements vscode.Disposable {
|
||||
*/
|
||||
public getPackageManager(nbApis: nbExtensionApis.IExtensionApi): PackageManager {
|
||||
if (!this._packageManager) {
|
||||
this._packageManager = new PackageManager(nbApis, this._outputChannel, this._rootPath, this._apiWrapper, this._queryRunner, this._processService, this._config);
|
||||
this._packageManager = new PackageManager(this._outputChannel, this._rootPath, this._apiWrapper, this._queryRunner, this._processService, this._config, this.httpClient);
|
||||
this._packageManager.init();
|
||||
this._packageManager.packageManageProviders.forEach(provider => {
|
||||
nbApis.registerPackageManager(provider.providerId, provider);
|
||||
});
|
||||
}
|
||||
return this._packageManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the server config manager instance
|
||||
*/
|
||||
* Returns the server config manager instance
|
||||
*/
|
||||
public get serverConfigManager(): ServerConfigManager {
|
||||
if (!this._serverConfigManager) {
|
||||
this._serverConfigManager = new ServerConfigManager(this._apiWrapper, this._queryRunner);
|
||||
@@ -116,6 +118,17 @@ export default class MainController implements vscode.Disposable {
|
||||
return this._serverConfigManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the server config manager instance
|
||||
*/
|
||||
public get httpClient(): HttpClient {
|
||||
if (!this._httpClient) {
|
||||
this._httpClient = new HttpClient();
|
||||
}
|
||||
return this._httpClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Config instance
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user