Reset scheduling parameters CPU/mem request/limit to defaults (#14492)

* reset scheduling parameters

* Added right quotation marks

* Fixed comment

* Worker text box needs to have value, can't pass in emptry string

* Fixed ConfigurationSpecModel and added doc comment to handleOnTextChanged

* Add to information bubbles that user can reset scheduling parameters by passing in empty value

* Changed name of handleOnTextChanged
This commit is contained in:
nasc17
2021-03-02 16:15:40 -08:00
committed by GitHub
parent 18bdb0f37d
commit 1e67388653
2 changed files with 223 additions and 196 deletions

View File

@@ -68,9 +68,9 @@ export const feedback = localize('arc.feedback', "Feedback");
export const selectConnectionString = localize('arc.selectConnectionString', "Select from available client connection strings below."); export const selectConnectionString = localize('arc.selectConnectionString', "Select from available client connection strings below.");
export const addingWorkerNodes = localize('arc.addingWorkerNodes', "adding worker nodes"); export const addingWorkerNodes = localize('arc.addingWorkerNodes', "adding worker nodes");
export const workerNodesDescription = localize('arc.workerNodesDescription', "Expand your server group and scale your database by adding worker nodes."); export const workerNodesDescription = localize('arc.workerNodesDescription', "Expand your server group and scale your database by adding worker nodes.");
export const postgresConfigurationInformation = localize('arc.postgres.configurationInformation', "You can configure the number of CPU cores and storage size that will apply to both worker nodes and coordinator node. Each worker node will have the same configuration. Adjust the number of CPU cores and memory settings for your server group."); export const postgresConfigurationInformation = localize('arc.postgres.configurationInformation', "You can configure the number of CPU cores and storage size that will apply to both worker nodes and coordinator node. Each worker node will have the same configuration. Adjust the number of CPU cores and memory settings for your server group. To reset the requests and/or limits, pass in empty value.");
export const workerNodesConfigurationInformation = localize('arc.workerNodesConfigurationInformation', "You can configure the number of CPU cores and storage size that will apply to all worker nodes. Adjust the number of CPU cores and memory settings for your server group."); export const workerNodesConfigurationInformation = localize('arc.workerNodesConfigurationInformation', "You can configure the number of CPU cores and storage size that will apply to all worker nodes. Adjust the number of CPU cores and memory settings for your server group. To reset the requests and/or limits, pass in empty value.");
export const coordinatorNodeConfigurationInformation = localize('arc.coordinatorNodeConfigurationInformation', "You can configure the number of CPU cores and storage size that will apply to the coordinator node. Adjust the number of CPU cores and memory settings for your server group."); export const coordinatorNodeConfigurationInformation = localize('arc.coordinatorNodeConfigurationInformation', "You can configure the number of CPU cores and storage size that will apply to the coordinator node. Adjust the number of CPU cores and memory settings for your server group. To reset the requests and/or limits, pass in empty value.");
export const workerNodesInformation = localize('arc.workerNodeInformation', "In preview it is not possible to reduce the number of worker nodes. Please refer to documentation linked above for more information."); export const workerNodesInformation = localize('arc.workerNodeInformation', "In preview it is not possible to reduce the number of worker nodes. Please refer to documentation linked above for more information.");
export const vCores = localize('arc.vCores', "vCores"); export const vCores = localize('arc.vCores', "vCores");
export const ram = localize('arc.ram', "RAM"); export const ram = localize('arc.ram', "RAM");

View File

@@ -12,6 +12,18 @@ import { DashboardPage } from '../../components/dashboardPage';
import { PostgresModel } from '../../../models/postgresModel'; import { PostgresModel } from '../../../models/postgresModel';
import { convertToGibibyteString } from '../../../common/utils'; import { convertToGibibyteString } from '../../../common/utils';
export type ConfigurationSpecModel = {
workers?: number,
workerCoresRequest?: string,
workerCoresLimit?: string,
workerMemoryRequest?: string,
workerMemoryLimit?: string,
coordinatorCoresRequest?: string,
coordinatorCoresLimit?: string,
coordinatorMemoryRequest?: string,
coordinatorMemoryLimit?: string
};
export class PostgresComputeAndStoragePage extends DashboardPage { export class PostgresComputeAndStoragePage extends DashboardPage {
private workerContainer!: azdata.DivContainer; private workerContainer!: azdata.DivContainer;
private coordinatorContainer!: azdata.DivContainer; private coordinatorContainer!: azdata.DivContainer;
@@ -27,24 +39,12 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
private coordinatorMemoryLimitBox!: azdata.InputBoxComponent; private coordinatorMemoryLimitBox!: azdata.InputBoxComponent;
private coordinatorMemoryRequestBox!: azdata.InputBoxComponent; private coordinatorMemoryRequestBox!: azdata.InputBoxComponent;
private currentConfiguration: ConfigurationSpecModel = {};
private saveArgs: ConfigurationSpecModel = {};
private discardButton!: azdata.ButtonComponent; private discardButton!: azdata.ButtonComponent;
private saveButton!: azdata.ButtonComponent; private saveButton!: azdata.ButtonComponent;
private saveWorkerArgs: {
workers?: number,
coresLimit?: string,
coresRequest?: string,
memoryLimit?: string,
memoryRequest?: string
} = {};
private saveCoordinatorArgs: {
coresLimit?: string,
coresRequest?: string,
memoryLimit?: string,
memoryRequest?: string
} = {};
private readonly _azdataApi: azdataExt.IExtension; private readonly _azdataApi: azdataExt.IExtension;
constructor(protected modelView: azdata.ModelView, private _postgresModel: PostgresModel) { constructor(protected modelView: azdata.ModelView, private _postgresModel: PostgresModel) {
@@ -184,7 +184,13 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
session = await this._postgresModel.controllerModel.acquireAzdataSession(); session = await this._postgresModel.controllerModel.acquireAzdataSession();
await this._azdataApi.azdata.arc.postgres.server.edit( await this._azdataApi.azdata.arc.postgres.server.edit(
this._postgresModel.info.name, this._postgresModel.info.name,
this.saveWorkerArgs, {
workers: this.saveArgs.workers,
coresRequest: this.saveArgs.workerCoresRequest,
coresLimit: this.saveArgs.workerCoresLimit,
memoryRequest: this.saveArgs.workerMemoryRequest,
memoryLimit: this.saveArgs.workerMemoryLimit
},
this._postgresModel.engineVersion, this._postgresModel.engineVersion,
this._postgresModel.controllerModel.azdataAdditionalEnvVars, this._postgresModel.controllerModel.azdataAdditionalEnvVars,
session session
@@ -192,7 +198,12 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
/* TODO add second edit call for coordinator configuration /* TODO add second edit call for coordinator configuration
await this._azdataApi.azdata.arc.postgres.server.edit( await this._azdataApi.azdata.arc.postgres.server.edit(
this._postgresModel.info.name, this._postgresModel.info.name,
this.saveCoordinatorArgs, {
coresRequest: this.saveArgs.coordinatorCoresRequest,
coresLimit: this.saveArgs.coordinatorCoresLimit,
memoryRequest: this.saveArgs.coordinatorMemoryRequest,
memoryLimit: this.saveArgs.coordinatorMemoryLimit
},
this._postgresModel.engineVersion, this._postgresModel.engineVersion,
this._postgresModel.controllerModel.azdataAdditionalEnvVars, this._postgresModel.controllerModel.azdataAdditionalEnvVars,
session session
@@ -230,7 +241,11 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
this.discardButton.onDidClick(async () => { this.discardButton.onDidClick(async () => {
this.discardButton!.enabled = false; this.discardButton!.enabled = false;
try { try {
this.handleServiceUpdated(); this.workerBox!.value = this.currentConfiguration.workers!.toString();
this.workerCoresRequestBox!.value = this.currentConfiguration.workerCoresRequest;
this.workerCoresLimitBox!.value = this.currentConfiguration.workerCoresLimit;
this.workerMemoryRequestBox!.value = this.currentConfiguration.workerMemoryRequest;
this.workerMemoryLimitBox!.value = this.currentConfiguration.workerMemoryLimit;
} catch (error) { } catch (error) {
vscode.window.showErrorMessage(loc.pageDiscardFailed(error)); vscode.window.showErrorMessage(loc.pageDiscardFailed(error));
} finally { } finally {
@@ -245,57 +260,26 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
} }
private initializeConfigurationBoxes(): void { private initializeConfigurationBoxes(): void {
// Worker node count
this.workerBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ this.workerBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false, readOnly: false,
validationErrorMessage: loc.workerValidationErrorMessage, validationErrorMessage: loc.workerValidationErrorMessage,
inputType: 'number', inputType: 'number',
placeHolder: loc.loading placeHolder: loc.loading,
required: true
}).component(); }).component();
this.disposables.push( this.disposables.push(
this.workerBox.onTextChanged(() => { this.workerBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.workerBox!))) { if (!this.saveValueToEdit(this.workerBox!, this.currentConfiguration.workers!.toString())) {
this.saveWorkerArgs.workers = undefined; this.saveArgs.workers = undefined;
} else { } else {
this.saveWorkerArgs.workers = parseInt(this.workerBox!.value!); this.saveArgs.workers = parseInt(this.workerBox!.value!);
}
})
);
this.workerCoresLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.workerCoresLimitBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.workerCoresLimitBox!))) {
this.saveWorkerArgs.coresLimit = undefined;
} else {
this.saveWorkerArgs.coresLimit = this.workerCoresLimitBox!.value;
}
})
);
this.coordinatorCoresLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.coordinatorCoresLimitBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coordinatorCoresLimitBox!))) {
this.saveCoordinatorArgs.coresLimit = undefined;
} else {
this.saveCoordinatorArgs.coresLimit = this.coordinatorCoresLimitBox!.value;
} }
}) })
); );
// Worker nodes cores request
this.workerCoresRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ this.workerCoresRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false, readOnly: false,
min: 1, min: 1,
@@ -305,15 +289,16 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
this.disposables.push( this.disposables.push(
this.workerCoresRequestBox.onTextChanged(() => { this.workerCoresRequestBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.workerCoresRequestBox!))) { if (!(this.saveValueToEdit(this.workerCoresRequestBox!, this.currentConfiguration.workerCoresRequest!))) {
this.saveWorkerArgs.coresRequest = undefined; this.saveArgs.workerCoresRequest = undefined;
} else { } else {
this.saveWorkerArgs.coresRequest = this.workerCoresRequestBox!.value; this.saveArgs.workerCoresRequest = this.workerCoresRequestBox!.value;
} }
}) })
); );
this.coordinatorCoresRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ // Worker nodes cores limit
this.workerCoresLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false, readOnly: false,
min: 1, min: 1,
inputType: 'number', inputType: 'number',
@@ -321,51 +306,16 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
}).component(); }).component();
this.disposables.push( this.disposables.push(
this.coordinatorCoresRequestBox.onTextChanged(() => { this.workerCoresLimitBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coordinatorCoresRequestBox!))) { if (!(this.saveValueToEdit(this.workerCoresLimitBox!, this.currentConfiguration.workerCoresLimit!))) {
this.saveCoordinatorArgs.coresRequest = undefined; this.saveArgs.workerCoresLimit = undefined;
} else { } else {
this.saveCoordinatorArgs.coresRequest = this.coordinatorCoresRequestBox!.value; this.saveArgs.workerCoresLimit = this.workerCoresLimitBox!.value;
}
})
);
this.workerMemoryLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 0.25,
validationErrorMessage: loc.memoryLimitValidationErrorMessage,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.workerMemoryLimitBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.workerMemoryLimitBox!))) {
this.saveWorkerArgs.memoryLimit = undefined;
} else {
this.saveWorkerArgs.memoryLimit = this.workerMemoryLimitBox!.value + 'Gi';
}
})
);
this.coordinatorMemoryLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 0.25,
validationErrorMessage: loc.memoryLimitValidationErrorMessage,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.coordinatorMemoryLimitBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coordinatorMemoryLimitBox!))) {
this.saveCoordinatorArgs.memoryLimit = undefined;
} else {
this.saveCoordinatorArgs.memoryLimit = this.coordinatorMemoryLimitBox!.value + 'Gi';
} }
}) })
); );
// Worker nodes memory request
this.workerMemoryRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ this.workerMemoryRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false, readOnly: false,
min: 0.25, min: 0.25,
@@ -376,14 +326,74 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
this.disposables.push( this.disposables.push(
this.workerMemoryRequestBox.onTextChanged(() => { this.workerMemoryRequestBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.workerMemoryRequestBox!))) { if (!(this.saveValueToEdit(this.workerMemoryRequestBox!, this.currentConfiguration.workerMemoryRequest!))) {
this.saveWorkerArgs.memoryRequest = undefined; this.saveArgs.workerMemoryRequest = undefined;
} else if (this.workerMemoryRequestBox!.value === '') {
this.saveArgs.workerMemoryRequest = '""';
} else { } else {
this.saveWorkerArgs.memoryRequest = this.workerMemoryRequestBox!.value + 'Gi'; this.saveArgs.workerMemoryRequest = this.workerMemoryRequestBox!.value + 'Gi';
} }
}) })
); );
// Worker nodes memory limit
this.workerMemoryLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 0.25,
validationErrorMessage: loc.memoryLimitValidationErrorMessage,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.workerMemoryLimitBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.workerMemoryLimitBox!, this.currentConfiguration.workerMemoryLimit!))) {
this.saveArgs.workerMemoryLimit = undefined;
} else if (this.workerMemoryLimitBox!.value === '""') {
this.saveArgs.workerMemoryLimit = this.workerMemoryLimitBox!.value;
} else {
this.saveArgs.workerMemoryLimit = this.workerMemoryLimitBox!.value + 'Gi';
}
})
);
// Coordinator node cores request
this.coordinatorCoresRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.coordinatorCoresRequestBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.coordinatorCoresRequestBox!, this.currentConfiguration.coordinatorCoresRequest!))) {
this.saveArgs.coordinatorCoresRequest = undefined;
} else {
this.saveArgs.coordinatorCoresRequest = this.coordinatorCoresRequestBox!.value;
}
})
);
// Coordinator node cores limit
this.coordinatorCoresLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 1,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.coordinatorCoresLimitBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.coordinatorCoresLimitBox!, this.currentConfiguration.coordinatorCoresLimit!))) {
this.saveArgs.coordinatorCoresLimit = undefined;
} else {
this.saveArgs.coordinatorCoresLimit = this.coordinatorCoresLimitBox!.value;
}
})
);
// Coordinator node memory request
this.coordinatorMemoryRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({ this.coordinatorMemoryRequestBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false, readOnly: false,
min: 0.25, min: 0.25,
@@ -394,14 +404,36 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
this.disposables.push( this.disposables.push(
this.coordinatorMemoryRequestBox.onTextChanged(() => { this.coordinatorMemoryRequestBox.onTextChanged(() => {
if (!(this.handleOnTextChanged(this.coordinatorMemoryRequestBox!))) { if (!(this.saveValueToEdit(this.coordinatorMemoryRequestBox!, this.currentConfiguration.coordinatorMemoryRequest!))) {
this.saveCoordinatorArgs.memoryRequest = undefined; this.saveArgs.coordinatorMemoryRequest = undefined;
} else if (this.coordinatorMemoryRequestBox!.value === '') {
this.saveArgs.coordinatorMemoryRequest = '""';
} else { } else {
this.saveCoordinatorArgs.memoryRequest = this.coordinatorMemoryRequestBox!.value + 'Gi'; this.saveArgs.coordinatorMemoryRequest = this.coordinatorMemoryRequestBox!.value + 'Gi';
} }
}) })
); );
// Coordinator node memory limit
this.coordinatorMemoryLimitBox = this.modelView.modelBuilder.inputBox().withProperties<azdata.InputBoxProperties>({
readOnly: false,
min: 0.25,
validationErrorMessage: loc.memoryLimitValidationErrorMessage,
inputType: 'number',
placeHolder: loc.loading
}).component();
this.disposables.push(
this.coordinatorMemoryLimitBox.onTextChanged(() => {
if (!(this.saveValueToEdit(this.coordinatorMemoryLimitBox!, this.currentConfiguration.coordinatorMemoryLimit!))) {
this.saveArgs.coordinatorMemoryLimit = undefined;
} else if (this.coordinatorMemoryLimitBox!.value === '') {
this.saveArgs.coordinatorMemoryLimit = '""';
} else {
this.saveArgs.coordinatorMemoryLimit = this.coordinatorMemoryLimitBox!.value + 'Gi';
}
})
);
} }
private createUserInputWorkerSection(): azdata.Component[] { private createUserInputWorkerSection(): azdata.Component[] {
@@ -500,19 +532,25 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
return flexContainer; return flexContainer;
} }
private handleOnTextChanged(component: azdata.InputBoxComponent): boolean { /**
if ((!component.value)) { * A function that determines if an input box's value should be considered or not.
// if there is no text found in the inputbox component return false * Tiggers the save and discard buttons to become enabled depnding on the value change.
*
* If new value is the same as value found in config, do not consider this new value for editing.
* If new value is invalid, do not consider this new value for editing and enable discard button.
* If value is valid and not equal to original value found in config, add this new value to be considered
* for editing and enable save/discard buttons.
*
* @param component The input box that had an onTextChanged event triggered.
* @param originalValue The value that was contained in the input box before user interaction.
* @return A boolean that reads true if the new value should be taken in for editing or not.
*/
private saveValueToEdit(component: azdata.InputBoxComponent, originalValue: string): boolean {
if (component.value === originalValue) {
return false; return false;
} else if ((!component.valid)) { } else if ((!component.valid)) {
// if value given by user is not valid enable discard button for user
// to clear all inputs and return false
this.discardButton!.enabled = true;
return false; return false;
} else { } else {
// if a valid value has been entered into the input box, enable save and discard buttons
// so that user could choose to either edit instance or clear all inputs
// return true
this.saveButton!.enabled = true; this.saveButton!.enabled = true;
this.discardButton!.enabled = true; this.discardButton!.enabled = true;
return true; return true;
@@ -522,13 +560,12 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
private editWorkerNodeCount(): void { private editWorkerNodeCount(): void {
// scale.shards was renamed to scale.workers. Check both for backwards compatibility. // scale.shards was renamed to scale.workers. Check both for backwards compatibility.
let scale = this._postgresModel.config?.spec.scale; let scale = this._postgresModel.config?.spec.scale;
let currentWorkers = scale?.workers ?? scale?.shards ?? 0; this.currentConfiguration.workers = scale?.workers ?? scale?.shards ?? 0;
this.workerBox!.min = currentWorkers; this.workerBox!.min = this.currentConfiguration.workers;
this.workerBox!.placeHolder = currentWorkers.toString(); this.workerBox!.placeHolder = '';
this.workerBox!.value = ''; this.workerBox!.value = this.currentConfiguration.workers.toString();
this.saveArgs.workers = undefined;
this.saveWorkerArgs.workers = undefined;
} }
private createCoresMemorySection(title: string, description: string): azdata.DivContainer { private createCoresMemorySection(title: string, description: string): azdata.DivContainer {
@@ -565,113 +602,103 @@ export class PostgresComputeAndStoragePage extends DashboardPage {
} }
private editWorkerCores(): void { private editWorkerCores(): void {
let currentCPUSize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu; //Cores Request
this.currentConfiguration.workerCoresRequest = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu;
if (!currentCPUSize) { if (!this.currentConfiguration.workerCoresRequest) {
currentCPUSize = ''; this.currentConfiguration.workerCoresRequest = '';
} }
this.workerCoresRequestBox!.validationErrorMessage = loc.validationMin(this.workerCoresRequestBox!.min!); this.workerCoresRequestBox!.validationErrorMessage = loc.validationMin(this.workerCoresRequestBox!.min!);
this.workerCoresRequestBox!.placeHolder = currentCPUSize; this.workerCoresRequestBox!.placeHolder = '';
this.workerCoresRequestBox!.value = ''; this.workerCoresRequestBox!.value = this.currentConfiguration.workerCoresRequest;
this.saveWorkerArgs.coresRequest = undefined; this.saveArgs.workerCoresRequest = undefined;
currentCPUSize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu; // Cores Limit
this.currentConfiguration.workerCoresLimit = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu;
if (!currentCPUSize) { if (!this.currentConfiguration.workerCoresLimit) {
currentCPUSize = ''; this.currentConfiguration.workerCoresLimit = '';
} }
this.workerCoresLimitBox!.validationErrorMessage = loc.validationMin(this.workerCoresLimitBox!.min!); this.workerCoresLimitBox!.validationErrorMessage = loc.validationMin(this.workerCoresLimitBox!.min!);
this.workerCoresLimitBox!.placeHolder = currentCPUSize; this.workerCoresLimitBox!.placeHolder = '';
this.workerCoresLimitBox!.value = ''; this.workerCoresLimitBox!.value = this.currentConfiguration.workerCoresLimit;
this.saveWorkerArgs.coresLimit = undefined; this.saveArgs.workerCoresLimit = undefined;
}
private editWorkerMemory(): void {
//Memory Request
let currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory;
if (!currentMemorySize) {
this.currentConfiguration.workerMemoryRequest = '';
} else {
this.currentConfiguration.workerMemoryRequest = convertToGibibyteString(currentMemorySize);
}
this.workerMemoryRequestBox!.placeHolder = '';
this.workerMemoryRequestBox!.value = this.currentConfiguration.workerMemoryRequest;
this.saveArgs.workerMemoryRequest = undefined;
//Memory Limit
currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory;
if (!currentMemorySize) {
this.currentConfiguration.workerMemoryLimit = '';
} else {
this.currentConfiguration.workerMemoryLimit = convertToGibibyteString(currentMemorySize);
}
this.workerMemoryLimitBox!.placeHolder = '';
this.workerMemoryLimitBox!.value = this.currentConfiguration.workerMemoryLimit;
this.saveArgs.workerMemoryLimit = undefined;
} }
private editCoordinatorCores(): void { private editCoordinatorCores(): void {
// TODO get current cpu size for coordinator // TODO get current cpu size for coordinator
let currentCPUSize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu; this.currentConfiguration.coordinatorCoresRequest = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.cpu;
if (!this.currentConfiguration.coordinatorCoresRequest) {
if (!currentCPUSize) { this.currentConfiguration.coordinatorCoresRequest = '';
currentCPUSize = '';
} }
this.coordinatorCoresRequestBox!.validationErrorMessage = loc.validationMin(this.coordinatorCoresRequestBox!.min!); this.coordinatorCoresRequestBox!.validationErrorMessage = loc.validationMin(this.coordinatorCoresRequestBox!.min!);
this.coordinatorCoresRequestBox!.placeHolder = currentCPUSize; this.coordinatorCoresRequestBox!.placeHolder = '';
this.coordinatorCoresRequestBox!.value = ''; this.coordinatorCoresRequestBox!.value = this.currentConfiguration.coordinatorCoresRequest;
this.saveCoordinatorArgs.coresRequest = undefined; this.saveArgs.coordinatorCoresRequest = undefined;
// TODO get current cpu size for coordinator // TODO get current cpu size for coordinator
currentCPUSize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu; this.currentConfiguration.coordinatorCoresLimit = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.cpu;
if (!this.currentConfiguration.coordinatorCoresLimit) {
if (!currentCPUSize) { this.currentConfiguration.coordinatorCoresLimit = '';
currentCPUSize = '';
} }
this.coordinatorCoresLimitBox!.validationErrorMessage = loc.validationMin(this.coordinatorCoresLimitBox!.min!); this.coordinatorCoresLimitBox!.validationErrorMessage = loc.validationMin(this.coordinatorCoresLimitBox!.min!);
this.coordinatorCoresLimitBox!.placeHolder = currentCPUSize; this.coordinatorCoresLimitBox!.placeHolder = '';
this.coordinatorCoresLimitBox!.value = ''; this.coordinatorCoresLimitBox!.value = this.currentConfiguration.coordinatorCoresLimit;
this.saveCoordinatorArgs.coresLimit = undefined; this.saveArgs.coordinatorCoresLimit = undefined;
}
private editWorkerMemory(): void {
let currentMemSizeConversion: string;
let currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory;
if (!currentMemorySize) {
currentMemSizeConversion = '';
} else {
currentMemSizeConversion = convertToGibibyteString(currentMemorySize);
}
this.workerMemoryRequestBox!.placeHolder = currentMemSizeConversion!;
this.workerMemoryRequestBox!.value = '';
this.saveWorkerArgs.memoryRequest = undefined;
currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory;
if (!currentMemorySize) {
currentMemSizeConversion = '';
} else {
currentMemSizeConversion = convertToGibibyteString(currentMemorySize);
}
this.workerMemoryLimitBox!.placeHolder = currentMemSizeConversion!;
this.workerMemoryLimitBox!.value = '';
this.saveWorkerArgs.memoryLimit = undefined;
} }
private editCoordinatorMemory(): void { private editCoordinatorMemory(): void {
let currentMemSizeConversion: string;
// TODO get current memory size for coordinator // TODO get current memory size for coordinator
let currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory; let currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.requests?.memory;
if (!currentMemorySize) { if (!currentMemorySize) {
currentMemSizeConversion = ''; this.currentConfiguration.coordinatorCoresRequest = '';
} else { } else {
currentMemSizeConversion = convertToGibibyteString(currentMemorySize); this.currentConfiguration.coordinatorCoresRequest = convertToGibibyteString(currentMemorySize);
} }
this.coordinatorMemoryRequestBox!.placeHolder = currentMemSizeConversion!; this.coordinatorMemoryRequestBox!.placeHolder = '';
this.coordinatorMemoryRequestBox!.value = ''; this.coordinatorMemoryRequestBox!.value = this.currentConfiguration.coordinatorMemoryRequest;
this.saveArgs.coordinatorMemoryRequest = undefined;
this.saveCoordinatorArgs.memoryRequest = undefined;
// TODO get current memory size for coordinator // TODO get current memory size for coordinator
currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory; currentMemorySize = this._postgresModel.config?.spec.scheduling?.default?.resources?.limits?.memory;
if (!currentMemorySize) { if (!currentMemorySize) {
currentMemSizeConversion = ''; this.currentConfiguration.coordinatorCoresLimit = '';
} else { } else {
currentMemSizeConversion = convertToGibibyteString(currentMemorySize); this.currentConfiguration.coordinatorCoresLimit = convertToGibibyteString(currentMemorySize);
} }
this.coordinatorMemoryLimitBox!.placeHolder = currentMemSizeConversion!; this.coordinatorMemoryLimitBox!.placeHolder = '';
this.coordinatorMemoryLimitBox!.value = ''; this.coordinatorMemoryLimitBox!.value = this.currentConfiguration.coordinatorMemoryLimit;
this.saveArgs.coordinatorMemoryLimit = undefined;
this.saveCoordinatorArgs.memoryLimit = undefined;
} }
private handleServiceUpdated(): void { private handleServiceUpdated(): void {