nebu 0.1.82__py3-none-any.whl → 0.1.83__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.
- nebu/processors/consumer.py +38 -12
- nebu/processors/decorate.py +0 -2
- {nebu-0.1.82.dist-info → nebu-0.1.83.dist-info}/METADATA +1 -1
- {nebu-0.1.82.dist-info → nebu-0.1.83.dist-info}/RECORD +7 -7
- {nebu-0.1.82.dist-info → nebu-0.1.83.dist-info}/WHEEL +0 -0
- {nebu-0.1.82.dist-info → nebu-0.1.83.dist-info}/licenses/LICENSE +0 -0
- {nebu-0.1.82.dist-info → nebu-0.1.83.dist-info}/top_level.txt +0 -0
nebu/processors/consumer.py
CHANGED
@@ -783,27 +783,53 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
|
|
783
783
|
# Execute the function
|
784
784
|
print("Executing function...")
|
785
785
|
result = target_function(input_obj)
|
786
|
-
print(f"Result: {result}")
|
786
|
+
# print(f"Raw Result: {result}") # Debugging
|
787
787
|
|
788
|
-
#
|
789
|
-
if
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
788
|
+
result_content = None # Default to None
|
789
|
+
if result is not None: # Only process if there's a result
|
790
|
+
try:
|
791
|
+
if hasattr(result, "model_dump"):
|
792
|
+
print("[Consumer] Result has model_dump, using it.")
|
793
|
+
# Use 'json' mode to ensure serializability where possible
|
794
|
+
result_content = result.model_dump(mode="json")
|
795
|
+
# print(f"[Consumer] Result after model_dump: {result_content}") # Debugging
|
796
|
+
else:
|
797
|
+
# Try standard json.dumps as a fallback to check serializability
|
798
|
+
print(
|
799
|
+
"[Consumer] Result has no model_dump, attempting json.dumps check."
|
800
|
+
)
|
801
|
+
try:
|
802
|
+
# Test if it's serializable
|
803
|
+
json.dumps(result)
|
804
|
+
# If the above line doesn't raise TypeError, assign the original result
|
805
|
+
result_content = result
|
806
|
+
# print(f"[Consumer] Result assigned directly after json.dumps check passed: {result_content}") # Debugging
|
807
|
+
except TypeError as e:
|
808
|
+
print(
|
809
|
+
f"[Consumer] Warning: Result is not JSON serializable: {e}. Discarding result."
|
810
|
+
)
|
811
|
+
result_content = None # Explicitly set to None on failure
|
812
|
+
|
813
|
+
except (
|
814
|
+
Exception
|
815
|
+
) as e: # Catch other potential model_dump errors or unexpected issues
|
816
|
+
print(
|
817
|
+
f"[Consumer] Warning: Unexpected error during result processing/serialization: {e}. Discarding result."
|
818
|
+
)
|
819
|
+
traceback.print_exc()
|
820
|
+
result_content = None
|
795
821
|
|
796
|
-
# Prepare the response
|
822
|
+
# Prepare the response (ensure 'content' key exists even if None)
|
797
823
|
response = {
|
798
824
|
"kind": "StreamResponseMessage",
|
799
825
|
"id": message_id,
|
800
|
-
"content": result_content,
|
826
|
+
"content": result_content, # Use the potentially None result_content
|
801
827
|
"status": "success",
|
802
|
-
"created_at": datetime.now().isoformat(),
|
828
|
+
"created_at": datetime.now(timezone.utc).isoformat(), # Use UTC
|
803
829
|
"user_id": user_id, # Pass user_id back
|
804
830
|
}
|
805
831
|
|
806
|
-
# print(f"Response: {response}") #
|
832
|
+
# print(f"Final Response Content: {response['content']}") # Debugging
|
807
833
|
|
808
834
|
# Send the result to the return stream
|
809
835
|
if return_stream:
|
nebu/processors/decorate.py
CHANGED
@@ -726,8 +726,6 @@ def processor(
|
|
726
726
|
f"[DEBUG Decorator] Parameter '{param_name}' type hint: {param_type_str_repr}"
|
727
727
|
)
|
728
728
|
|
729
|
-
if "return" not in type_hints:
|
730
|
-
raise TypeError(f"{processor_name} must have a return type hint")
|
731
729
|
return_type = type_hints.get("return")
|
732
730
|
return_type_str_repr = str(return_type)
|
733
731
|
print(f"[DEBUG Decorator] Return type hint: {return_type_str_repr}")
|
@@ -14,17 +14,17 @@ nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,681
|
|
14
14
|
nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
|
15
15
|
nebu/namespaces/models.py,sha256=EqUOpzhVBhvJw2P92ONDUbIgC31M9jMmcaG5vyOrsWg,497
|
16
16
|
nebu/namespaces/namespace.py,sha256=Q_EDH7BgQrTkaDh_l4tbo22qpq-uARfIk8ZPBLjITGY,4967
|
17
|
-
nebu/processors/consumer.py,sha256=
|
17
|
+
nebu/processors/consumer.py,sha256=kbfX6KMzBPvCvM2dy0wQA578FE0lNl-6VrAtYsmZops,50072
|
18
18
|
nebu/processors/consumer_process_worker.py,sha256=tF5KU3Rnmzfc3Y0cM8J5nwGg1cJMe-ry0FmMSgGvXrY,31765
|
19
|
-
nebu/processors/decorate.py,sha256=
|
19
|
+
nebu/processors/decorate.py,sha256=jMh7OMamPdxGn7cMxQsOl5CEEmhZ1TXkMz8nCzBpVaU,54649
|
20
20
|
nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
|
21
21
|
nebu/processors/models.py,sha256=FnBJFxtaJkp-uIOs90qkJUBvOR80l2cdGnfmOIWIvVA,4058
|
22
22
|
nebu/processors/processor.py,sha256=OgEK8Fz0ehSe_VFiNsxweVKZIckhgVvQQ11NNffYZqA,15848
|
23
23
|
nebu/processors/remote.py,sha256=TeAIPGEMqnDIb7H1iett26IEZrBlcbPB_-DSm6jcH1E,1285
|
24
24
|
nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
|
25
25
|
nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
26
|
-
nebu-0.1.
|
27
|
-
nebu-0.1.
|
28
|
-
nebu-0.1.
|
29
|
-
nebu-0.1.
|
30
|
-
nebu-0.1.
|
26
|
+
nebu-0.1.83.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
27
|
+
nebu-0.1.83.dist-info/METADATA,sha256=isv9vhNtjv8_gr99FdtFSrnqn5EOIYYhHtMSO53MZlY,1731
|
28
|
+
nebu-0.1.83.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
|
29
|
+
nebu-0.1.83.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
|
30
|
+
nebu-0.1.83.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|