Skip to content

Commit

Permalink
Allow experiments table to sort by last run started
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanshug committed Jun 11, 2024
1 parent 23ae524 commit cb95e12
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions frontend/src/__mocks__/mockExperimentKF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export const buildMockExperimentKF = (experiment?: Partial<ExperimentKFv2>): Exp
description: 'All runs created without specifying an experiment will be grouped here.',
created_at: '2024-01-31T15:46:33Z',
storage_state: StorageStateKF.AVAILABLE,
last_run_created_at: '2024-01-31T15:46:33Z',
...experiment,
});

Expand Down
5 changes: 5 additions & 0 deletions frontend/src/concepts/pipelines/content/tables/columns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ export const experimentColumns: SortableData<ExperimentKFv2>[] = [
field: 'created_at',
sortable: true,
},
{
label: 'Last run started',
field: 'last_run_created_at',
sortable: true,
},
{
label: 'Last 5 runs',
field: 'last_5_runs',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ExperimentKFv2, StorageStateKF } from '~/concepts/pipelines/kfTypes';
import { CheckboxTd } from '~/components/table';
import { experimentRunsRoute } from '~/routes';
import { usePipelinesAPI } from '~/concepts/pipelines/context';
import { ExperimentCreated, LastExperimentRuns } from './renderUtils';
import { ExperimentCreated, LastExperimentRuns, LastExperimentRunsStarted } from './renderUtils';

type ExperimentTableRowProps = {
isChecked: boolean;
Expand Down Expand Up @@ -43,6 +43,9 @@ const ExperimentTableRow: React.FC<ExperimentTableRowProps> = ({
<Td dataLabel="Created">
<ExperimentCreated experiment={experiment} />
</Td>
<Td dataLabel="Last run started">
<LastExperimentRunsStarted experiment={experiment} />
</Td>
<Td dataLabel="Last 5 runs">
<LastExperimentRuns experiment={experiment} />
</Td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ export const ExperimentCreated: ExperimentUtil = ({ experiment }) => {
return <PipelinesTableRowTime date={createdDate} />;
};

export const LastExperimentRunsStarted: ExperimentUtil = ({ experiment }) => {
const lastRunStarted = new Date(experiment.last_run_created_at);
return <PipelinesTableRowTime date={lastRunStarted} />;
};

export const LastExperimentRuns: ExperimentUtil = ({ experiment }) => {
const [runs] = usePipelineRunsByExperiment(experiment.experiment_id, {
sortDirection: 'desc',
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/concepts/pipelines/kfTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,7 @@ export type ExperimentKFv2 = {
created_at: string;
namespace?: string;
storage_state: StorageStateKF;
last_run_created_at: string;
};

export type ListExperimentsResponseKF = PipelineKFCallCommon<{
Expand Down Expand Up @@ -697,7 +698,7 @@ export type CreatePipelineVersionKFData = Omit<

export type CreateExperimentKFData = Omit<
ExperimentKFv2,
'experiment_id' | 'created_at' | 'namespace' | 'storage_state'
'experiment_id' | 'created_at' | 'namespace' | 'storage_state' | 'last_run_created_at'
>;
export type CreatePipelineRunKFData = Omit<
PipelineRunKFv2,
Expand Down

0 comments on commit cb95e12

Please sign in to comment.