nebu 0.1.18__py3-none-any.whl → 0.1.19__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.
@@ -262,15 +262,23 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
262
262
  user_id = None
263
263
 
264
264
  try:
265
- # Get the message content from field 'data'
266
- if b"data" not in message_data:
267
- print(f"Message {message_id} has no 'data' field")
268
- return
265
+ # Check for and decode the 'data' field
266
+ data_bytes = message_data.get(b"data")
267
+ if data_bytes is None:
268
+ # Raise an error if 'data' field is missing
269
+ raise ValueError("Message missing 'data' field")
269
270
 
270
- # Parse the message data
271
- raw_payload = json.loads(message_data[b"data"].decode("utf-8"))
271
+ try:
272
+ # Decode bytes to string and parse JSON
273
+ raw_payload_str = data_bytes.decode("utf-8")
274
+ raw_payload = json.loads(raw_payload_str)
275
+ except (json.JSONDecodeError, UnicodeDecodeError) as decode_error:
276
+ # Raise a specific error for decoding/parsing issues
277
+ raise ValueError(f"Invalid JSON payload: {decode_error}") from decode_error
278
+
279
+ print(f"Raw payload: {raw_payload}")
272
280
 
273
- # Extract fields from the Rust structure
281
+ # Extract fields from the parsed payload
274
282
  # These fields are extracted for completeness and potential future use
275
283
  _ = raw_payload.get("kind", "") # kind
276
284
  msg_id = raw_payload.get("id", "") # msg_id
@@ -291,6 +299,8 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
291
299
  else:
292
300
  content = content_raw
293
301
 
302
+ print(f"Content: {content}")
303
+
294
304
  # For StreamMessage, construct the proper input object
295
305
  if is_stream_message and "V1StreamMessage" in local_namespace:
296
306
  # If we have a content type, try to construct it
@@ -298,6 +308,7 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
298
308
  # Try to create the content type model first
299
309
  try:
300
310
  content_model = local_namespace[content_type_name](**content)
311
+ print(f"Content model: {content_model}")
301
312
  input_obj = local_namespace["V1StreamMessage"](
302
313
  kind=_,
303
314
  id=msg_id,
@@ -325,6 +336,7 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
325
336
  )
326
337
  else:
327
338
  # Just use the raw content
339
+ print(f"Using raw content")
328
340
  input_obj = local_namespace["V1StreamMessage"](
329
341
  kind=_,
330
342
  id=msg_id,
@@ -348,9 +360,11 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
348
360
  print(f"Error creating input model: {e}, using raw content")
349
361
  input_obj = content
350
362
 
363
+ print(f"Input object: {input_obj}")
364
+
351
365
  # Execute the function
352
366
  result = target_function(input_obj)
353
-
367
+ print(f"Result: {result}")
354
368
  # If the result is a Pydantic model, convert to dict
355
369
  if hasattr(result, "model_dump"):
356
370
  result = result.model_dump()
@@ -365,6 +379,8 @@ def process_message(message_id: bytes, message_data: Dict[bytes, bytes]) -> None
365
379
  "user_id": user_id,
366
380
  }
367
381
 
382
+ print(f"Response: {response}")
383
+
368
384
  # Send the result to the return stream
369
385
  if return_stream:
370
386
  r.xadd(return_stream, {"data": json.dumps(response)})
@@ -421,6 +437,8 @@ while True:
421
437
  stream_name, stream_messages = messages[0]
422
438
 
423
439
  for message_id, message_data in stream_messages:
440
+ print(f"Processing message {message_id}")
441
+ print(f"Message data: {message_data}")
424
442
  process_message(message_id, message_data)
425
443
 
426
444
  except redis.exceptions.ConnectionError as e:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.18
3
+ Version: 0.1.19
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -6,15 +6,15 @@ nebu/containers/container.py,sha256=yb7KaPTVXnEEAlrpdlUi4HNqF6P7z9bmwAILGlq6iqU,
6
6
  nebu/containers/decorator.py,sha256=uFtzlAXRHYZECJ-NPusY7oN9GXvdHrHDd_JNrIGr8aQ,3244
7
7
  nebu/containers/models.py,sha256=0j6NGy4yto-enRDh_4JH_ZTbHrLdSpuMOqNQPnIrwC4,6815
8
8
  nebu/containers/server.py,sha256=yFa2Y9PzBn59E1HftKiv0iapPonli2rbGAiU6r-wwe0,2513
9
- nebu/processors/consumer.py,sha256=0HJxRLoeRdN4xY6bjIxqr5bD5JpFSyKb5s-eS5oTy9s,16063
9
+ nebu/processors/consumer.py,sha256=EbOhoFogS3W91BmJjqrFeipX_2G7lgAuUVGOpemcswM,16844
10
10
  nebu/processors/decorate.py,sha256=AeG1c1n8JtcexxAEf2sF2L2eKwVDaNQ5gvPs6EpazKo,34789
11
11
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
12
12
  nebu/processors/models.py,sha256=GvnI8UJrQSjHo2snP07cPfisCH90cEGTY-PZV5_AtXI,3654
13
13
  nebu/processors/processor.py,sha256=oy2YdI-cy6qQWxrZhpZahJV46oWZlu_Im-jm811R_oo,9667
14
14
  nebu/redis/models.py,sha256=coPovAcVXnOU1Xh_fpJL4PO3QctgK9nBe5QYoqEcnxg,1230
15
15
  nebu/services/service.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
- nebu-0.1.18.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
- nebu-0.1.18.dist-info/METADATA,sha256=wF7klvNGu6yoVp726tHAmn3Ouo4Kt2XhuceGw7zXGzM,1678
18
- nebu-0.1.18.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
- nebu-0.1.18.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
- nebu-0.1.18.dist-info/RECORD,,
16
+ nebu-0.1.19.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
17
+ nebu-0.1.19.dist-info/METADATA,sha256=soUNeXLW9Ikz2heD7RSSeiUW8Rut2Q9bK-P9rAuwnes,1678
18
+ nebu-0.1.19.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
19
+ nebu-0.1.19.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
20
+ nebu-0.1.19.dist-info/RECORD,,
File without changes