File tree Expand file tree Collapse file tree 3 files changed +17
-3
lines changed
Expand file tree Collapse file tree 3 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1+ from typing import Optional
2+
3+ from dstack ._internal .core .compatibility .runs import get_run_spec_excludes
4+ from dstack ._internal .core .models .common import IncludeExcludeDictType
5+ from dstack ._internal .server .schemas .gpus import ListGpusRequest
6+
7+
8+ def get_list_gpus_excludes (request : ListGpusRequest ) -> Optional [IncludeExcludeDictType ]:
9+ list_gpus_excludes : IncludeExcludeDictType = {}
10+ run_spec_excludes = get_run_spec_excludes (request .run_spec )
11+ if run_spec_excludes is not None :
12+ list_gpus_excludes ["run_spec" ] = run_spec_excludes
13+ return list_gpus_excludes
Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ def _process_offers_into_backend_gpus(
7979 """Transforms raw offers into a structured list of BackendGpus, aggregating GPU info."""
8080 backend_data : Dict [BackendType , Dict ] = {}
8181
82- for backend , offer in offers :
83- backend_type = backend . TYPE
82+ for _ , offer in offers :
83+ backend_type = offer . backend
8484 if backend_type not in backend_data :
8585 backend_data [backend_type ] = {"gpus" : {}, "regions" : set ()}
8686
Original file line number Diff line number Diff line change 22
33from pydantic import parse_obj_as
44
5+ from dstack ._internal .core .compatibility .gpus import get_list_gpus_excludes
56from dstack ._internal .core .models .runs import RunSpec
67from dstack ._internal .server .schemas .gpus import GpuGroup , ListGpusRequest , ListGpusResponse
78from dstack .api .server ._group import APIClientGroup
@@ -17,6 +18,6 @@ def list_gpus(
1718 body = ListGpusRequest (run_spec = run_spec , group_by = group_by )
1819 resp = self ._request (
1920 f"/api/project/{ project_name } /gpus/list" ,
20- body = body .json (),
21+ body = body .json (exclude = get_list_gpus_excludes ( body ) ),
2122 )
2223 return parse_obj_as (ListGpusResponse , resp .json ()).gpus
You can’t perform that action at this time.
0 commit comments