diff --git a/python/lib/sift_client/_internal/low_level_wrappers/data.py b/python/lib/sift_client/_internal/low_level_wrappers/data.py index e5370bbe7..d76b9a787 100644 --- a/python/lib/sift_client/_internal/low_level_wrappers/data.py +++ b/python/lib/sift_client/_internal/low_level_wrappers/data.py @@ -3,7 +3,6 @@ import asyncio import logging from datetime import datetime, timezone -from math import ceil from typing import TYPE_CHECKING, Any, cast import pandas as pd @@ -231,7 +230,8 @@ async def get_channel_data( run_id: str | None = None, start_time: datetime | None = None, end_time: datetime | None = None, - limit: int | None = None, + max_results: int | None = None, + page_size: int | None = None, ignore_cache: bool = False, ) -> dict[str, pd.DataFrame]: """Get the data for a channel during a run.""" @@ -247,10 +247,11 @@ async def get_channel_data( ) tasks = [] - page_size = limit if limit and limit < 1000 else 1000 - limit = ceil(limit / page_size) if limit else 10 # Queue up calls for non-cached channels in batches. batch_size = REQUEST_BATCH_SIZE + page_size = None + if max_results is not None and max_results <= CHANNELS_DEFAULT_PAGE_SIZE: + page_size = max_results for i in range(0, len(not_cached_channels), batch_size): # type: ignore batch = not_cached_channels[i : i + batch_size] # type: ignore @@ -264,7 +265,7 @@ async def get_channel_data( "end_time": end_time, }, page_size=page_size, - max_results=limit, + max_results=max_results, ) ) tasks.append(task) @@ -294,7 +295,7 @@ async def get_channel_data( "end_time": new_end_time or end_time, }, page_size=page_size, - max_results=limit, + max_results=max_results, ) ) tasks.append(task) diff --git a/python/lib/sift_client/resources/channels.py b/python/lib/sift_client/resources/channels.py index d946d094f..c780a785e 100644 --- a/python/lib/sift_client/resources/channels.py +++ b/python/lib/sift_client/resources/channels.py @@ -199,7 +199,7 @@ async def get_data( run_id=run_id, start_time=start_time, end_time=end_time, - limit=limit, + max_results=limit, ) async def get_data_as_arrow(