Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Statestore: Retry on connection errors #273

Merged
merged 4 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [6.0.2]

### Fixed

* Improved the state store retry behavior to handle connection errors

## [6.0.1]

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion cognite/extractorutils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
Cognite extractor utils is a Python package that simplifies the development of new extractors.
"""

__version__ = "6.0.1"
__version__ = "6.0.2"
from .base import Extractor
10 changes: 4 additions & 6 deletions cognite/extractorutils/statestore.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,8 @@
from types import TracebackType
from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, Union

from requests.exceptions import ConnectionError

from cognite.client import CogniteClient
from cognite.client.exceptions import CogniteAPIError
from cognite.client.exceptions import CogniteAPIError, CogniteException
from cognite.extractorutils.uploader import DataPointList

from ._inner_util import _DecimalDecoder, _DecimalEncoder, _resolve_log_level
Expand Down Expand Up @@ -348,7 +346,7 @@ def __init__(
self._ensure_table()

@retry(
exceptions=(CogniteAPIError, ConnectionError),
exceptions=(CogniteException,),
tries=RETRIES,
delay=RETRY_DELAY,
max_delay=RETRY_MAX_DELAY,
Expand All @@ -370,7 +368,7 @@ def initialize(self, force: bool = False) -> None:
self._initialize_implementation(force)

@retry(
exceptions=(CogniteAPIError, ConnectionError),
exceptions=(CogniteException,),
tries=RETRIES,
delay=RETRY_DELAY,
max_delay=RETRY_MAX_DELAY,
Expand Down Expand Up @@ -404,7 +402,7 @@ def synchronize(self) -> None:
self._synchronize_implementation()

@retry(
exceptions=(CogniteAPIError, ConnectionError),
exceptions=(CogniteException,),
tries=RETRIES,
delay=RETRY_DELAY,
max_delay=RETRY_MAX_DELAY,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "cognite-extractor-utils"
version = "6.0.1"
version = "6.0.2"
description = "Utilities for easier development of extractors for CDF"
authors = ["Mathias Lohne <[email protected]>"]
license = "Apache-2.0"
Expand Down