MCPcopy Create free account
hub / github.com/AgentOps-AI/agentops / store_event

Function store_event

app/deploy/jockey/worker/queue.py:265–289  ·  view source on GitHub ↗

Store a task event in Redis using sorted sets for timestamp-based queries. Args: task_id: Task identifier event: Event to store

(task_id: str, event: BaseEvent)

Source from the content-addressed store, hash-verified

263
264
265def store_event(task_id: str, event: BaseEvent) -> None:
266 """Store a task event in Redis using sorted sets for timestamp-based queries.
267
268 Args:
269 task_id: Task identifier
270 event: Event to store
271 """
272 # Get task data to find namespace and project_id
273 task_data = get_task_data(task_id)
274 if not task_data:
275 logger.error(f"Cannot store event for task {task_id}: task not found")
276 return
277
278 timestamp = datetime.now(UTC)
279 data: EventData = {
280 "namespace": task_data["namespace"],
281 "project_id": task_data["project_id"],
282 "timestamp": timestamp.isoformat(),
283 "event": event.serialize(),
284 }
285
286 _get_redis_client().zadd(
287 _get_event_key(task_id),
288 {json.dumps(data): timestamp.timestamp()},
289 )
290
291
292def get_task_status(task_id: str) -> Optional[BaseEvent]:

Calls 6

get_task_dataFunction · 0.85
_get_redis_clientFunction · 0.85
_get_event_keyFunction · 0.85
zaddMethod · 0.80
timestampMethod · 0.80
serializeMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…