Skip to content

[Bug]: UI shows the whole instance's resources for a run occupying one block #4187

Description

@r4victor

Steps to reproduce

  1. Create a fleet whose instances are split into blocks:
type: fleet
name: blocks-repro
nodes: 0..1
blocks: auto
resources:
  cpu: 4..8
  memory: 8GB..32GB
  1. Run a workload that occupies one block:
type: task
name: blocks-repro-task
image: python:3.12-slim
commands:
  - sleep 3600
resources:
  cpu: 1
  memory: 2GB..
  1. Compare dstack ps -v with the run's resources in the UI (/runs, and the run's job list).

Actual behaviour

The UI reports the resources of the whole instance instead of the block the job actually got, so it disagrees with the CLI for the same run at the same moment. On a 4-block t3.xlarge:

dstack ps -v   ->  cpu=1 mem=4GB disk=100GB    t3.xlarge (1/4)
UI /runs       ->  cpu=4 mem=16GB disk=100GB

Both figures are available in the API response — job_runtime_data.offer.instance.resources is the block (1 cpu, 4096 MiB), job_provisioning_data.instance_type.resources is the instance (4 cpus, 16384 MiB) — and the UI reads the latter:

const resources = run.latest_job_submission?.job_provisioning_data?.instance_type?.resources;
return resources ? formatResources(resources) : '-';

The run's job list has the same issue:

export const getJobListItemResources = (job: IJob) => {
const resources = job.job_submissions?.[job.job_submissions.length - 1]?.job_provisioning_data?.instance_type?.resources;
return resources ? formatResources(resources) : '-';

Expected behaviour

The UI shows the resources allocated to the job, matching dstack ps.

dstack version

master 1298b421a (source checkout)

Server logs


Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingui

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions