Skip to content

[Bug]: CLI offers grouped by GPU output as JSON fails #3120

@hamzashezad

Description

@hamzashezad

Steps to reproduce

JSON output fails

dstack offer --format json --group-by gpu

Actual behaviour

Traceback (most recent call last):
  File "/Users/hamza/.local/bin/dstack", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/hamza/.local/share/uv/tools/dstack/lib/python3.11/site-packages/dstack/_internal/cli/main.py", line 91, in main
    args.func(args)
  File "/Users/hamza/.local/share/uv/tools/dstack/lib/python3.11/site-packages/dstack/_internal/cli/commands/offer.py", line 133, in _command
    print_gpu_json(gpus, run_spec, args.group_by, self.api.project)
  File "/Users/hamza/.local/share/uv/tools/dstack/lib/python3.11/site-packages/dstack/_internal/cli/utils/gpu.py", line 39, in print_gpu_json
    for gpu_group in gpu_response.gpus:
                     ^^^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'gpus'

Expected behaviour

Should output JSON

dstack version

0.19.29

Server logs

[14:44:30] INFO     Applying ~/.dstack/server/config.yml...                                                                       
[14:44:31] INFO     dstack._internal.server.services.plugins:77 Found not enabled builtin plugin rest_plugin. Plugin will not be  
                    loaded.                                                                                                       
           INFO     dstack._internal.server.app:163 Job network mode: HOST_WHEN_POSSIBLE (2)                                      
           INFO     The admin token is f2555a57-7796-4863-a5e1-39190758387d                                                       
           INFO     The dstack server 0.19.29 is running at http://127.0.0.1:3000                                                 
[14:44:49] INFO     dstack._internal.server.services.backends:347 Requesting instance offers from backends: ['runpod']            
[14:44:52] DEBUG    dstack._internal.server.app:259 Processed request POST http://127.0.0.1:3000/api/project/main/gpus/list in    
                    3.081939s. Status: 200                                                                                        
[14:45:01] INFO     dstack._internal.server.services.backends:347 Requesting instance offers from backends: ['runpod']            
[14:45:02] DEBUG    dstack._internal.server.app:259 Processed request POST http://127.0.0.1:3000/api/project/main/gpus/list in    
                    0.140027s. Status: 200

Additional information

No response

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions