cognite-extractor-utils 7.8.0__py3-none-any.whl → 7.8.1__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.

@@ -16,7 +16,7 @@
16
16
  Cognite extractor utils is a Python package that simplifies the development of new extractors.
17
17
  """
18
18
 
19
- __version__ = "7.8.0"
19
+ __version__ = "7.8.1"
20
20
  from .base import Extractor
21
21
 
22
22
  __all__ = ["Extractor"]
@@ -384,8 +384,22 @@ class ConfigResolver(Generic[CustomConfigClass]):
384
384
  self._cognite_client: CogniteClient | None = None
385
385
 
386
386
  def _reload_file(self) -> None:
387
- with open(self.config_path, encoding="utf-8") as stream:
388
- self._config_text = stream.read()
387
+ try:
388
+ with open(self.config_path, encoding="utf-8") as stream:
389
+ self._config_text = stream.read()
390
+ except UnicodeDecodeError:
391
+ _logger.warning(
392
+ f"Config file '{self.config_path}' is not valid UTF-8. Falling back to system default encoding."
393
+ )
394
+ try:
395
+ with open(self.config_path) as stream:
396
+ self._config_text = stream.read()
397
+ except Exception as e:
398
+ _logger.error(
399
+ f"Failed to read '{self.config_path}' with both UTF-8 and system default encoding. "
400
+ f"The file may be corrupt or in an unsupported format. Final error: {e}"
401
+ )
402
+ raise RuntimeError("Unable to read configuration file.") from e
389
403
 
390
404
  @property
391
405
  def cognite_client(self) -> CogniteClient | None:
@@ -220,14 +220,13 @@ class Extractor(Generic[ConfigType], CogniteLogger):
220
220
  case LogConsoleHandlerConfig() as console_handler:
221
221
  sh = logging.StreamHandler()
222
222
  sh.setFormatter(fmt)
223
- level_for_handler = _resolve_log_level(
224
- self.log_level_override if self.log_level_override else console_handler.level.value
225
- )
223
+ level_for_handler = _resolve_log_level(self.log_level_override or console_handler.level.value)
226
224
  sh.setLevel(level_for_handler)
227
225
 
228
226
  root.addHandler(sh)
229
227
 
230
228
  case LogFileHandlerConfig() as file_handler:
229
+ level_for_handler = _resolve_log_level(self.log_level_override or file_handler.level.value)
231
230
  try:
232
231
  fh = RobustFileHandler(
233
232
  filename=file_handler.path,
@@ -236,23 +235,20 @@ class Extractor(Generic[ConfigType], CogniteLogger):
236
235
  backupCount=file_handler.retention,
237
236
  create_dirs=True,
238
237
  )
239
- level_for_handler = _resolve_log_level(
240
- self.log_level_override if self.log_level_override else file_handler.level.value
241
- )
242
238
  fh.setLevel(level_for_handler)
243
239
  fh.setFormatter(fmt)
244
240
 
245
241
  root.addHandler(fh)
246
242
  except (OSError, PermissionError) as e:
247
- self._logger.warning(
248
- f"Could not create or write to log file {file_handler.path}: {e}. "
249
- "Falling back to console logging."
250
- )
251
243
  if not any(isinstance(h, logging.StreamHandler) for h in root.handlers):
252
244
  sh = logging.StreamHandler()
253
245
  sh.setFormatter(fmt)
254
246
  sh.setLevel(level_for_handler)
255
247
  root.addHandler(sh)
248
+ self._logger.warning(
249
+ f"Could not create or write to log file {file_handler.path}: {e}. "
250
+ "Defaulted to console logging."
251
+ )
256
252
 
257
253
  def _load_state_store(self) -> None:
258
254
  """
@@ -180,8 +180,8 @@ class Runtime(Generic[ExtractorType]):
180
180
  choices=["debug", "info", "warning", "error", "critical"],
181
181
  type=str,
182
182
  required=False,
183
- default="info",
184
- help="Set the logging level for the runtime. Default is 'info'.",
183
+ default=None,
184
+ help="Set the logging level for the runtime.",
185
185
  )
186
186
  argparser.add_argument(
187
187
  "--skip-init-checks",
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cognite-extractor-utils
3
- Version: 7.8.0
3
+ Version: 7.8.1
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>
@@ -14,7 +14,7 @@ Requires-Dist: azure-identity>=1.14.0
14
14
  Requires-Dist: azure-keyvault-secrets>=4.7.0
15
15
  Requires-Dist: cognite-sdk>=7.75.2
16
16
  Requires-Dist: croniter>=6.0.0
17
- Requires-Dist: dacite<1.9.0,>=1.6.0
17
+ Requires-Dist: dacite<1.10.0,>=1.9.2
18
18
  Requires-Dist: decorator>=5.1.1
19
19
  Requires-Dist: httpx<1,>=0.27.0
20
20
  Requires-Dist: jsonlines>=4.0.0
@@ -1,7 +1,7 @@
1
1
  cognite/examples/unstable/extractors/simple_extractor/main.py,sha256=iiRevhLXqVAPXSxTu2Rz_TJY2BZKRLs4_MjvpcrkLg0,2477
2
2
  cognite/examples/unstable/extractors/simple_extractor/config/config.yaml,sha256=L4S2mOFy5YfHvqieJ-1obiWzd4HW-2WqBGDWGMad06Q,48
3
3
  cognite/examples/unstable/extractors/simple_extractor/config/connection_config.yaml,sha256=dseAyexkld4mgft61Bbmq8SuH2GV5nlUW_SLpDFrtoA,295
4
- cognite/extractorutils/__init__.py,sha256=tpU3-GA6qi0aydjedIX9GoBM9zHjtP37OnGNCZ6E0BI,764
4
+ cognite/extractorutils/__init__.py,sha256=valGn4k3kPpy__bt7u77XNCM3svJ6tBmJ0pU3voR1tY,764
5
5
  cognite/extractorutils/_inner_util.py,sha256=iiW8ngteYD-5RF3zuvw3adet4kfJdYL8eFfxWccQ8Zs,1812
6
6
  cognite/extractorutils/base.py,sha256=UCQzrdeV_x5Ok00oPU9-U6lndoBTGVXAWEIXbXkfivI,18613
7
7
  cognite/extractorutils/exceptions.py,sha256=vKJcy3cKJY23U1QU83BwmpEkHh5ryMLw_fieTtWLNS0,1369
@@ -14,7 +14,7 @@ cognite/extractorutils/util.py,sha256=DBOQhQuKoDS9D2HsRM519TurLvv2AKLOtS_b4EtD7J
14
14
  cognite/extractorutils/configtools/__init__.py,sha256=oK0VmZ5hBEuTRwJebVPl_3zlbf6P_Cf5G3VU7u6Shic,3533
15
15
  cognite/extractorutils/configtools/_util.py,sha256=NVGaUjCwUCKFMFOKZxco02q6jwdVU4vHYk67i6R_Zxc,4829
16
16
  cognite/extractorutils/configtools/elements.py,sha256=MRAzfL2ZhXFJ3zry5lrOQbhhK-TGfRcmPcginMwyGDE,31776
17
- cognite/extractorutils/configtools/loaders.py,sha256=I7F67HiMQeQiUh-NrQ3XXa5iugGA-LxhQmZepWp4Pr0,20055
17
+ cognite/extractorutils/configtools/loaders.py,sha256=vnStVa_d5B8BTyy5Rq6e6TbVLbvkj0xwql684mKSIgw,20755
18
18
  cognite/extractorutils/configtools/validators.py,sha256=Gaq0DkWqFdfG6M0ySAqCzXVtyF4DVxiOyn0SQyCOfeo,1089
19
19
  cognite/extractorutils/statestore/__init__.py,sha256=tkXba5SNBkQa559ZcMe0acY7zjwy4lPI9rWjwdbiRlo,2759
20
20
  cognite/extractorutils/statestore/_base.py,sha256=zEMPAPB3RJfJHQUyOuepF0mTgJ2y7WT0YQM6irj1YQg,2797
@@ -28,12 +28,12 @@ cognite/extractorutils/unstable/configuration/models.py,sha256=pcJAvYgj8-SM6RCSJ
28
28
  cognite/extractorutils/unstable/core/__init__.py,sha256=f0LREaOHQig5hL59jfDn9FYfUIR_e1cgqDCIqTJV_VI,213
29
29
  cognite/extractorutils/unstable/core/_dto.py,sha256=iu6bokFPu4eVfv3A43zPkOTPbeegP5wFPdh20oDNWZY,3559
30
30
  cognite/extractorutils/unstable/core/_messaging.py,sha256=D9rOW8fijryXffbm90d8VTf2vy5FmwVGU-H0O-cn-EI,68
31
- cognite/extractorutils/unstable/core/base.py,sha256=7Hqjk1mBaI0KS3m5fYhIvIrt72HPcZBS8K6FrzS9Qk0,19332
31
+ cognite/extractorutils/unstable/core/base.py,sha256=AdP6DyxhPo85e10f2YohRNICMUz11Gr1hzc3AF7BCM8,19167
32
32
  cognite/extractorutils/unstable/core/checkin_worker.py,sha256=yJ4MjJoeL96ZqWE-stntSBp7PdjJZe9A8GR_ulxS200,18109
33
33
  cognite/extractorutils/unstable/core/errors.py,sha256=x6IKlINVdsDoH3qUuE5n9XwJw3b69hol5ecoMCPMCOE,3544
34
34
  cognite/extractorutils/unstable/core/logger.py,sha256=6u96SFSTzapLuQP4kK6NFi9dgpoZEwJGlf9sVbVVCi8,11582
35
35
  cognite/extractorutils/unstable/core/restart_policy.py,sha256=UakVHntfffAGeye_tV0NltfR8U8xsdL8KS5OAB3BNkk,1279
36
- cognite/extractorutils/unstable/core/runtime.py,sha256=YstVsyYFWJ-M-RA7gzSYHV_GLBZSyzcyAZVN8chpJeA,19336
36
+ cognite/extractorutils/unstable/core/runtime.py,sha256=U1gK1cKDjoVeVtIiUd0jj3PwHtNfcfbgdD23exMLCVg,19315
37
37
  cognite/extractorutils/unstable/core/tasks.py,sha256=--hsaN5UCJ7_I-4fl4l8EasP1khe_R_6BqotobXBk_I,5033
38
38
  cognite/extractorutils/unstable/scheduling/__init__.py,sha256=NGVNw-dq7eYwm8jLwb8ChPTSyfAnAKMzi3_QDsh46yw,809
39
39
  cognite/extractorutils/unstable/scheduling/_scheduler.py,sha256=xfAKAI_pyahdFo7zPOmvAQ_16MFE46zFIYSopzwpLag,3741
@@ -48,8 +48,8 @@ cognite/extractorutils/uploader/files.py,sha256=-cyF1w36ebgcqj3OFJYq8WP-CtRIP7wT
48
48
  cognite/extractorutils/uploader/raw.py,sha256=fNq8OFpIvHwwancsmhsF6iDLub5bgCpdw879Ycmb7aI,6762
49
49
  cognite/extractorutils/uploader/time_series.py,sha256=Jo8Tz3X6dvhgt8_8GwX6ETDs_DtS0DaHjiH72BQGnSo,37356
50
50
  cognite/extractorutils/uploader/upload_failure_handler.py,sha256=nXw9IVcOxxuywd_17ybXijdpo0omtY0Bkb9fT_fWYFM,3048
51
- cognite_extractor_utils-7.8.0.dist-info/METADATA,sha256=BxsNO2gAj8VsYVVCdRufx1wGUJ4za904gQ1suTJOGaQ,4953
52
- cognite_extractor_utils-7.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
- cognite_extractor_utils-7.8.0.dist-info/entry_points.txt,sha256=Ht51dVybSQan2zbaLCUPMBSNR4Pi-0lSKYm5j8VTBMA,101
54
- cognite_extractor_utils-7.8.0.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
55
- cognite_extractor_utils-7.8.0.dist-info/RECORD,,
51
+ cognite_extractor_utils-7.8.1.dist-info/METADATA,sha256=Z9eWbGiUuRpLhzivaSAL5lK37hb1DJa2DKjP7mJkEww,4954
52
+ cognite_extractor_utils-7.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
53
+ cognite_extractor_utils-7.8.1.dist-info/entry_points.txt,sha256=Ht51dVybSQan2zbaLCUPMBSNR4Pi-0lSKYm5j8VTBMA,101
54
+ cognite_extractor_utils-7.8.1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
55
+ cognite_extractor_utils-7.8.1.dist-info/RECORD,,