Barahlush / vastai_client

This package provides a Python client for the Vast.ai GPU rent service, that allows to list, create, destroy GPU instances programmaticaly, using Python.
MIT License
4 stars 5 forks source link

Exception in get_instances method #41

Open alteralt opened 10 months ago

alteralt commented 10 months ago

Module version: 0.1.1

Traceback :

Traceback (most recent call last):
  File "test.py", line 5, in <module>
    print(client.get_instances())
          ^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\vastai_client\vast_client.py", line 270, in get_instances
    return [from_dict(data_class=Instance, data=row) for row in rows]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\vastai_client\vast_client.py", line 270, in <listcomp>
    return [from_dict(data_class=Instance, data=row) for row in rows]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "venv\Lib\site-packages\dacite\core.py", line 69, in from_dict
    raise WrongTypeError(field_path=field.name, field_type=field_type, value=value)
dacite.exceptions.WrongTypeError: wrong value type for field "disk_util" - should be "int | None" instead of value "0.36800000071525574" of type "float"
maxiaoxiong commented 9 months ago

@Barahlush Can you fix it? or i submit pr

alteralt commented 9 months ago

@Barahlush Can you fix it? or i submit pr

If you are going to do PR, then here is a complete list of fields whose types I have corrected

class Instance(VastaioClientInstance):
    ports: typing.Any = None
    disk_util: typing.Optional[typing.Union[int, float]] = None
    inet_down_billed: typing.Optional[typing.Union[bool, float]] = None
    inet_up_billed: typing.Optional[typing.Union[bool, float]] = None
    end_date: typing.Optional[typing.Union[str, float]] = None
    credit_balance: typing.Optional[str] = None