prediction-market-agent-tooling 0.64.5.dev616__py3-none-any.whl → 0.64.6.dev622__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.
@@ -28,6 +28,8 @@ from prediction_market_agent_tooling.tools.datetime_utc import DatetimeUTC
28
28
  from prediction_market_agent_tooling.tools.db.db_manager import DBManager
29
29
  from prediction_market_agent_tooling.tools.utils import utcnow
30
30
 
31
+ DB_CACHE_LOG_PREFIX = "[db-cache]"
32
+
31
33
  FunctionT = TypeVar("FunctionT", bound=Callable[..., Any])
32
34
 
33
35
 
@@ -173,7 +175,7 @@ def db_cache(
173
175
  if cached_result:
174
176
  logger.info(
175
177
  # Keep the special [case-hit] identifier so we can easily track it in GCP.
176
- f"[cache-hit] Cache hit for {full_function_name} with args {args_dict} and output {cached_result.result}"
178
+ f"{DB_CACHE_LOG_PREFIX} [cache-hit] Cache hit for {full_function_name} with args {args_dict} and output {cached_result.result}"
177
179
  )
178
180
  if is_pydantic_model:
179
181
  # If the output contains any Pydantic models, we need to initialise them.
@@ -184,7 +186,7 @@ def db_cache(
184
186
  except ValueError as e:
185
187
  # In case of backward-incompatible pydantic model, just treat it as cache miss, to not error out.
186
188
  logger.warning(
187
- f"Can not validate {cached_result=} into {return_type=} because {e=}, treating as cache miss."
189
+ f"{DB_CACHE_LOG_PREFIX} [cache-miss] Can not validate {cached_result=} into {return_type=} because {e=}, treating as cache miss."
188
190
  )
189
191
  cached_result = None
190
192
  else:
@@ -194,7 +196,7 @@ def db_cache(
194
196
  computed_result = func(*args, **kwargs)
195
197
  # Keep the special [case-miss] identifier so we can easily track it in GCP.
196
198
  logger.info(
197
- f"[cache-miss] Cache miss for {full_function_name} with args {args_dict}, computed the output {computed_result}"
199
+ f"{DB_CACHE_LOG_PREFIX} [cache-miss] Cache miss for {full_function_name} with args {args_dict}, computed the output {computed_result}"
198
200
  )
199
201
 
200
202
  # If postgres access was specified, save it.
@@ -212,16 +214,18 @@ def db_cache(
212
214
  with DBManager(
213
215
  api_keys.sqlalchemy_db_url.get_secret_value()
214
216
  ).get_session() as session:
215
- logger.info(f"Saving {cache_entry} into database.")
217
+ logger.info(
218
+ f"{DB_CACHE_LOG_PREFIX} [cache-info] Saving {cache_entry} into database."
219
+ )
216
220
  session.add(cache_entry)
217
221
  session.commit()
218
222
  except (DataError, psycopg2.errors.UntranslatableCharacter) as e:
219
223
  (logger.error if log_error_on_unsavable_data else logger.warning)(
220
- f"Failed to save {cache_entry} into database, ignoring, because: {e}"
224
+ f"{DB_CACHE_LOG_PREFIX} [cache-error] Failed to save {cache_entry} into database, ignoring, because: {e}"
221
225
  )
222
226
  except Exception:
223
227
  logger.exception(
224
- f"Failed to save {cache_entry} into database, ignoring."
228
+ f"{DB_CACHE_LOG_PREFIX} [cache-error] Failed to save {cache_entry} into database, ignoring."
225
229
  )
226
230
 
227
231
  return computed_result
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: prediction-market-agent-tooling
3
- Version: 0.64.5.dev616
3
+ Version: 0.64.6.dev622
4
4
  Summary: Tools to benchmark, deploy and monitor prediction market agents.
5
5
  Author: Gnosis
6
6
  Requires-Python: >=3.10,<3.13
@@ -86,7 +86,7 @@ prediction_market_agent_tooling/tools/betting_strategies/market_moving.py,sha256
86
86
  prediction_market_agent_tooling/tools/betting_strategies/minimum_bet_to_win.py,sha256=-FUSuQQgjcWSSnoFxnlAyTeilY6raJABJVM2QKkFqAY,438
87
87
  prediction_market_agent_tooling/tools/betting_strategies/stretch_bet_between.py,sha256=THMXwFlskvzbjnX_OiYtDSzI8XVFyULWfP2525_9UGc,429
88
88
  prediction_market_agent_tooling/tools/betting_strategies/utils.py,sha256=68zFWUj43GUaSpOPowVrbI-t6qbCE29RsVHNzCVuJ9U,175
89
- prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=e7CLFPTlxYFx0pM3x5sWyn_g9pIigPSvrP0mMmiOhUg,11859
89
+ prediction_market_agent_tooling/tools/caches/db_cache.py,sha256=rZIGhgijquwwPtp_qncSAPR1SDF2XxIVZL1ir0fgzWw,12127
90
90
  prediction_market_agent_tooling/tools/caches/inmemory_cache.py,sha256=ZW5iI5rmjqeAebu5T7ftRnlkxiL02IC-MxCfDB80x7w,1506
91
91
  prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp2q0sv27j4al_M_Tj9aR2JJP-xNHQXA,2151
92
92
  prediction_market_agent_tooling/tools/contract.py,sha256=Yex8MVYvdBTMZLESLqKpwEyT8EGAfkJRri5kCaPqrBM,21235
@@ -124,8 +124,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=yuW8iPPtcpP4eLH2nORMD
124
124
  prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
125
125
  prediction_market_agent_tooling/tools/utils.py,sha256=AC2a68jwASMWuQi-w8twl8b_M52YwrEJ81abmuEaqMY,6661
126
126
  prediction_market_agent_tooling/tools/web3_utils.py,sha256=zRq-eeBGWt8uUGN9G_WfjmJ0eVvO8aWE9S0Pz_Y6AOA,12342
127
- prediction_market_agent_tooling-0.64.5.dev616.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
- prediction_market_agent_tooling-0.64.5.dev616.dist-info/METADATA,sha256=C_0n8zp6Xp6M8ECIZmJeIZBurMLo14NNJYZpgjYJjcQ,8748
129
- prediction_market_agent_tooling-0.64.5.dev616.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
- prediction_market_agent_tooling-0.64.5.dev616.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
- prediction_market_agent_tooling-0.64.5.dev616.dist-info/RECORD,,
127
+ prediction_market_agent_tooling-0.64.6.dev622.dist-info/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
128
+ prediction_market_agent_tooling-0.64.6.dev622.dist-info/METADATA,sha256=KHsFBECHJzLOJxJLI81qeoVA9caPZ3eXV1VcfQ-kXNA,8748
129
+ prediction_market_agent_tooling-0.64.6.dev622.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
130
+ prediction_market_agent_tooling-0.64.6.dev622.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
131
+ prediction_market_agent_tooling-0.64.6.dev622.dist-info/RECORD,,