cognite-extractor-utils 7.5.11__py3-none-any.whl → 7.5.13__py3-none-any.whl
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/extractorutils/__init__.py +1 -1
- cognite/extractorutils/base.py +8 -7
- cognite/extractorutils/configtools/loaders.py +5 -3
- cognite/extractorutils/uploader/time_series.py +1 -1
- {cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/METADATA +1 -10
- {cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/RECORD +8 -8
- {cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/WHEEL +0 -0
- {cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/licenses/LICENSE +0 -0
cognite/extractorutils/base.py
CHANGED
|
@@ -22,7 +22,7 @@ from threading import Thread
|
|
|
22
22
|
from types import TracebackType
|
|
23
23
|
from typing import Any, Generic, TypeVar
|
|
24
24
|
|
|
25
|
-
from dotenv import
|
|
25
|
+
from dotenv import load_dotenv
|
|
26
26
|
|
|
27
27
|
from cognite.client import CogniteClient
|
|
28
28
|
from cognite.client.data_classes import ExtractionPipeline, ExtractionPipelineRun
|
|
@@ -90,6 +90,7 @@ class Extractor(Generic[CustomConfigClass]):
|
|
|
90
90
|
handle_interrupts: bool = True,
|
|
91
91
|
reload_config_interval: int | None = 300,
|
|
92
92
|
reload_config_action: ReloadConfigAction = ReloadConfigAction.DO_NOTHING,
|
|
93
|
+
success_message: str = "Successful shutdown",
|
|
93
94
|
):
|
|
94
95
|
self.name = name
|
|
95
96
|
self.description = description
|
|
@@ -104,6 +105,7 @@ class Extractor(Generic[CustomConfigClass]):
|
|
|
104
105
|
self.handle_interrupts = handle_interrupts
|
|
105
106
|
self.reload_config_interval = reload_config_interval
|
|
106
107
|
self.reload_config_action = reload_config_action
|
|
108
|
+
self.success_message = success_message
|
|
107
109
|
|
|
108
110
|
self.started = False
|
|
109
111
|
self.configured_logger = False
|
|
@@ -218,7 +220,7 @@ class Extractor(Generic[CustomConfigClass]):
|
|
|
218
220
|
ExtractionPipelineRun(
|
|
219
221
|
extpipe_external_id=self.extraction_pipeline.external_id,
|
|
220
222
|
status="success",
|
|
221
|
-
message=
|
|
223
|
+
message=self.success_message,
|
|
222
224
|
)
|
|
223
225
|
)
|
|
224
226
|
|
|
@@ -250,12 +252,11 @@ class Extractor(Generic[CustomConfigClass]):
|
|
|
250
252
|
|
|
251
253
|
if str(os.getenv("COGNITE_FUNCTION_RUNTIME", False)).lower() != "true":
|
|
252
254
|
# Environment Variables
|
|
253
|
-
|
|
254
|
-
if
|
|
255
|
-
|
|
256
|
-
dotenv_message = f"Successfully ingested environment variables from {env_file_path}"
|
|
255
|
+
env_file_found = load_dotenv(dotenv_path="./.env", override=True)
|
|
256
|
+
if env_file_found:
|
|
257
|
+
dotenv_message = "Successfully ingested environment variables from './.env'"
|
|
257
258
|
else:
|
|
258
|
-
dotenv_message = "No .env file found"
|
|
259
|
+
dotenv_message = "No .env file found at {Path.cwd() / '.env'}"
|
|
259
260
|
else:
|
|
260
261
|
dotenv_message = "No .env file imported when using Cognite Functions"
|
|
261
262
|
|
|
@@ -69,7 +69,7 @@ class KeyVaultLoader:
|
|
|
69
69
|
self.client: SecretClient | None = None
|
|
70
70
|
|
|
71
71
|
def _init_client(self) -> None:
|
|
72
|
-
from dotenv import
|
|
72
|
+
from dotenv import load_dotenv
|
|
73
73
|
|
|
74
74
|
if not self.config:
|
|
75
75
|
raise InvalidConfigError(
|
|
@@ -98,8 +98,10 @@ class KeyVaultLoader:
|
|
|
98
98
|
|
|
99
99
|
_logger.info("Using Azure ClientSecret credentials to access KeyVault")
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
env_file_found = load_dotenv("./.env", override=True)
|
|
102
|
+
|
|
103
|
+
if not env_file_found:
|
|
104
|
+
_logger.info(f"Local environment file not found at {Path.cwd() / '.env'}")
|
|
103
105
|
|
|
104
106
|
if all(param in self.config for param in auth_parameters):
|
|
105
107
|
tenant_id = os.path.expandvars(self.config.get("tenant-id", None))
|
|
@@ -72,7 +72,7 @@ def default_time_series_factory(external_id: str, datapoints: DataPointList) ->
|
|
|
72
72
|
A TimeSeries object with external_id set, and the is_string automatically detected
|
|
73
73
|
"""
|
|
74
74
|
is_string = (
|
|
75
|
-
isinstance(datapoints[0].get("value"), str)
|
|
75
|
+
isinstance(datapoints[0].get("value"), str)
|
|
76
76
|
if isinstance(datapoints[0], dict)
|
|
77
77
|
else isinstance(datapoints[0][1], str)
|
|
78
78
|
)
|
{cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cognite-extractor-utils
|
|
3
|
-
Version: 7.5.
|
|
3
|
+
Version: 7.5.13
|
|
4
4
|
Summary: Utilities for easier development of extractors for CDF
|
|
5
5
|
Project-URL: repository, https://github.com/cognitedata/python-extractor-utils
|
|
6
6
|
Author-email: Mathias Lohne <mathias.lohne@cognite.com>
|
|
@@ -72,15 +72,6 @@ project, and then set up a poetry environment, git repository, commit hooks with
|
|
|
72
72
|
template.
|
|
73
73
|
|
|
74
74
|
|
|
75
|
-
### Extensions
|
|
76
|
-
|
|
77
|
-
Some source systems have a lot in common, such as RESTful APIs or systems exposing as MQTT. We therefore have extensions
|
|
78
|
-
to `extractor-utils` tailroed to these protocols. These can be found in separate packages:
|
|
79
|
-
|
|
80
|
-
* [REST extension](https://github.com/cognitedata/python-extractor-utils-rest)
|
|
81
|
-
* [MQTT extension](https://github.com/cognitedata/python-extractor-utils-mqtt)
|
|
82
|
-
|
|
83
|
-
|
|
84
75
|
## Contributing
|
|
85
76
|
|
|
86
77
|
The package is open source under the [Apache 2.0 license](./LICENSE), and contribtuions are welcome.
|
{cognite_extractor_utils-7.5.11.dist-info → cognite_extractor_utils-7.5.13.dist-info}/RECORD
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
cognite/extractorutils/__init__.py,sha256=
|
|
1
|
+
cognite/extractorutils/__init__.py,sha256=1tj9c-PWFN7i3jH6BuYbHEj0xM9tfxqJOF4W-c7GuYg,765
|
|
2
2
|
cognite/extractorutils/_inner_util.py,sha256=ZMZIBwFpSD39RzLZq_OJlrFtVt8NFOtU4ObzAG8vTB4,1779
|
|
3
|
-
cognite/extractorutils/base.py,sha256
|
|
3
|
+
cognite/extractorutils/base.py,sha256=eGz3sHHsLJWgPYTVw8xJ-7PJUK7GCK8K61CMpU5R3WU,16414
|
|
4
4
|
cognite/extractorutils/exceptions.py,sha256=4qreRiTwZH9lyLIKR67TP02MUxN9oYhCd2vFTb5bRME,1125
|
|
5
5
|
cognite/extractorutils/metrics.py,sha256=dBxtfJkTWcVbVpqM5VYmP4U3cO7iultz7k036Um4Tx0,15406
|
|
6
6
|
cognite/extractorutils/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -11,7 +11,7 @@ cognite/extractorutils/util.py,sha256=ZAx688yXV85xmWuAASlZ3e9yY5pvyR8H0r4rhnPdgF
|
|
|
11
11
|
cognite/extractorutils/configtools/__init__.py,sha256=LSa7gVws_mrLCMRTKGs1zfiG6-IM0HzyOF6x0EfllSo,3616
|
|
12
12
|
cognite/extractorutils/configtools/_util.py,sha256=VMxXXmPvNPf3Jjwknqm7i-Bp-z_ORN0DFKjBHgBsWA0,4773
|
|
13
13
|
cognite/extractorutils/configtools/elements.py,sha256=chgcv7WSOb1zbHl1XU5dlsCSB7SDTY4NeKREYNeF9kE,26590
|
|
14
|
-
cognite/extractorutils/configtools/loaders.py,sha256=
|
|
14
|
+
cognite/extractorutils/configtools/loaders.py,sha256=Iqyn1i050j8vDa2Bb7yJgW2I-riXgdbdFpGX9TRLU84,18374
|
|
15
15
|
cognite/extractorutils/configtools/validators.py,sha256=xug3GOMIO4NOdyyvXtYlpKyq9wuDtGf7-xqIefD5bIo,1016
|
|
16
16
|
cognite/extractorutils/statestore/__init__.py,sha256=hV3r11FUXkH6-60Ct6zLSROMNVrEeiE3Shmkf28Q-co,359
|
|
17
17
|
cognite/extractorutils/statestore/_base.py,sha256=mWdFk4EZl886V6uXRj4O2sv2_ANJ3Sigmgeql-XEsmc,2675
|
|
@@ -42,9 +42,9 @@ cognite/extractorutils/uploader/data_modeling.py,sha256=h4uRnppU2dVBquJz0Uy2SKNy
|
|
|
42
42
|
cognite/extractorutils/uploader/events.py,sha256=soU8TslPFIA7Ck4ATR_a7MHGitztRcn0cEt7LIbMPsE,5643
|
|
43
43
|
cognite/extractorutils/uploader/files.py,sha256=ag3TUrImJdAUiOSXugagD03-9WGlFpIyd31z3WMJU20,27180
|
|
44
44
|
cognite/extractorutils/uploader/raw.py,sha256=8duMk9uVJPK3O6C0nzwnvrl0UzBtJs_T_L1la0Vo89k,6713
|
|
45
|
-
cognite/extractorutils/uploader/time_series.py,sha256=
|
|
45
|
+
cognite/extractorutils/uploader/time_series.py,sha256=3HaKfWcSOTKFmB6VwpRwioOykkRa6qmruSSsZu8Njdk,26507
|
|
46
46
|
cognite/extractorutils/uploader/upload_failure_handler.py,sha256=wbUSXUP26rbmK2NGdQMzcWQwNOh2sXYOnlj0A_sk1n8,2003
|
|
47
|
-
cognite_extractor_utils-7.5.
|
|
48
|
-
cognite_extractor_utils-7.5.
|
|
49
|
-
cognite_extractor_utils-7.5.
|
|
50
|
-
cognite_extractor_utils-7.5.
|
|
47
|
+
cognite_extractor_utils-7.5.13.dist-info/METADATA,sha256=D2QVuO8G8mEmQ9tPMzhs062j4N8F4vkLQ3kPL3DWO4I,4889
|
|
48
|
+
cognite_extractor_utils-7.5.13.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
49
|
+
cognite_extractor_utils-7.5.13.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
|
|
50
|
+
cognite_extractor_utils-7.5.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|