Skip to content

Commit 7fa4cc7

Browse files
Address review feedback
- Restore Configuration property on Run details page - Add Field(description) deprecation notice to Resources.description - Use formatBackend() in Run and Job helpers instead of inline logic - Restore Price column/field to Instance list and details Made-with: Cursor
1 parent 7e76a87 commit 7fa4cc7

6 files changed

Lines changed: 25 additions & 11 deletions

File tree

frontend/src/pages/Instances/Details/InstanceDetails/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,11 @@ export const InstanceDetails = () => {
135135
<div>{data.instance_type?.resources.spot ? t('common.yes') : t('common.no')}</div>
136136
</div>
137137

138+
<div>
139+
<Box variant="awsui-key-label">{t('fleets.instances.price')}</Box>
140+
<div>{typeof data.price === 'number' ? `$${data.price}` : '-'}</div>
141+
</div>
142+
138143
<div>
139144
<Box variant="awsui-key-label">{t('fleets.instances.hostname')}</Box>
140145
<div>{data.hostname ?? '-'}</div>

frontend/src/pages/Instances/List/hooks/useColumnDefinitions.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ export const useColumnsDefinitions = () => {
9696
header: t('fleets.instances.started'),
9797
cell: (item) => format(new Date(item.created), DATE_TIME_FORMAT),
9898
},
99+
{
100+
id: 'price',
101+
header: t('fleets.instances.price'),
102+
cell: (item) => (typeof item.price === 'number' ? `$${item.price}` : '-'),
103+
},
99104
];
100105

101106
return { columns } as const;

frontend/src/pages/Runs/Details/Jobs/List/helpers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { StatusIndicatorProps } from '@cloudscape-design/components/status-
33

44
import { DATE_TIME_FORMAT } from 'consts';
55
import { capitalize } from 'libs';
6+
import { formatBackend } from 'libs/fleet';
67
import { formatResources } from 'libs/resources';
78

89
export const getJobListItemResources = (job: IJob) => {
@@ -33,10 +34,7 @@ export const getJobListItemRegion = (job: IJob) => {
3334
};
3435

3536
export const getJobListItemBackend = (job: IJob) => {
36-
const backend = job.job_submissions?.[job.job_submissions.length - 1]?.job_provisioning_data?.backend;
37-
if (!backend) return '-';
38-
if (backend === 'remote') return 'ssh';
39-
return backend;
37+
return formatBackend(job.job_submissions?.[job.job_submissions.length - 1]?.job_provisioning_data?.backend);
4038
};
4139

4240
export const getJobSubmittedAt = (job: IJob) => {

frontend/src/pages/Runs/Details/RunDetails/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,11 @@ export const RunDetails = () => {
9393
</div>
9494
</div>
9595

96+
<div>
97+
<Box variant="awsui-key-label">{t('projects.run.configuration')}</Box>
98+
<div>{runData.run_spec.configuration_path}</div>
99+
</div>
100+
96101
<div>
97102
<Box variant="awsui-key-label">{t('projects.run.resources')}</Box>
98103
<div>{getRunListItemResources(runData)}</div>

frontend/src/pages/Runs/List/helpers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { groupBy as _groupBy } from 'lodash';
22

33
import { getBaseUrl } from 'App/helpers';
4+
import { formatBackend } from 'libs/fleet';
45
import { formatResources } from 'libs/resources';
56

67
import { finishedJobs, finishedRunStatuses } from '../constants';
@@ -86,10 +87,7 @@ export const getRunListItemBackend = (run: IRun) => {
8687
return '-';
8788
}
8889

89-
const backend = run.latest_job_submission?.job_provisioning_data?.backend;
90-
if (!backend) return '-';
91-
if (backend === 'remote') return 'ssh';
92-
return backend;
90+
return formatBackend(run.latest_job_submission?.job_provisioning_data?.backend);
9391
};
9492

9593
export const getRunListItemServiceUrl = (run: IRun) => {

src/dstack/_internal/core/models/instances.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import datetime
22
from enum import Enum
3-
from typing import Any, Dict, List, Optional
3+
from typing import Annotated, Any, Dict, List, Optional
44
from uuid import UUID
55

66
import gpuhunt
7-
from pydantic import root_validator
7+
from pydantic import Field, root_validator
88

99
from dstack._internal.core.models.backends.base import BackendType
1010
from dstack._internal.core.models.common import (
@@ -57,7 +57,10 @@ class Resources(CoreModel):
5757
disk: Disk = Disk(size_mib=102400) # the default value (100GB) for backward compatibility
5858
cpu_arch: Optional[gpuhunt.CPUArchitecture] = None
5959
# Deprecated: description is now generated client-side. TODO: remove in 0.21.
60-
description: str = ""
60+
description: Annotated[
61+
str,
62+
Field(description="Deprecated: generated client-side. Will be removed in 0.21."),
63+
] = ""
6164

6265
@root_validator
6366
def _description(cls, values) -> Dict:

0 commit comments

Comments
 (0)