Skip to content

Commit

Permalink
fix: Rename retrieve_engine_queue_stats to retrieve_engine_queues
Browse files Browse the repository at this point in the history
The new name better conveys the essence that we're retrieving only a list of queues associated with the given engine. The docstring pointing to official documentation was also corrected.
  • Loading branch information
Milan Ondrašovič committed Jan 23, 2025
1 parent 0f936d2 commit 7583358
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions rossum_api/elis_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@ async def retrieve_engine_fields(
):
yield self._deserializer(Resource.EngineField, engine_field)

async def retrieve_engine_queue_stats(self, engine_id: int) -> AsyncIterator[Queue]:
"""https://elis.rossum.ai/api/docs/internal/#get-queue-statistics-for-an-engine."""
async def retrieve_engine_queues(self, engine_id: int) -> AsyncIterator[Queue]:
"""https://elis.rossum.ai/api/docs/internal/#list-all-queues."""
async for queue in self._http_client.fetch_all(Resource.Queue, engine=engine_id):
yield self._deserializer(Resource.Queue, queue)

Expand Down
6 changes: 3 additions & 3 deletions rossum_api/elis_api_client_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ def retrieve_engine_fields(self, engine_id: int | None = None) -> Iterator[Engin
"""https://elis.rossum.ai/api/docs/internal/#engine-field."""
return self._iter_over_async(self.elis_api_client.retrieve_engine_fields(engine_id))

def retrieve_engine_queue_stats(self, engine_id: int) -> Iterator[Queue]:
"""https://elis.rossum.ai/api/docs/internal/#get-queue-statistics-for-an-engine."""
return self._iter_over_async(self.elis_api_client.retrieve_engine_queue_stats(engine_id))
def retrieve_engine_queues(self, engine_id: int) -> Iterator[Queue]:
"""https://elis.rossum.ai/api/docs/internal/#list-all-queues."""
return self._iter_over_async(self.elis_api_client.retrieve_engine_queues(engine_id))

# ##### USERS #####
def list_all_users(self, ordering: Sequence[str] = (), **filters: Any) -> Iterator[User]:
Expand Down
4 changes: 2 additions & 2 deletions tests/elis_api_client/test_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ async def test_list_all_engines(self, elis_client, dummy_engine, mock_generator)

http_client.fetch_all.assert_called_with(Resource.Engine, (), ())

async def test_retrieve_engine_queue_stats(self, elis_client, dummy_queue, mock_generator):
async def test_retrieve_engine_queues(self, elis_client, dummy_queue, mock_generator):
client, http_client = elis_client
http_client.fetch_all.return_value = mock_generator(dummy_queue)

queues = client.retrieve_engine_queue_stats(TEST_ENGINE_ID)
queues = client.retrieve_engine_queues(TEST_ENGINE_ID)

async for queue in queues:
assert queue == Queue(**dummy_queue)
Expand Down

0 comments on commit 7583358

Please sign in to comment.