Skip to content

Commit 90ae674

Browse files
authored
chore(jupyter): Remove GPU from form (#327)
1 parent d49a982 commit 90ae674

File tree

6 files changed

+7
-93
lines changed

6 files changed

+7
-93
lines changed

frontend/jupyter/cypress/e2e/form-page.cy.ts

+3-62
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
describe('New notebook form', () => {
22
beforeEach(() => {
33
cy.mockDashboardRequest();
4-
cy.mockGpusRequest();
54
cy.mockConfigRequest();
65
cy.fixture('settings').then(settings => {
76
cy.mockNotebooksRequest(settings.namespace);
@@ -13,7 +12,6 @@ describe('New notebook form', () => {
1312
cy.visit('/new');
1413
cy.wait([
1514
'@mockDashboardRequest',
16-
'@mockGpusRequest',
1715
'@mockConfigRequest',
1816
'@mockNotebooksRequest',
1917
'@mockPoddefaultsRequest',
@@ -689,22 +687,15 @@ describe('New notebook form', () => {
689687
cy.get('[data-cy-form-input="memory"]')
690688
.find('input')
691689
.invoke('val')
692-
.should('eq', '2.0');
690+
.should('eq', '2');
693691
cy.get('[data-cy-form-input="cpuLimit"]')
694692
.find('input')
695693
.invoke('val')
696-
.should('eq', '4.0');
694+
.should('eq', '4');
697695
cy.get('[data-cy-form-input="memoryLimit"]')
698696
.find('input')
699697
.invoke('val')
700-
.should('eq', '4.0');
701-
702-
cy.get('[data-cy-form-input="gpus"]')
703-
.find('.mat-mdc-select-value')
704-
.should('have.text', 'None');
705-
cy.get('[data-cy-form-input="vendor"]')
706-
.find('.mat-mdc-select-value')
707-
.should('have.text', 'NVIDIA');
698+
.should('eq', '4');
708699

709700
cy.get(
710701
'[data-cy-form-input="workspaceVolume"] > mat-expansion-panel',
@@ -784,56 +775,6 @@ describe('New notebook form', () => {
784775
).should('be.disabled');
785776
});
786777

787-
it('should create a jupyter GPU notebook', () => {
788-
cy.get('lib-name-input[resourcename="Notebook Server"]')
789-
.find('input')
790-
.type('test-notebook-gpu');
791-
cy.get('[data-cy-advanced-options-button]').click();
792-
// select different jupyter image
793-
cy.get('[data-cy-form-input="serverImage"]').click();
794-
cy.get('[role="listbox"] > mat-option')
795-
.contains('jupyterlab-tensorflow')
796-
.click();
797-
// set a gpu
798-
cy.get('[data-cy-form-input="vendor"]')
799-
.find('mat-select')
800-
.should('have.class', 'mat-mdc-select-disabled');
801-
cy.get('[data-cy-form-input="gpus"]').click();
802-
cy.get('[role="listbox"] > mat-option').should('have.length', 2);
803-
cy.get('[role="listbox"] > mat-option').contains('1').click();
804-
cy.get('[data-cy-form-input="vendor"]')
805-
.find('mat-select')
806-
.should('not.have.class', 'mat-mdc-select-disabled');
807-
cy.get('[data-cy-form-input="vendor"]').click();
808-
cy.get('[role="listbox"] > mat-option').should('have.length', 1);
809-
cy.get('[role="listbox"] > mat-option').contains('NVIDIA').click();
810-
cy.get('[data-cy-form-input="cpu"]')
811-
.find('input')
812-
.invoke('val')
813-
.should('eq', '4.0');
814-
cy.get('[data-cy-form-input="memory"]')
815-
.find('input')
816-
.invoke('val')
817-
.should('eq', '96.0');
818-
cy.get('[data-cy-form-input="cpuLimit"]')
819-
.find('input')
820-
.invoke('val')
821-
.should('eq', '4.0');
822-
cy.get('[data-cy-form-input="memoryLimit"]')
823-
.find('input')
824-
.invoke('val')
825-
.should('eq', '96.0');
826-
// submit the notebook
827-
cy.get('[data-cy-form-button="submit"]').should('be.enabled');
828-
cy.intercept('POST', 'api/namespaces/kubeflow-user/notebooks', {
829-
success: true,
830-
status: 200,
831-
}).as('mockSubmitNotebook');
832-
cy.get('[data-cy-form-button="submit"]').click();
833-
cy.wait('@mockSubmitNotebook');
834-
cy.url().should('eq', 'http://localhost:4200/');
835-
});
836-
837778
it('should create a custom image notebook', () => {
838779
cy.get('lib-name-input[resourcename="Notebook Server"]')
839780
.find('input')

frontend/jupyter/cypress/support/commands.ts

-9
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ Cypress.Commands.add('mockDefaultStorageClassRequest', () => {
7373
}).as('mockDefaultStorageClassRequest');
7474
});
7575

76-
Cypress.Commands.add('mockGpusRequest', () => {
77-
cy.intercept('GET', '/api/gpus', {
78-
success: true,
79-
status: 200,
80-
user: null,
81-
vendors: ['nvidia.com/gpu'],
82-
}).as('mockGpusRequest');
83-
});
84-
8576
Cypress.Commands.add('mockConfigRequest', () => {
8677
cy.intercept('GET', '/api/config', {
8778
fixture: 'config',

frontend/jupyter/cypress/support/e2e.ts

-11
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,6 @@ declare global {
5151
*/
5252
mockDefaultStorageClassRequest(): Chainable<void>;
5353

54-
/**
55-
* Custom command to mock requests at '/api/gpus'
56-
* and returns an object with empty vendors list [].
57-
*/
58-
mockGpusRequest(): Chainable<void>;
59-
60-
/**
61-
* Custom command to mock requests at '/api/config'
62-
*/
63-
mockConfigRequest(): Chainable<void>;
64-
6554
/**
6655
* Custom command to mock request at '/api/namespaces/<namespace>/poddefaults'
6756
* and returns a mock array of PodDefaults for the given namespace

frontend/jupyter/src/app/pages/form/form-new/form-cpu-ram/form-cpu-ram.component.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -210,10 +210,9 @@ export class FormCpuRamComponent implements OnInit, OnChanges {
210210

211211
private maxResourcesValidator(input: string): ValidatorFn {
212212
return (control: AbstractControl): ValidationErrors | null => {
213-
const gpuNumValue = this.parentForm.get('gpus').get('num').value;
214-
const gpu = gpuNumValue === 'none' ? 0 : parseInt(gpuNumValue, 10) || 0;
215-
const max = this.MAX_FOR_GPU.get(gpu)[input];
216-
213+
// Hardcoding to 0 for gpu value to minimize code changes
214+
// BTIS-409
215+
const max = this.MAX_FOR_GPU.get(0)[input];
217216
return control.value > max
218217
? { max: { max, actual: control.value } }
219218
: null;

frontend/jupyter/src/app/pages/form/form-new/form-new.component.html

-7
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,6 @@
5151
[nsMetadata]="nsMetadata"
5252
></app-form-cpu-ram>
5353

54-
<app-form-gpus
55-
[parentForm]="formCtrl"
56-
[vendors]="config?.gpus?.value.vendors"
57-
(gpuValueEvent)="checkGPU($event)"
58-
[nsMetadata]="nsMetadata"
59-
></app-form-gpus>
60-
6154
<app-form-workspace-volume
6255
*ngIf="formCtrl.get('workspace')"
6356
[readonly]="config?.workspaceVolume?.readOnly"

frontend/jupyter/src/app/pages/form/form-new/form-new.component.ts

+1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ export class FormNewComponent
202202
}
203203

204204
// Automatically set values of CPU and Memory if GPU is 1
205+
// Removing GPU BTIS-409
205206
checkGPU(gpu: string) {
206207
if (gpu === 'none') {
207208
this.readonlySpecs = false;

0 commit comments

Comments
 (0)