Skip to content

Commit a021eb7

Browse files
devin-ai-integration[bot]bot_apk
andcommitted
fix(cdk): change MemoryLimitExceeded to system_error and update user-facing message
Co-Authored-By: bot_apk <apk@cognition.ai>
1 parent 7f7ab40 commit a021eb7

3 files changed

Lines changed: 8 additions & 10 deletions

File tree

airbyte_cdk/utils/memory_monitor.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,8 @@ def check_memory_usage(self) -> None:
146146
raise MemoryLimitExceeded(
147147
internal_message=f"Memory usage is {usage_percent}% ({usage_bytes} / {limit_bytes} bytes). "
148148
f"Critical threshold is {int(self._critical_threshold * 100)}%.",
149-
message=f"Source exceeded memory limit ({usage_percent}% used) and must shut down. "
150-
f"Reduce the number of streams or increase memory allocation.",
151-
failure_type=FailureType.transient_error,
149+
message=f"Source exceeded memory limit ({usage_percent}% used) and must shut down to avoid an out-of-memory crash.",
150+
failure_type=FailureType.system_error,
152151
)
153152

154153
if usage_ratio >= self._warning_threshold and not self._warning_emitted:

unit_tests/test_entrypoint.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -889,9 +889,8 @@ def _raise_on_second_call() -> None:
889889
if call_count >= 2:
890890
raise MemoryLimitExceeded(
891891
internal_message="Memory at 96%",
892-
message="Source exceeded memory limit (96% used) and must shut down. "
893-
"Reduce the number of streams or increase memory allocation.",
894-
failure_type=FailureType.transient_error,
892+
message="Source exceeded memory limit (96% used) and must shut down to avoid an out-of-memory crash.",
893+
failure_type=FailureType.system_error,
895894
)
896895

897896
mocker.patch.object(

unit_tests/utils/test_memory_monitor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def mock_read_text(self: Path) -> str:
172172
with pytest.raises(MemoryLimitExceeded) as exc_info:
173173
monitor.check_memory_usage()
174174

175-
assert exc_info.value.failure_type == FailureType.transient_error
175+
assert exc_info.value.failure_type == FailureType.system_error
176176
assert "96%" in (exc_info.value.message or "")
177177

178178
def test_warning_emitted_only_once(self) -> None:
@@ -375,7 +375,7 @@ def test_is_airbyte_traced_exception(self) -> None:
375375
exc = MemoryLimitExceeded(
376376
internal_message="test",
377377
message="test message",
378-
failure_type=FailureType.transient_error,
378+
failure_type=FailureType.system_error,
379379
)
380380
assert isinstance(exc, AirbyteTracedException)
381381

@@ -384,9 +384,9 @@ def test_default_attributes(self) -> None:
384384
exc = MemoryLimitExceeded(
385385
internal_message="Memory at 96%",
386386
message="Source exceeded memory limit.",
387-
failure_type=FailureType.transient_error,
387+
failure_type=FailureType.system_error,
388388
)
389-
assert exc.failure_type == FailureType.transient_error
389+
assert exc.failure_type == FailureType.system_error
390390
assert exc.message == "Source exceeded memory limit."
391391
assert exc.internal_message == "Memory at 96%"
392392

0 commit comments

Comments
 (0)