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
12 changes: 6 additions & 6 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"@cloudscape-design/chat-components": "^1.0.62",
"@cloudscape-design/collection-hooks": "^1.0.74",
"@cloudscape-design/component-toolkit": "^1.0.0-beta.120",
"@cloudscape-design/components": "^3.0.1091",
"@cloudscape-design/components": "^3.0.1188",
"@cloudscape-design/design-tokens": "^3.0.60",
"@cloudscape-design/global-styles": "^1.0.45",
"@hookform/resolvers": "^2.9.10",
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/components/NavigateLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import { useNavigate } from 'react-router-dom';
import Link, { LinkProps } from '@cloudscape-design/components/link';

import styles from './style.module.scss';

export const NavigateLink: React.FC<LinkProps> = ({ onFollow, ...props }) => {
const navigate = useNavigate();
const onFollowHandler: LinkProps['onFollow'] = (event) => {
Expand All @@ -10,5 +13,9 @@ export const NavigateLink: React.FC<LinkProps> = ({ onFollow, ...props }) => {
if (event.detail.href) navigate(event.detail.href);
};

return <Link {...props} onFollow={onFollowHandler} />;
return (
<span className={styles.link}>
<Link {...props} onFollow={onFollowHandler} />
</span>
);
};
5 changes: 5 additions & 0 deletions frontend/src/components/NavigateLink/style.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.link {
& > a {
text-decoration: underline !important;
}
}
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
2 changes: 2 additions & 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 Expand Up @@ -477,6 +478,7 @@
"offer": "Offer",
"offer_description": "Select an offer for the dev environment.",
"name": "Name",
"name_description": "The name of the run, e.g. 'my-dev-env'",
"name_constraint": "Example: 'my-fleet' or 'default'. If not specified, generated automatically.",
"name_placeholder": "Optional",
"ide": "IDE",
Expand Down
23 changes: 23 additions & 0 deletions frontend/src/pages/Runs/Details/Jobs/List/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { format } from 'date-fns';
import type { StatusIndicatorProps } from '@cloudscape-design/components/status-indicator';

import { DATE_TIME_FORMAT } from 'consts';
import { capitalize } from 'libs';
Expand Down Expand Up @@ -48,6 +49,28 @@ 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): StatusIndicatorProps.Type[] => {
const status = getJobStatus(job);
const probes = getJobSubmissionProbes(job);

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

return probes.map((probe, index) => {
if (job.job_spec?.probes?.[index] && probe.success_streak >= job.job_spec.probes[index].ready_after) {
return 'success';
} else if (probe.success_streak > 0) {
return 'in-progress';
}
return 'not-started';
});
};

export const getJobTerminationReason = (job: IJob) => {
return job.job_submissions?.[job.job_submissions.length - 1].termination_reason ?? '-';
};
Expand Down
9 changes: 9 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,14 @@ export const useColumnsDefinitions = ({
);
},
},
{
id: 'probe',
header: t('projects.run.probe'),
cell: (item: IJob) => {
const statuses = getJobProbesStatuses(item);
return statuses.map((statusType, index) => <StatusIndicator key={index} type={statusType} />);
},
},
{
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