Skip to content

Commit

Permalink
Support rendering topology nodes under v2
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewballantyne committed Mar 15, 2024
1 parent 594339b commit 500a2f5
Show file tree
Hide file tree
Showing 45 changed files with 912 additions and 766 deletions.
47 changes: 24 additions & 23 deletions frontend/src/__mocks__/mockPipelineVersionsProxy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable camelcase */
import {
InputDefParamType,
ArtifactType,
InputDefinitionParameterType,
PipelineVersionKF,
PipelineVersionKFv2,
RelationshipKF,
Expand Down Expand Up @@ -210,7 +211,7 @@ export const mockPipelineVersionsListV2: PipelineVersionKFv2[] = [
artifacts: {
iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
Expand All @@ -223,25 +224,25 @@ export const mockPipelineVersionsListV2: PipelineVersionKFv2[] = [
artifacts: {
input_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
},
parameters: {
min_max_scaler: {
parameterType: 'BOOLEAN',
parameterType: InputDefinitionParameterType.BOOLEAN,
},
standard_scaler: {
parameterType: 'BOOLEAN',
parameterType: InputDefinitionParameterType.BOOLEAN,
},
},
},
outputDefinitions: {
artifacts: {
normalized_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
Expand All @@ -254,22 +255,22 @@ export const mockPipelineVersionsListV2: PipelineVersionKFv2[] = [
artifacts: {
normalized_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
},
parameters: {
n_neighbors: {
parameterType: 'NUMBER_INTEGER',
parameterType: InputDefinitionParameterType.INTEGER,
},
},
},
outputDefinitions: {
artifacts: {
model: {
artifactType: {
schemaTitle: 'system.Model',
schemaTitle: ArtifactType.MODEL,
schemaVersion: '0.0.1',
},
},
Expand Down Expand Up @@ -409,13 +410,13 @@ export const mockPipelineVersionsListV2: PipelineVersionKFv2[] = [
inputDefinitions: {
parameters: {
min_max_scaler: {
parameterType: InputDefParamType.Boolean,
parameterType: InputDefinitionParameterType.BOOLEAN,
},
neighbors: {
parameterType: InputDefParamType.NumberInteger,
parameterType: InputDefinitionParameterType.INTEGER,
},
standard_scaler: {
parameterType: InputDefParamType.Boolean,
parameterType: InputDefinitionParameterType.BOOLEAN,
},
},
},
Expand Down Expand Up @@ -458,7 +459,7 @@ export const buildMockPipelineVersionV2 = (
artifacts: {
iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
Expand All @@ -471,25 +472,25 @@ export const buildMockPipelineVersionV2 = (
artifacts: {
input_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
},
parameters: {
min_max_scaler: {
parameterType: 'BOOLEAN',
parameterType: InputDefinitionParameterType.BOOLEAN,
},
standard_scaler: {
parameterType: 'STRING',
parameterType: InputDefinitionParameterType.STRING,
},
},
},
outputDefinitions: {
artifacts: {
normalized_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
Expand All @@ -502,22 +503,22 @@ export const buildMockPipelineVersionV2 = (
artifacts: {
normalized_iris_dataset: {
artifactType: {
schemaTitle: 'system.Dataset',
schemaTitle: ArtifactType.DATASET,
schemaVersion: '0.0.1',
},
},
},
parameters: {
n_neighbors: {
parameterType: 'NUMBER_INTEGER',
parameterType: InputDefinitionParameterType.INTEGER,
},
},
},
outputDefinitions: {
artifacts: {
model: {
artifactType: {
schemaTitle: 'system.Model',
schemaTitle: ArtifactType.MODEL,
schemaVersion: '0.0.1',
},
},
Expand Down Expand Up @@ -657,13 +658,13 @@ export const buildMockPipelineVersionV2 = (
inputDefinitions: {
parameters: {
min_max_scaler: {
parameterType: InputDefParamType.Boolean,
parameterType: InputDefinitionParameterType.BOOLEAN,
},
neighbors: {
parameterType: InputDefParamType.NumberInteger,
parameterType: InputDefinitionParameterType.INTEGER,
},
standard_scaler: {
parameterType: InputDefParamType.String,
parameterType: InputDefinitionParameterType.STRING,
},
},
},
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/__mocks__/mockRunKF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export const buildMockRunKF = (run?: Partial<PipelineRunKFv2>): PipelineRunKFv2
runtime_config: {
parameters: {
min_max_scaler: false,
neighbors: 0,
standard_scaler: 'yes',
neighbors: 1,
standard_scaler: false,
},
},
service_account: 'pipeline-runner-dspa',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable camelcase */
import {
InputDefParamType,
InputDefinitionParameterType,
PipelineRunJobKFv2,
PipelineRunKFv2,
} from '~/concepts/pipelines/kfTypes';
Expand Down Expand Up @@ -243,25 +243,26 @@ describe('Pipeline create runs', () => {
pipeline_spec: {
...mockPipelineVersion.pipeline_spec,
root: {
dag: { tasks: {} },
inputDefinitions: {
parameters: {
string_param: {
parameterType: InputDefParamType.String,
parameterType: InputDefinitionParameterType.STRING,
},
double_param: {
parameterType: InputDefParamType.NumberDouble,
parameterType: InputDefinitionParameterType.DOUBLE,
},
int_param: {
parameterType: InputDefParamType.NumberInteger,
parameterType: InputDefinitionParameterType.INTEGER,
},
struct_param: {
parameterType: InputDefParamType.Struct,
parameterType: InputDefinitionParameterType.STRUCT,
},
list_param: {
parameterType: InputDefParamType.List,
parameterType: InputDefinitionParameterType.LIST,
},
bool_param: {
parameterType: InputDefParamType.Boolean,
parameterType: InputDefinitionParameterType.BOOLEAN,
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import { mockPodLogs } from '~/__mocks__/mockPodLogs';
import {
pipelineDetails,
pipelineRunJobDetails,
pipelinesTopology,
pipelineRunDetails,
} from '~/__tests__/cypress/cypress/pages/pipelines';
import { buildMockRunKF } from '~/__mocks__/mockRunKF';
Expand Down Expand Up @@ -148,6 +147,13 @@ const initIntercepts = () => {
},
{ runs: [mockRun] },
);
cy.intercept(
{
method: 'POST',
pathname: `/api/proxy/apis/v2beta1/pipelines/${mockPipeline.pipeline_id}/versions`,
},
[mockVersion],
);
cy.intercept(
{
method: 'POST',
Expand Down Expand Up @@ -175,23 +181,6 @@ const initIntercepts = () => {

describe('Pipeline topology', () => {
describe('Pipeline details', () => {
// TODO, remove skip after https://issues.redhat.com/browse/RHOAIENG-2282
it.skip('Test pipeline topology renders', () => {
initIntercepts();

pipelineDetails.visit(projectId, mockVersion.pipeline_id, mockVersion.pipeline_version_id);

pipelinesTopology.findTaskNode('print-msg').click();
pipelinesTopology
.findTaskDrawer()
.findByText('$(tasks.random-num.results.Output)')
.should('exist');
pipelinesTopology.findCloseDrawerButton().click();

pipelinesTopology.findTaskNode('flip-coin').click();
pipelinesTopology.findTaskDrawer().findByText('/tmp/outputs/Output/data').should('exist');
});

describe('Navigation', () => {
beforeEach(() => {
initIntercepts();
Expand Down Expand Up @@ -386,16 +375,14 @@ describe('Pipeline topology', () => {
beforeEach(() => {
initIntercepts();
pipelineRunDetails.visit(projectId, mockRun.run_id);
pipelineRunDetails.findTaskNode('flip-coin').click();
pipelineRunDetails.findTaskNode('create-dataset').click();
pipelineRunDetails.findRightDrawer().findRightDrawerDetailsTab().should('be.visible');
pipelineRunDetails.findRightDrawer().findRightDrawerVolumesTab().should('be.visible');
pipelineRunDetails.findRightDrawer().findRightDrawerLogsTab().should('be.visible');
pipelineRunDetails.findRightDrawer().findRightDrawerLogsTab().click();
pipelineRunDetails.findLogsSuccessAlert().should('be.visible');
});

// TODO, remove skip after https://issues.redhat.com/browse/RHOAIENG-2282
it.skip('test whether the logs load in Logs tab', () => {
it.only('test whether the logs load in Logs tab', () => {
pipelineRunDetails
.findLogs()
.contains(
Expand All @@ -413,8 +400,7 @@ describe('Pipeline topology', () => {
pipelineRunDetails.findRawLogs().should('not.exist');
});

// TODO, remove skip after https://issues.redhat.com/browse/RHOAIENG-2282
it.skip('test logs of another step', () => {
it('test logs of another step', () => {
pipelineRunDetails.findStepSelect().should('not.be.disabled');
pipelineRunDetails.selectStepByName('step-copy-artifacts');
pipelineRunDetails.findLogs().contains('No logs available');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class PipelinesTopology {
}

protected wait() {
cy.findByTestId('topology');
cy.testA11y();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
import React from 'react';
import { Text, TextVariants } from '@patternfly/react-core';
import { getPipelineJobExecutionCount } from '~/concepts/pipelines/content/tables/utils';
import { PipelineRunJobKFv2 } from '~/concepts/pipelines/kfTypes';
import { usePipelinesAPI } from '~/concepts/pipelines/context';

type PipelineJobReferenceNameProps = {
resource: PipelineRunJobKFv2;
runName: string;
recurringRunId?: string;
};

const PipelineJobReferenceName: React.FC<PipelineJobReferenceNameProps> = ({ resource }) => {
const PipelineJobReferenceName: React.FC<PipelineJobReferenceNameProps> = ({
runName,
recurringRunId,
}) => {
const { getJobInformation } = usePipelinesAPI();
const { data, loading } = getJobInformation(resource);
const { data, loading } = getJobInformation(recurringRunId);

return (
<>
{loading ? (
'loading...'
) : data ? (
<Text component={TextVariants.p} className="pf-u-pb-sm">
Run {getPipelineJobExecutionCount(resource.display_name)} of {data.display_name}
Run {getPipelineJobExecutionCount(runName)} of {data.display_name}
</Text>
) : (
''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,6 @@ import { computeRunStatus } from '~/concepts/pipelines/content/utils';
const run: PipelineRunKFv2 = {
created_at: '2023-09-05T16:23:25Z',
storage_state: StorageStateKF.AVAILABLE,
pipeline_spec: {
runtime_config: {
parameters: {},
pipeline_root: '',
},
},
pipeline_version_id: 'version-id',
finished_at: '2023-09-05T16:24:34Z',
run_id: 'dc66a214-4df2-4d4d-a302-0d02d8bba0e7',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
runPageSectionTitles,
} from '~/concepts/pipelines/content/createRun/const';
import {
InputDefParamType,
InputDefinitionParameterType,
PipelineVersionKFv2,
RuntimeConfigParameters,
} from '~/concepts/pipelines/kfTypes';
Expand Down Expand Up @@ -56,20 +56,20 @@ export const ParamsSection: React.FC<ParamsSectionProps> = ({
let input: React.ReactNode;

switch (parameterType) {
case InputDefParamType.NumberInteger:
case InputDefinitionParameterType.INTEGER:
input = <NumberInputParam {...inputProps} />;
break;
case InputDefParamType.Boolean:
case InputDefinitionParameterType.BOOLEAN:
input = <RadioInputParam {...inputProps} />;
break;
case InputDefParamType.List:
case InputDefParamType.Struct:
case InputDefinitionParameterType.LIST:
case InputDefinitionParameterType.STRUCT:
input = <JsonInputParam {...inputProps} />;
break;
case InputDefParamType.NumberDouble:
case InputDefinitionParameterType.DOUBLE:
input = <NumberInputParam isFloat {...inputProps} />;
break;
case InputDefParamType.String:
case InputDefinitionParameterType.STRING:
input = <TextInput {...inputProps} value={String(value)} />;
}

Expand Down
Loading

0 comments on commit 500a2f5

Please sign in to comment.