Skip to content

Commit aee4191

Browse files
gabrysnormandy7
andauthored
PY-194 Improve the error message in NeptuneRetryError (#11)
* PY-194 Improve the error message in NeptuneRetryError Improve the error message to tell what the SOFT and HARD timeouts are set to (against the time spent on the request) and how to bump them. * Update src/neptune_query/exceptions.py Co-authored-by: Sabine Ståhlberg <sabine.stahlberg@neptune.ai> --------- Co-authored-by: Sabine Ståhlberg <sabine.stahlberg@neptune.ai>
1 parent c2869dd commit aee4191

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/neptune_query/exceptions.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,25 @@ def __init__(
206206
"""
207207
{h1}NeptuneRetryError: The Neptune server returned an error after {retries} retries, {time:.2f} seconds.{end}
208208
209+
The retry logic handles rate limiting and network errors. To adjust the timeouts for retrying server requests,
210+
change the values of the following environment variables, which are currently set to:
211+
212+
NEPTUNE_QUERY_RETRY_SOFT_TIMEOUT={soft_limit}
213+
NEPTUNE_QUERY_RETRY_HARD_TIMEOUT={hard_limit}
214+
215+
For details, see the docs:
216+
https://docs.neptune.ai/environment_variables/neptune_query#neptune_query_retry_soft_timeout
217+
https://docs.neptune.ai/environment_variables/neptune_query#neptune_query_retry_hard_timeout
218+
209219
{status_code_line}
210220
{content_line}
211221
""",
212222
retries=retries,
213223
time=time,
214224
status_code_line=f"Last response status: {last_status_code}" if last_status_code is not None else "",
215225
content_line=f"Last response content: {content_str}" if last_content is not None else "",
226+
soft_limit=env.NEPTUNE_QUERY_RETRY_SOFT_TIMEOUT.get(),
227+
hard_limit=env.NEPTUNE_QUERY_RETRY_HARD_TIMEOUT.get(),
216228
)
217229

218230

@@ -301,7 +313,7 @@ def warn_unsupported_value_type(type_: str) -> None:
301313
_warned_types.add(type_)
302314
warnings.warn(
303315
f"A value of type `{type_}` was returned by your query. This type is not supported by your installed version "
304-
"of neptune-fetcher. Values will evaluate to `None` and empty DataFrames. "
305-
"Upgrade neptune-fetcher to access this data.",
316+
"of neptune-query. Values will evaluate to `None` and empty DataFrames. "
317+
"Upgrade neptune-query to access this data.",
306318
NeptuneWarning,
307319
)

0 commit comments

Comments
 (0)