nebu 0.1.83__py3-none-any.whl → 0.1.84__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.
@@ -916,7 +916,13 @@ CLAIM_COUNT = 10 # Max messages to claim at once
916
916
 
917
917
  try:
918
918
  while True:
919
+ print(
920
+ f"[{datetime.now(timezone.utc).isoformat()}] --- Top of main loop ---"
921
+ ) # Added log
919
922
  # --- Check for Code Updates ---
923
+ print(
924
+ f"[{datetime.now(timezone.utc).isoformat()}] Checking for code updates..."
925
+ ) # Added log
920
926
  if entrypoint_abs_path: # Should always be set after init
921
927
  try:
922
928
  current_mtime = os.path.getmtime(entrypoint_abs_path)
@@ -968,8 +974,14 @@ try:
968
974
  print(
969
975
  "[Consumer] Warning: Entrypoint absolute path not set, cannot check for code updates."
970
976
  )
977
+ print(
978
+ f"[{datetime.now(timezone.utc).isoformat()}] Finished checking for code updates."
979
+ ) # Added log
971
980
 
972
981
  # --- Claim Old Pending Messages ---
982
+ print(
983
+ f"[{datetime.now(timezone.utc).isoformat()}] Checking for pending messages to claim..."
984
+ ) # Added log
973
985
  try:
974
986
  if target_function is not None: # Only claim if we can process
975
987
  assert isinstance(REDIS_STREAM, str)
@@ -1027,7 +1039,7 @@ try:
1027
1039
 
1028
1040
  if claimed_messages:
1029
1041
  print(
1030
- f"[Consumer] Claimed {len(claimed_messages[0][1])} pending message(s). Processing..."
1042
+ f"[{datetime.now(timezone.utc).isoformat()}] Claimed {claimed_messages} pending message(s). Processing..."
1031
1043
  )
1032
1044
  # Process claimed messages immediately
1033
1045
  # Cast messages to expected type to satisfy type checker
@@ -1045,6 +1057,10 @@ try:
1045
1057
  # After processing claimed messages, loop back to check for more potentially
1046
1058
  # This avoids immediately blocking on XREADGROUP if there were claimed messages
1047
1059
  continue
1060
+ else: # Added log
1061
+ print(
1062
+ f"[{datetime.now(timezone.utc).isoformat()}] No pending messages claimed."
1063
+ ) # Added log
1048
1064
 
1049
1065
  except ResponseError as e_claim:
1050
1066
  # Handle specific errors like NOGROUP gracefully if needed
@@ -1056,17 +1072,26 @@ try:
1056
1072
  else:
1057
1073
  print(f"[Consumer] Error during XAUTOCLAIM: {e_claim}")
1058
1074
  # Decide if this is fatal or recoverable
1075
+ print(
1076
+ f"[{datetime.now(timezone.utc).isoformat()}] Error during XAUTOCLAIM: {e_claim}"
1077
+ ) # Added log
1059
1078
  time.sleep(5) # Wait before retrying claim
1060
1079
  except ConnectionError as e_claim_conn:
1061
1080
  print(
1062
1081
  f"Redis connection error during XAUTOCLAIM: {e_claim_conn}. Will attempt reconnect in main loop."
1063
1082
  )
1064
1083
  # Let the main ConnectionError handler below deal with reconnection
1084
+ print(
1085
+ f"[{datetime.now(timezone.utc).isoformat()}] Redis connection error during XAUTOCLAIM: {e_claim_conn}. Will attempt reconnect."
1086
+ ) # Added log
1065
1087
  time.sleep(5) # Avoid tight loop on connection errors during claim
1066
1088
  except Exception as e_claim_other:
1067
1089
  print(
1068
1090
  f"[Consumer] Unexpected error during XAUTOCLAIM/processing claimed messages: {e_claim_other}"
1069
1091
  )
1092
+ print(
1093
+ f"[{datetime.now(timezone.utc).isoformat()}] Unexpected error during XAUTOCLAIM/processing claimed: {e_claim_other}"
1094
+ ) # Added log
1070
1095
  traceback.print_exc()
1071
1096
  time.sleep(5) # Wait before retrying
1072
1097
 
@@ -1085,27 +1110,42 @@ try:
1085
1110
  streams_arg: Dict[str, str] = {REDIS_STREAM: ">"}
1086
1111
 
1087
1112
  # With decode_responses=True, redis-py expects str types here
1113
+ print(
1114
+ f"[{datetime.now(timezone.utc).isoformat()}] Calling xreadgroup (block=5000ms)..."
1115
+ ) # Added log
1088
1116
  messages = r.xreadgroup(
1089
1117
  REDIS_CONSUMER_GROUP,
1090
1118
  consumer_name,
1091
- streams_arg, # type: ignore[arg-type]
1119
+ streams_arg, # type: ignore[arg-type] # Suppress linter warning
1092
1120
  count=1,
1093
1121
  block=5000, # Use milliseconds for block
1094
1122
  )
1095
1123
 
1096
1124
  if not messages:
1125
+ print(
1126
+ f"[{datetime.now(timezone.utc).isoformat()}] xreadgroup timed out (no new messages)."
1127
+ ) # Added log
1097
1128
  # print("[Consumer] No new messages.") # Reduce verbosity
1098
1129
  continue
1130
+ # Removed the else block here
1099
1131
 
1132
+ # If we reached here, messages is not empty.
1100
1133
  # Assert messages is not None to help type checker (already implied by `if not messages`)
1101
1134
  assert messages is not None
1102
1135
 
1103
- # Cast messages to expected type to satisfy type checker
1136
+ # Cast messages to expected type to satisfy type checker (do it once)
1104
1137
  typed_messages = cast(
1105
1138
  List[Tuple[str, List[Tuple[str, Dict[str, str]]]]], messages
1106
1139
  )
1107
1140
  stream_name_str, stream_messages = typed_messages[0]
1141
+ num_msgs = len(stream_messages)
1142
+
1143
+ # Log reception and count before processing
1144
+ print(
1145
+ f"[{datetime.now(timezone.utc).isoformat()}] xreadgroup returned {num_msgs} message(s). Processing..."
1146
+ ) # Moved and combined log
1108
1147
 
1148
+ # Process the received messages
1109
1149
  # for msg_id_bytes, msg_data_bytes_dict in stream_messages: # Original structure
1110
1150
  for (
1111
1151
  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.84
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=DznWT6_51JPi3lA2KKalnZMlYJc11bpzdfeNmGe5bIQ,52039
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.84.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
27
+ nebu-0.1.84.dist-info/METADATA,sha256=5OLXVQZv3g7yNQGh8_gVsJ6hsjO_LzDpN6S9hqUjNdo,1731
28
+ nebu-0.1.84.dist-info/WHEEL,sha256=wXxTzcEDnjrTwFYjLPcsW_7_XihufBwmpiBeiXNBGEA,91
29
+ nebu-0.1.84.dist-info/top_level.txt,sha256=uLIbEKJeGSHWOAJN5S0i5XBGwybALlF9bYoB1UhdEgQ,5
30
+ nebu-0.1.84.dist-info/RECORD,,
File without changes