Skip to content

Commit 6e42ba2

Browse files
committed
fix listing gpus in zoslight
Signed-off-by: Ashraf Fouda <ashraf.m.fouda@gmail.com>
1 parent 81d730c commit 6e42ba2

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

pkg/primitives/statistics.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,19 +278,23 @@ func (s *statsStream) ListGPUs() ([]pkg.GPUInfo, error) {
278278
if err != nil {
279279
return nil, err
280280
}
281+
type vmType struct {
282+
GPU []zos.GPU `json:"gpu,omitempty"`
283+
}
281284
for _, dl := range active.Deployments {
282285
for _, wl := range dl.Workloads {
283-
if wl.Type != zos.ZMachineType {
284-
continue
285-
}
286-
var vm zos.ZMachine
287-
if err := json.Unmarshal(wl.Data, &vm); err != nil {
288-
return nil, errors.Wrapf(err, "invalid workload data (%d.%s)", dl.ContractID, wl.Name)
289-
}
290286

291-
for _, gpu := range vm.GPU {
292-
gpus[string(gpu)] = dl.ContractID
287+
if wl.Type == zos.ZMachineType || wl.Type == zos.ZMachineLightType {
288+
var vm vmType
289+
if err := json.Unmarshal(wl.Data, &vm); err != nil {
290+
return nil, errors.Wrapf(err, "invalid workload data (%d.%s)", dl.ContractID, wl.Name)
291+
}
292+
293+
for _, gpu := range vm.GPU {
294+
gpus[string(gpu)] = dl.ContractID
295+
}
293296
}
297+
294298
}
295299
}
296300
return gpus, nil

0 commit comments

Comments
 (0)