Skip to content

GET method parameter error in SDK #4111

Closed
@jopemachine

Description

@jopemachine

Summary

  • The SDK methods that internally call the GET method REST API are breaking.

Steps to Reproduce  

Run the example code below.

import asyncio
import sys
from ai.backend.client.session import AsyncSession


async def test():
    async with AsyncSession() as session:
        result = await session.Resource.usage_per_month("202504", ["default"])
        print(result)


if __name__ == "__main__":
    asyncio.run(test())

Expected Behavior  

  • It should run without any issues.

Actual Behavior  

  • The following error occurs.

Logs/Errors  

Traceback (most recent call last):
  File "/home/jopemachine/.local/backend.ai/repos/main/abc.py", line 13, in <module>
    asyncio.run(test())
  File "/home/jopemachine/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/home/jopemachine/.pyenv/versions/3.12.8/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jopemachine/.pyenv/versions/3.12.8/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/home/jopemachine/.local/backend.ai/repos/main/abc.py", line 8, in test
    result = await session.Resource.usage_per_month("202504", ["default"])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jopemachine/.local/backend.ai/repos/main/src/ai/backend/client/func/resource.py", line 76, in usage_per_month
    async with rqst.fetch() as resp:
               ^^^^^^^^^^^^
  File "/home/jopemachine/.local/backend.ai/repos/main/src/ai/backend/client/request.py", line 573, in __aenter__
    raise BackendAPIError(raw_resp.status, raw_resp.reason or "", msg)
ai.backend.client.exceptions.BackendAPIError: BackendAPIError(400, 'Bad Request', {'type': 'https://api.backend.ai/probs/invalid-api-params', 'title': 'Missing or invalid API parameters.', 'msg': 'Input validation error', 'data': {'group_ids': 'is required', 'month': 'is required'}})

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions