nebu 0.1.83__py3-none-any.whl → 0.1.85__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.
@@ -612,6 +612,7 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
612
612
  orgs = raw_payload.get("organizations")
613
613
  handle = raw_payload.get("handle")
614
614
  adapter = raw_payload.get("adapter")
615
+ api_key = raw_payload.get("api_key") # Extract api_key
615
616
 
616
617
  # --- Health Check Logic (Keep as is) ---
617
618
  if kind == "HealthCheck":
@@ -703,6 +704,7 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
703
704
  orgs=orgs,
704
705
  handle=handle,
705
706
  adapter=adapter,
707
+ api_key=api_key, # Add api_key
706
708
  )
707
709
  except Exception as e:
708
710
  print(
@@ -719,6 +721,7 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
719
721
  orgs=orgs,
720
722
  handle=handle,
721
723
  adapter=adapter,
724
+ api_key=api_key, # Add api_key
722
725
  )
723
726
  else:
724
727
  # No content type name or class found, use raw content
@@ -732,6 +735,7 @@ def process_message(message_id: str, message_data: Dict[str, str]) -> None:
732
735
  orgs=orgs,
733
736
  handle=handle,
734
737
  adapter=adapter,
738
+ api_key=api_key, # Add api_key
735
739
  )
736
740
  else: # Not a stream message, use the function's parameter type
737
741
  param_type_name = (
@@ -916,7 +920,13 @@ CLAIM_COUNT = 10 # Max messages to claim at once
916
920
 
917
921
  try:
918
922
  while True:
923
+ print(
924
+ f"[{datetime.now(timezone.utc).isoformat()}] --- Top of main loop ---"
925
+ ) # Added log
919
926
  # --- Check for Code Updates ---
927
+ print(
928
+ f"[{datetime.now(timezone.utc).isoformat()}] Checking for code updates..."
929
+ ) # Added log
920
930
  if entrypoint_abs_path: # Should always be set after init
921
931
  try:
922
932
  current_mtime = os.path.getmtime(entrypoint_abs_path)
@@ -968,8 +978,14 @@ try:
968
978
  print(
969
979
  "[Consumer] Warning: Entrypoint absolute path not set, cannot check for code updates."
970
980
  )
981
+ print(
982
+ f"[{datetime.now(timezone.utc).isoformat()}] Finished checking for code updates."
983
+ ) # Added log
971
984
 
972
985
  # --- Claim Old Pending Messages ---
986
+ print(
987
+ f"[{datetime.now(timezone.utc).isoformat()}] Checking for pending messages to claim..."
988
+ ) # Added log
973
989
  try:
974
990
  if target_function is not None: # Only claim if we can process
975
991
  assert isinstance(REDIS_STREAM, str)
@@ -1027,7 +1043,7 @@ try:
1027
1043
 
1028
1044
  if claimed_messages:
1029
1045
  print(
1030
- f"[Consumer] Claimed {len(claimed_messages[0][1])} pending message(s). Processing..."
1046
+ f"[{datetime.now(timezone.utc).isoformat()}] Claimed {claimed_messages} pending message(s). Processing..."
1031
1047
  )
1032
1048
  # Process claimed messages immediately
1033
1049
  # Cast messages to expected type to satisfy type checker
@@ -1045,6 +1061,10 @@ try:
1045
1061
  # After processing claimed messages, loop back to check for more potentially
1046
1062
  # This avoids immediately blocking on XREADGROUP if there were claimed messages
1047
1063
  continue
1064
+ else: # Added log
1065
+ print(
1066
+ f"[{datetime.now(timezone.utc).isoformat()}] No pending messages claimed."
1067
+ ) # Added log
1048
1068
 
1049
1069
  except ResponseError as e_claim:
1050
1070
  # Handle specific errors like NOGROUP gracefully if needed
@@ -1056,17 +1076,26 @@ try:
1056
1076
  else:
1057
1077
  print(f"[Consumer] Error during XAUTOCLAIM: {e_claim}")
1058
1078
  # Decide if this is fatal or recoverable
1079
+ print(
1080
+ f"[{datetime.now(timezone.utc).isoformat()}] Error during XAUTOCLAIM: {e_claim}"
1081
+ ) # Added log
1059
1082
  time.sleep(5) # Wait before retrying claim
1060
1083
  except ConnectionError as e_claim_conn:
1061
1084
  print(
1062
1085
  f"Redis connection error during XAUTOCLAIM: {e_claim_conn}. Will attempt reconnect in main loop."
1063
1086
  )
1064
1087
  # Let the main ConnectionError handler below deal with reconnection
1088
+ print(
1089
+ f"[{datetime.now(timezone.utc).isoformat()}] Redis connection error during XAUTOCLAIM: {e_claim_conn}. Will attempt reconnect."
1090
+ ) # Added log
1065
1091
  time.sleep(5) # Avoid tight loop on connection errors during claim
1066
1092
  except Exception as e_claim_other:
1067
1093
  print(
1068
1094
  f"[Consumer] Unexpected error during XAUTOCLAIM/processing claimed messages: {e_claim_other}"
1069
1095
  )
1096
+ print(
1097
+ f"[{datetime.now(timezone.utc).isoformat()}] Unexpected error during XAUTOCLAIM/processing claimed: {e_claim_other}"
1098
+ ) # Added log
1070
1099
  traceback.print_exc()
1071
1100
  time.sleep(5) # Wait before retrying
1072
1101
 
@@ -1085,27 +1114,42 @@ try:
1085
1114
  streams_arg: Dict[str, str] = {REDIS_STREAM: ">"}
1086
1115
 
1087
1116
  # With decode_responses=True, redis-py expects str types here
1117
+ print(
1118
+ f"[{datetime.now(timezone.utc).isoformat()}] Calling xreadgroup (block=5000ms)..."
1119
+ ) # Added log
1088
1120
  messages = r.xreadgroup(
1089
1121
  REDIS_CONSUMER_GROUP,
1090
1122
  consumer_name,
1091
- streams_arg, # type: ignore[arg-type]
1123
+ streams_arg, # type: ignore[arg-type] # Suppress linter warning
1092
1124
  count=1,
1093
1125
  block=5000, # Use milliseconds for block
1094
1126
  )
1095
1127
 
1096
1128
  if not messages:
1129
+ print(
1130
+ f"[{datetime.now(timezone.utc).isoformat()}] xreadgroup timed out (no new messages)."
1131
+ ) # Added log
1097
1132
  # print("[Consumer] No new messages.") # Reduce verbosity
1098
1133
  continue
1134
+ # Removed the else block here
1099
1135
 
1136
+ # If we reached here, messages is not empty.
1100
1137
  # Assert messages is not None to help type checker (already implied by `if not messages`)
1101
1138
  assert messages is not None
1102
1139
 
1103
- # Cast messages to expected type to satisfy type checker
1140
+ # Cast messages to expected type to satisfy type checker (do it once)
1104
1141
  typed_messages = cast(
1105
1142
  List[Tuple[str, List[Tuple[str, Dict[str, str]]]]], messages
1106
1143
  )
1107
1144
  stream_name_str, stream_messages = typed_messages[0]
1145
+ num_msgs = len(stream_messages)
1146
+
1147
+ # Log reception and count before processing
1148
+ print(
1149
+ f"[{datetime.now(timezone.utc).isoformat()}] xreadgroup returned {num_msgs} message(s). Processing..."
1150
+ ) # Moved and combined log
1108
1151
 
1152
+ # Process the received messages
1109
1153
  # for msg_id_bytes, msg_data_bytes_dict in stream_messages: # Original structure
1110
1154
  for (
1111
1155
  message_id_str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nebu
3
- Version: 0.1.83
3
+ Version: 0.1.85
4
4
  Summary: A globally distributed container runtime
5
5
  Requires-Python: >=3.10.14
6
6
  Description-Content-Type: text/markdown
@@ -14,7 +14,7 @@ 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=kbfX6KMzBPvCvM2dy0wQA578FE0lNl-6VrAtYsmZops,50072
17
+ nebu/processors/consumer.py,sha256=kLCERYgJXiLIHzDiWrHNCma0DkmuFSJ9luj4MERJ268,52279
18
18
  nebu/processors/consumer_process_worker.py,sha256=tF5KU3Rnmzfc3Y0cM8J5nwGg1cJMe-ry0FmMSgGvXrY,31765
19
19
  nebu/processors/decorate.py,sha256=jMh7OMamPdxGn7cMxQsOl5CEEmhZ1TXkMz8nCzBpVaU,54649
20
20
  nebu/processors/default.py,sha256=W4slJenG59rvyTlJ7gRp58eFfXcNOTT2Hfi6zzJAobI,365
@@ -23,8 +23,8 @@ nebu/processors/processor.py,sha256=OgEK8Fz0ehSe_VFiNsxweVKZIckhgVvQQ11NNffYZqA,
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.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,,
26
+ nebu-0.1.85.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
+ nebu-0.1.85.dist-info/METADATA,sha256=au2f_3l53q7qL-xNvMv98tfOFmYqNP3gaKSgOSGqQeU,1731
28
+ nebu-0.1.85.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
29
+ nebu-0.1.85.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
30
+ nebu-0.1.85.dist-info/RECORD,,
File without changes