Skip to content
Open
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
11 changes: 11 additions & 0 deletions frontend/src/libs/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { StatusIndicatorProps } from '@cloudscape-design/components';
import { capitalize } from 'libs';

import { finishedRunStatuses } from '../pages/Runs/constants';
import { getJobProbesStatuses } from '../pages/Runs/Details/Jobs/List/helpers';

import { IModelExtended } from '../pages/Models/List/types';

Expand Down Expand Up @@ -75,6 +76,16 @@ export const getRunError = (run: IRun): string | null => {
return error ? capitalize(error) : null;
};

export const getRunProbe = (run: IRun): string | null => {
const job = run.jobs[0];

if (!job) {
return '-';
}

return getJobProbesStatuses(run.jobs[0]);
};

export const getRunPriority = (run: IRun): number | null => {
return run.run_spec.configuration?.priority ?? null;
};
Expand Down
1 change: 1 addition & 0 deletions frontend/src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@
"priority": "Priority",
"provider_name": "Provider",
"status": "Status",
"probe": "Probes",
"submitted_at": "Submitted",
"finished_at": "Finished",
"metrics": {
Expand Down
25 changes: 25 additions & 0 deletions frontend/src/pages/Runs/Details/Jobs/List/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,31 @@ export const getJobStatus = (job: IJob) => {
return job.job_submissions?.[job.job_submissions.length - 1].status;
};

export const getJobSubmissionProbes = (job: IJob) => {
return job.job_submissions?.[job.job_submissions.length - 1].probes;
};

export const getJobProbesStatuses = (job: IJob) => {
const status = getJobStatus(job);
const probes = getJobSubmissionProbes(job);

if (!probes?.length || status !== 'running') {
return null;
}

return probes
?.map((probe, index) => {
if (job.job_spec?.probes?.[index] && probe.success_streak >= job.job_spec.probes[index].ready_after) {
return '✓';
} else if (probe.success_streak > 0) {
return '~';
} else {
return '×';
}
})
.join('');
};

export const getJobTerminationReason = (job: IJob) => {
return job.job_submissions?.[job.job_submissions.length - 1].termination_reason ?? '-';
};
Expand Down
6 changes: 6 additions & 0 deletions frontend/src/pages/Runs/Details/Jobs/List/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
getJobListItemRegion,
getJobListItemResources,
getJobListItemSpot,
getJobProbesStatuses,
getJobStatus,
getJobStatusMessage,
getJobSubmittedAt,
Expand Down Expand Up @@ -67,6 +68,11 @@ export const useColumnsDefinitions = ({
);
},
},
{
id: 'probe',
header: t('projects.run.probe'),
cell: (item: IJob) => getJobProbesStatuses(item),
},
{
id: 'priority',
header: t('projects.run.priority'),
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/pages/Runs/Details/RunDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { format } from 'date-fns';
import { Box, ColumnLayout, Container, Header, Loader, NavigateLink, StatusIndicator } from 'components';

import { DATE_TIME_FORMAT } from 'consts';
import { getRunError, getRunPriority, getRunStatusMessage, getStatusIconColor, getStatusIconType } from 'libs/run';
import { getRunError, getRunPriority, getRunProbe, getRunStatusMessage, getStatusIconColor, getStatusIconType } from 'libs/run';
import { ROUTES } from 'routes';
import { useGetRunQuery } from 'services/run';

Expand Down Expand Up @@ -122,6 +122,13 @@ export const RunDetails = () => {
</div>
</div>

{runData.jobs.length <= 1 && (
<div>
<Box variant="awsui-key-label">{t('projects.run.probe')}</Box>
<div>{getRunProbe(runData)}</div>
</div>
)}

<div>
<Box variant="awsui-key-label">{t('projects.run.error')}</Box>
<div>{getRunError(runData) ?? '-'}</div>
Expand Down
13 changes: 13 additions & 0 deletions frontend/src/types/run.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@ declare interface IAppSpec {
url_query_params?: { [key: string]: string };
}

declare interface IJobProbe {
type: 'http';
url: string;
method?: 'head' | 'post' | 'put' | 'patch' | 'delete' | 'get';
headers?: Array<{ name: string; value: string }>;
body?: string;
timeout: number;
interval: number;
ready_after: number;
}

declare interface IJobSpec {
app_specs?: IAppSpec;
commands: string[];
Expand All @@ -181,6 +192,7 @@ declare interface IJobSpec {
job_num: number;
max_duration?: number;
working_dir: string;
probes?: IJobProbe[];
}

declare interface IGpu {
Expand Down Expand Up @@ -234,6 +246,7 @@ declare interface IJobSubmission {
exit_status?: number | null;
status_message?: string | null;
error?: string | null;
probes?: Array<{ success_streak: number }>;
}

declare interface IJob {
Expand Down