Skip to content

Commit 18c597b

Browse files
authored
Improve Error logging (#502)
1 parent efa90c7 commit 18c597b

File tree

7 files changed

+13
-6
lines changed

7 files changed

+13
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ Changes are grouped as follows
1313
- `Security` in case of vulnerabilities.
1414

1515

16+
## 7.11.4
17+
18+
### Fixed
19+
* In the `unstable` package: Improved error logging and error messages when config revision changes are detected
20+
21+
1622
## 7.11.3
1723

1824
### Fixed

cognite/extractorutils/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
Cognite extractor utils is a Python package that simplifies the development of new extractors.
1717
"""
1818

19-
__version__ = "7.11.3"
19+
__version__ = "7.11.4"
2020
from .base import Extractor
2121

2222
__all__ = ["Extractor"]

cognite/extractorutils/unstable/core/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,9 @@ def run_task(task_context: TaskContext) -> None:
427427
target(task_context)
428428

429429
except Exception as e:
430-
# Task crashed, record it as a fatal error
430+
# Task failed, record it as a fatal error
431431
task_context.exception(
432-
f"Task {task.name} crashed unexpectedly",
432+
f"Task {task.name} failed unexpectedly",
433433
e,
434434
level=ErrorLevel.fatal,
435435
)

cognite/extractorutils/unstable/core/checkin_worker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,14 +195,14 @@ def _handle_checkin_response(self, response: JSONType) -> None:
195195
"and configured to use remote config for the new config to take effect.",
196196
)
197197
elif self._active_revision < checkin_response.last_config_revision:
198-
self._active_revision = checkin_response.last_config_revision
199198
if self._on_revision_change is not None:
200199
self._logger.info(
201200
"Remote config revision changed %s -> %s. The extractor will now use the new configuration.",
202201
self._active_revision,
203202
checkin_response.last_config_revision,
204203
)
205204
self._on_revision_change(checkin_response.last_config_revision)
205+
self._active_revision = checkin_response.last_config_revision
206206

207207
def flush(self, cancellation_token: CancellationToken) -> None:
208208
"""

cognite/extractorutils/unstable/core/runtime.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ def _safe_get_application_config(
337337
# Same error as before, no need to log it again
338338
self._cancellation_token.wait(randint(1, self.RETRY_CONFIG_INTERVAL))
339339
continue
340+
self.logger.error(error_message)
340341
prev_error = error_message
341342

342343
ts = now()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cognite-extractor-utils"
3-
version = "7.11.3"
3+
version = "7.11.4"
44
description = "Utilities for easier development of extractors for CDF"
55
authors = [
66
{name = "Mathias Lohne", email = "mathias.lohne@cognite.com"}

tests/test_unstable/test_errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def task(_tc: TaskContext) -> None:
177177
assert len(worker._errors) == 1
178178

179179
error = next(iter(worker._errors.values()))
180-
assert error.description == "Task TestTask crashed unexpectedly"
180+
assert error.description == "Task TestTask failed unexpectedly"
181181
assert error.level == ErrorLevel.fatal
182182

183183
# Make sure error was recorded as a task error

0 commit comments

Comments
 (0)