Skip to content

Commit

Permalink
move the warning log to get_results
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed May 10, 2024
1 parent d4da222 commit 9554721
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 8 additions & 4 deletions dune_client/api/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
ResultsResponse,
ExecutionResultCSV,
DuneError,
ExecutionState,
)
from dune_client.query import QueryBase

Expand Down Expand Up @@ -128,9 +129,7 @@ def get_execution_results_csv(
return self._get_execution_results_csv_by_url(url=url, params=params)

def _get_execution_results_by_url(
self,
url: str,
params: Optional[Dict[str, Any]] = None,
self, url: str, params: Optional[Dict[str, Any]] = None, job_id=None
) -> ResultsResponse:
"""
GET results from Dune API with a given URL. This is particularly useful for pagination.
Expand All @@ -139,7 +138,12 @@ def _get_execution_results_by_url(

response_json = self._get(url=url, params=params)
try:
return ResultsResponse.from_dict(response_json)
result = ResultsResponse.from_dict(response_json)
if result.state == ExecutionState.PARTIAL:
self.logger.warning(
f"execution {job_id} resulted in a partial result set (i.e. results too large)."
)
return result
except KeyError as err:
raise DuneError(response_json, "ResultsResponse", err) from err

Expand Down
4 changes: 0 additions & 4 deletions dune_client/api/extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,6 @@ def _refresh(
if status.state == ExecutionState.FAILED:
self.logger.error(status)
raise QueryFailed(f"Error data: {status.error}")
if status.state == ExecutionState.PARTIAL:
self.logger.warning(
f"execution {job_id} resulted in a partial result set (i.e. results too large)."
)
return job_id

def _fetch_entire_result(
Expand Down

0 comments on commit 9554721

Please sign in to comment.