cognite-extractor-utils 7.1.2__tar.gz → 7.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cognite-extractor-utils might be problematic. Click here for more details.
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/PKG-INFO +2 -2
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/__init__.py +1 -1
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/base.py +10 -2
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/configtools/elements.py +7 -2
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/statestore.py +1 -1
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/_base.py +1 -1
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/time_series.py +6 -2
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/pyproject.toml +4 -4
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/LICENSE +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/README.md +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/_inner_util.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/configtools/__init__.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/configtools/_util.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/configtools/loaders.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/exceptions.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/metrics.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/py.typed +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/threading.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/__init__.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/_metrics.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/assets.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/events.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/files.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader/raw.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader_extractor.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/uploader_types.py +0 -0
- {cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: cognite-extractor-utils
|
|
3
|
-
Version: 7.1.
|
|
3
|
+
Version: 7.1.4
|
|
4
4
|
Summary: Utilities for easier development of extractors for CDF
|
|
5
5
|
Home-page: https://github.com/cognitedata/python-extractor-utils
|
|
6
6
|
License: Apache-2.0
|
|
@@ -18,7 +18,7 @@ Provides-Extra: experimental
|
|
|
18
18
|
Requires-Dist: arrow (>=1.0.0,<2.0.0)
|
|
19
19
|
Requires-Dist: azure-identity (>=1.14.0,<2.0.0)
|
|
20
20
|
Requires-Dist: azure-keyvault-secrets (>=4.7.0,<5.0.0)
|
|
21
|
-
Requires-Dist: cognite-sdk (>=7.
|
|
21
|
+
Requires-Dist: cognite-sdk (>=7.41.0,<8.0.0)
|
|
22
22
|
Requires-Dist: dacite (>=1.6.0,<2.0.0)
|
|
23
23
|
Requires-Dist: decorator (>=5.1.1,<6.0.0)
|
|
24
24
|
Requires-Dist: more-itertools (>=10.0.0,<11.0.0)
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/base.py
RENAMED
|
@@ -189,9 +189,17 @@ class Extractor(Generic[CustomConfigClass]):
|
|
|
189
189
|
|
|
190
190
|
state_store_config = recursive_find_state_store(self.config.__dict__)
|
|
191
191
|
if state_store_config:
|
|
192
|
-
self.state_store = state_store_config.create_state_store(
|
|
192
|
+
self.state_store = state_store_config.create_state_store(
|
|
193
|
+
cdf_client=self.cognite_client,
|
|
194
|
+
default_to_local=self.use_default_state_store,
|
|
195
|
+
cancellation_token=self.cancellation_token,
|
|
196
|
+
)
|
|
193
197
|
else:
|
|
194
|
-
self.state_store =
|
|
198
|
+
self.state_store = (
|
|
199
|
+
LocalStateStore("states.json", cancellation_token=self.cancellation_token)
|
|
200
|
+
if self.use_default_state_store
|
|
201
|
+
else NoStateStore()
|
|
202
|
+
)
|
|
195
203
|
|
|
196
204
|
try:
|
|
197
205
|
self.state_store.initialize()
|
|
@@ -623,7 +623,10 @@ class StateStoreConfig:
|
|
|
623
623
|
local: Optional[LocalStateStoreConfig] = None
|
|
624
624
|
|
|
625
625
|
def create_state_store(
|
|
626
|
-
self,
|
|
626
|
+
self,
|
|
627
|
+
cdf_client: Optional[CogniteClient] = None,
|
|
628
|
+
default_to_local: bool = True,
|
|
629
|
+
cancellation_token: Optional[CancellationToken] = None,
|
|
627
630
|
) -> AbstractStateStore:
|
|
628
631
|
"""
|
|
629
632
|
Create a state store object based on the config.
|
|
@@ -648,15 +651,17 @@ class StateStoreConfig:
|
|
|
648
651
|
database=self.raw.database,
|
|
649
652
|
table=self.raw.table,
|
|
650
653
|
save_interval=self.raw.upload_interval.seconds,
|
|
654
|
+
cancellation_token=cancellation_token,
|
|
651
655
|
)
|
|
652
656
|
|
|
653
657
|
if self.local:
|
|
654
658
|
return LocalStateStore(
|
|
655
659
|
file_path=self.local.path,
|
|
656
660
|
save_interval=self.local.save_interval.seconds,
|
|
661
|
+
cancellation_token=cancellation_token,
|
|
657
662
|
)
|
|
658
663
|
|
|
659
664
|
if default_to_local:
|
|
660
|
-
return LocalStateStore(file_path="states.json")
|
|
665
|
+
return LocalStateStore(file_path="states.json", cancellation_token=cancellation_token)
|
|
661
666
|
else:
|
|
662
667
|
return NoStateStore()
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/statestore.py
RENAMED
|
@@ -132,7 +132,7 @@ class AbstractStateStore(ABC):
|
|
|
132
132
|
|
|
133
133
|
self.logger = logging.getLogger(__name__)
|
|
134
134
|
|
|
135
|
-
self.thread = threading.Thread(target=self._run, daemon=
|
|
135
|
+
self.thread = threading.Thread(target=self._run, daemon=cancellation_token is None, name=thread_name)
|
|
136
136
|
self.lock = threading.RLock()
|
|
137
137
|
self.cancellation_token = cancellation_token.create_child_token() if cancellation_token else CancellationToken()
|
|
138
138
|
|
|
@@ -58,7 +58,7 @@ class AbstractUploadQueue(ABC):
|
|
|
58
58
|
self.trigger_log_level = _resolve_log_level(trigger_log_level)
|
|
59
59
|
self.logger = logging.getLogger(__name__)
|
|
60
60
|
|
|
61
|
-
self.thread = threading.Thread(target=self._run, daemon=
|
|
61
|
+
self.thread = threading.Thread(target=self._run, daemon=cancellation_token is None, name=thread_name)
|
|
62
62
|
self.lock = threading.RLock()
|
|
63
63
|
self.cancellation_token: CancellationToken = (
|
|
64
64
|
cancellation_token.create_child_token() if cancellation_token else CancellationToken()
|
|
@@ -22,6 +22,7 @@ from cognite.client.data_classes import (
|
|
|
22
22
|
Sequence,
|
|
23
23
|
SequenceData,
|
|
24
24
|
SequenceRows,
|
|
25
|
+
StatusCode,
|
|
25
26
|
TimeSeries,
|
|
26
27
|
)
|
|
27
28
|
from cognite.client.exceptions import CogniteDuplicatedError, CogniteNotFoundError
|
|
@@ -51,7 +52,10 @@ MIN_DATAPOINT_VALUE = -1e100
|
|
|
51
52
|
|
|
52
53
|
TimeStamp = Union[int, datetime]
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
DataPointWithoutStatus = Union[Tuple[TimeStamp, float], Tuple[TimeStamp, str], Tuple[TimeStamp, int]]
|
|
56
|
+
FullStatusCode = Union[StatusCode, int]
|
|
57
|
+
DataPointWithStatus = Union[Tuple[TimeStamp, float, FullStatusCode], Tuple[TimeStamp, str, FullStatusCode]]
|
|
58
|
+
DataPoint = Union[DataPointWithoutStatus, DataPointWithStatus]
|
|
55
59
|
DataPointList = List[DataPoint]
|
|
56
60
|
|
|
57
61
|
|
|
@@ -283,7 +287,7 @@ class TimeSeriesUploadQueue(AbstractUploadQueue):
|
|
|
283
287
|
with self.lock:
|
|
284
288
|
upload_this = _upload_batch(
|
|
285
289
|
[
|
|
286
|
-
{either_id.type(): either_id.content(), "datapoints": datapoints}
|
|
290
|
+
{either_id.type(): either_id.content(), "datapoints": list(datapoints)}
|
|
287
291
|
for either_id, datapoints in self.upload_queue.items()
|
|
288
292
|
if len(datapoints) > 0
|
|
289
293
|
]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "cognite-extractor-utils"
|
|
3
|
-
version = "7.1.
|
|
3
|
+
version = "7.1.4"
|
|
4
4
|
description = "Utilities for easier development of extractors for CDF"
|
|
5
5
|
authors = ["Mathias Lohne <mathias.lohne@cognite.com>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -53,7 +53,7 @@ exclude = "tests/*"
|
|
|
53
53
|
|
|
54
54
|
[tool.poetry.dependencies]
|
|
55
55
|
python = "^3.8.0"
|
|
56
|
-
cognite-sdk = "
|
|
56
|
+
cognite-sdk = "^7.41.0"
|
|
57
57
|
prometheus-client = ">0.7.0, <=1.0.0"
|
|
58
58
|
arrow = "^1.0.0"
|
|
59
59
|
pyyaml = ">=5.3.0, <7"
|
|
@@ -70,8 +70,8 @@ azure-keyvault-secrets = "^4.7.0"
|
|
|
70
70
|
experimental = ["cognite-sdk-experimental"]
|
|
71
71
|
|
|
72
72
|
[tool.poetry.group.dev.dependencies]
|
|
73
|
-
mypy = "1.
|
|
74
|
-
ruff = "^0.
|
|
73
|
+
mypy = "1.10.0"
|
|
74
|
+
ruff = "^0.4.0"
|
|
75
75
|
pytest = "^8.0.0"
|
|
76
76
|
pytest-cov = "^5.0.0"
|
|
77
77
|
sphinx = "^7.0.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/exceptions.py
RENAMED
|
File without changes
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/metrics.py
RENAMED
|
File without changes
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/py.typed
RENAMED
|
File without changes
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/threading.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cognite_extractor_utils-7.1.2 → cognite_extractor_utils-7.1.4}/cognite/extractorutils/util.py
RENAMED
|
File without changes
|