Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(jupyter): Remove GPU from form #327

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 3 additions & 62 deletions frontend/jupyter/cypress/e2e/form-page.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
describe('New notebook form', () => {
beforeEach(() => {
cy.mockDashboardRequest();
cy.mockGpusRequest();
cy.mockConfigRequest();
cy.fixture('settings').then(settings => {
cy.mockNotebooksRequest(settings.namespace);
Expand All @@ -13,7 +12,6 @@ describe('New notebook form', () => {
cy.visit('/new');
cy.wait([
'@mockDashboardRequest',
'@mockGpusRequest',
'@mockConfigRequest',
'@mockNotebooksRequest',
'@mockPoddefaultsRequest',
Expand Down Expand Up @@ -689,22 +687,15 @@ describe('New notebook form', () => {
cy.get('[data-cy-form-input="memory"]')
.find('input')
.invoke('val')
.should('eq', '2.0');
.should('eq', '2');
cy.get('[data-cy-form-input="cpuLimit"]')
.find('input')
.invoke('val')
.should('eq', '4.0');
.should('eq', '4');
cy.get('[data-cy-form-input="memoryLimit"]')
.find('input')
.invoke('val')
.should('eq', '4.0');

cy.get('[data-cy-form-input="gpus"]')
.find('.mat-mdc-select-value')
.should('have.text', 'None');
cy.get('[data-cy-form-input="vendor"]')
.find('.mat-mdc-select-value')
.should('have.text', 'NVIDIA');
.should('eq', '4');

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

it('should create a jupyter GPU notebook', () => {
cy.get('lib-name-input[resourcename="Notebook Server"]')
.find('input')
.type('test-notebook-gpu');
cy.get('[data-cy-advanced-options-button]').click();
// select different jupyter image
cy.get('[data-cy-form-input="serverImage"]').click();
cy.get('[role="listbox"] > mat-option')
.contains('jupyterlab-tensorflow')
.click();
// set a gpu
cy.get('[data-cy-form-input="vendor"]')
.find('mat-select')
.should('have.class', 'mat-mdc-select-disabled');
cy.get('[data-cy-form-input="gpus"]').click();
cy.get('[role="listbox"] > mat-option').should('have.length', 2);
cy.get('[role="listbox"] > mat-option').contains('1').click();
cy.get('[data-cy-form-input="vendor"]')
.find('mat-select')
.should('not.have.class', 'mat-mdc-select-disabled');
cy.get('[data-cy-form-input="vendor"]').click();
cy.get('[role="listbox"] > mat-option').should('have.length', 1);
cy.get('[role="listbox"] > mat-option').contains('NVIDIA').click();
cy.get('[data-cy-form-input="cpu"]')
.find('input')
.invoke('val')
.should('eq', '4.0');
cy.get('[data-cy-form-input="memory"]')
.find('input')
.invoke('val')
.should('eq', '96.0');
cy.get('[data-cy-form-input="cpuLimit"]')
.find('input')
.invoke('val')
.should('eq', '4.0');
cy.get('[data-cy-form-input="memoryLimit"]')
.find('input')
.invoke('val')
.should('eq', '96.0');
// submit the notebook
cy.get('[data-cy-form-button="submit"]').should('be.enabled');
cy.intercept('POST', 'api/namespaces/kubeflow-user/notebooks', {
success: true,
status: 200,
}).as('mockSubmitNotebook');
cy.get('[data-cy-form-button="submit"]').click();
cy.wait('@mockSubmitNotebook');
cy.url().should('eq', 'http://localhost:4200/');
});

it('should create a custom image notebook', () => {
cy.get('lib-name-input[resourcename="Notebook Server"]')
.find('input')
Expand Down
9 changes: 0 additions & 9 deletions frontend/jupyter/cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,6 @@ Cypress.Commands.add('mockDefaultStorageClassRequest', () => {
}).as('mockDefaultStorageClassRequest');
});

Cypress.Commands.add('mockGpusRequest', () => {
cy.intercept('GET', '/api/gpus', {
success: true,
status: 200,
user: null,
vendors: ['nvidia.com/gpu'],
}).as('mockGpusRequest');
});

Cypress.Commands.add('mockConfigRequest', () => {
cy.intercept('GET', '/api/config', {
fixture: 'config',
Expand Down
11 changes: 0 additions & 11 deletions frontend/jupyter/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,6 @@ declare global {
*/
mockDefaultStorageClassRequest(): Chainable<void>;

/**
* Custom command to mock requests at '/api/gpus'
* and returns an object with empty vendors list [].
*/
mockGpusRequest(): Chainable<void>;

/**
* Custom command to mock requests at '/api/config'
*/
mockConfigRequest(): Chainable<void>;

/**
* Custom command to mock request at '/api/namespaces/<namespace>/poddefaults'
* and returns a mock array of PodDefaults for the given namespace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,9 @@ export class FormCpuRamComponent implements OnInit, OnChanges {

private maxResourcesValidator(input: string): ValidatorFn {
return (control: AbstractControl): ValidationErrors | null => {
const gpuNumValue = this.parentForm.get('gpus').get('num').value;
const gpu = gpuNumValue === 'none' ? 0 : parseInt(gpuNumValue, 10) || 0;
const max = this.MAX_FOR_GPU.get(gpu)[input];

// Hardcoding to 0 for gpu value to minimize code changes
// BTIS-409
const max = this.MAX_FOR_GPU.get(0)[input];
return control.value > max
? { max: { max, actual: control.value } }
: null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@
[nsMetadata]="nsMetadata"
></app-form-cpu-ram>

<app-form-gpus
[parentForm]="formCtrl"
[vendors]="config?.gpus?.value.vendors"
(gpuValueEvent)="checkGPU($event)"
[nsMetadata]="nsMetadata"
></app-form-gpus>

<app-form-workspace-volume
*ngIf="formCtrl.get('workspace')"
[readonly]="config?.workspaceVolume?.readOnly"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ export class FormNewComponent
}

// Automatically set values of CPU and Memory if GPU is 1
// Removing GPU BTIS-409
checkGPU(gpu: string) {
if (gpu === 'none') {
this.readonlySpecs = false;
Expand Down
Loading