nebu 0.1.77__tar.gz → 0.1.78__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.
- {nebu-0.1.77/src/nebu.egg-info → nebu-0.1.78}/PKG-INFO +1 -1
- {nebu-0.1.77 → nebu-0.1.78}/pyproject.toml +1 -1
- nebu-0.1.78/src/nebu/errors.py +5 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/consumer.py +28 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/consumer_process_worker.py +19 -1
- {nebu-0.1.77 → nebu-0.1.78/src/nebu.egg-info}/PKG-INFO +1 -1
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu.egg-info/SOURCES.txt +1 -0
- {nebu-0.1.77 → nebu-0.1.78}/LICENSE +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/README.md +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/setup.cfg +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/__init__.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/auth.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/builders/builder.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/builders/models.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/cache.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/config.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/containers/container.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/containers/decorator.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/containers/models.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/containers/server.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/data.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/meta.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/namespaces/models.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/namespaces/namespace.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/orign.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/decorate.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/default.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/models.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/processor.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/processors/remote.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/redis/models.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu/services/service.py +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu.egg-info/dependency_links.txt +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu.egg-info/requires.txt +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/src/nebu.egg-info/top_level.txt +0 -0
- {nebu-0.1.77 → nebu-0.1.78}/tests/test_containers.py +0 -0
@@ -16,6 +16,8 @@ import redis
|
|
16
16
|
import socks
|
17
17
|
from redis import ConnectionError, ResponseError
|
18
18
|
|
19
|
+
from nebu.errors import RetriableError
|
20
|
+
|
19
21
|
# Define TypeVar for generic models
|
20
22
|
T = TypeVar("T")
|
21
23
|
|
@@ -433,6 +435,13 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
|
|
433
435
|
f"Subprocess for {message_id} completed successfully (return code 0)."
|
434
436
|
)
|
435
437
|
# Assume success handling (ack/response) was done by the worker
|
438
|
+
elif return_code == 3:
|
439
|
+
print(
|
440
|
+
f"Subprocess for {message_id} reported a retriable error (exit code 3). Message will not be acknowledged."
|
441
|
+
)
|
442
|
+
# Optionally send an error response here, though the worker already did.
|
443
|
+
# _send_error_response(...)
|
444
|
+
# DO NOT Acknowledge the message here, let it be retried.
|
436
445
|
else:
|
437
446
|
print(
|
438
447
|
f"Subprocess for {message_id} failed with exit code {return_code}."
|
@@ -550,6 +559,16 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
|
|
550
559
|
None,
|
551
560
|
None,
|
552
561
|
) # Pass None for user_id if unavailable here
|
562
|
+
# Acknowledge message with code load failure to prevent reprocessing loop
|
563
|
+
try:
|
564
|
+
assert isinstance(REDIS_STREAM, str)
|
565
|
+
assert isinstance(REDIS_CONSUMER_GROUP, str)
|
566
|
+
r.xack(REDIS_STREAM, REDIS_CONSUMER_GROUP, message_id)
|
567
|
+
print(f"Acknowledged message {message_id} due to code load failure.")
|
568
|
+
except Exception as e_ack:
|
569
|
+
print(
|
570
|
+
f"CRITICAL: Failed to acknowledge message {message_id} after code load failure: {e_ack}"
|
571
|
+
)
|
553
572
|
return # Skip processing
|
554
573
|
|
555
574
|
return_stream = None
|
@@ -797,6 +816,15 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
|
|
797
816
|
assert isinstance(REDIS_CONSUMER_GROUP, str)
|
798
817
|
r.xack(REDIS_STREAM, REDIS_CONSUMER_GROUP, message_id)
|
799
818
|
|
819
|
+
except RetriableError as e:
|
820
|
+
print(f"Retriable error processing message {message_id}: {e}")
|
821
|
+
traceback.print_exc()
|
822
|
+
_send_error_response(
|
823
|
+
message_id, str(e), traceback.format_exc(), return_stream, user_id
|
824
|
+
)
|
825
|
+
# DO NOT Acknowledge the message for retriable errors
|
826
|
+
print(f"Message {message_id} will be retried later.")
|
827
|
+
|
800
828
|
except Exception as e:
|
801
829
|
print(f"Error processing message {message_id}: {e}")
|
802
830
|
traceback.print_exc()
|
@@ -14,6 +14,8 @@ from typing import Any, Callable, Dict, List, Optional, Tuple, TypeVar, cast
|
|
14
14
|
import redis
|
15
15
|
import socks
|
16
16
|
|
17
|
+
from nebu.errors import RetriableError
|
18
|
+
|
17
19
|
# from redis import ConnectionError, ResponseError # Removed unused imports
|
18
20
|
|
19
21
|
# Define TypeVar for generic models
|
@@ -640,8 +642,24 @@ if __name__ == "__main__":
|
|
640
642
|
print("[Worker] Exiting with status 0.")
|
641
643
|
sys.exit(0)
|
642
644
|
|
645
|
+
except RetriableError as e:
|
646
|
+
# --- Handle Retriable Processing Error ---
|
647
|
+
print(f"[Worker] Retriable error processing message {message_id}: {e}")
|
648
|
+
tb = traceback.format_exc()
|
649
|
+
print(tb)
|
650
|
+
# Assert message_id is str before sending error
|
651
|
+
assert isinstance(message_id, str)
|
652
|
+
# Send error response (optional, consider suppressing later if too noisy)
|
653
|
+
_send_error_response(message_id, str(e), tb, return_stream, user_id)
|
654
|
+
|
655
|
+
# DO NOT Acknowledge the message for retriable errors
|
656
|
+
|
657
|
+
# --- 9. Exit with specific code for retriable failure ---
|
658
|
+
print("[Worker] Exiting with status 3 due to retriable error.")
|
659
|
+
sys.exit(3)
|
660
|
+
|
643
661
|
except Exception as e:
|
644
|
-
# --- Handle Processing Error ---
|
662
|
+
# --- Handle Non-Retriable Processing Error ---
|
645
663
|
print(f"[Worker] Error processing message {message_id}: {e}")
|
646
664
|
tb = traceback.format_exc()
|
647
665
|
print(tb)
|
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
|
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
|
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
|
File without changes
|
File without changes
|