Hello-QM/catgo-LRG / server/catgo/workflow
catgo-workflow
VerifiedCreate and manage computational chemistry workflows with CatGo. Supports VASP, CP2K, ORCA, MLP, LAMMPS. Build OER/HER/CO2RR workflows, geometry optimization, frequency analysis, Gibbs energy calculations.
engine/broadcast.py
View on GitHub# server/catgo/workflow/engine/broadcast.py
"""WebSocket listener registry for real-time task updates.
Pattern: asyncio.Queue per listener. Non-blocking put -- drops if slow.
"""
from __future__ import annotations
import asyncio
from collections import defaultdict
from typing import Any
_listeners: dict[str, list[asyncio.Queue]] = defaultdict(list)
def add_listener(workflow_id: str, maxsize: int = 128) -> asyncio.Queue:
"""Register a listener queue. Returns the queue to read from."""
q: asyncio.Queue = asyncio.Queue(maxsize=maxsize)
_listeners[workflow_id].append(q)
return q
def remove_listener(workflow_id: str, q: asyncio.Queue) -> None:
"""Unregister a listener."""
lst = _listeners.get(workflow_id, [])
if q in lst:
lst.remove(q)
if not lst:
_listeners.pop(workflow_id, None)
def get_listeners(workflow_id: str) -> list[asyncio.Queue]:
"""Get all listeners for a workflow (for testing)."""
return _listeners.get(workflow_id, [])
async def broadcast(workflow_id: str, message: dict[str, Any]) -> None:
"""Send message to all listeners. Non-blocking -- drops if full."""
for q in _listeners.get(workflow_id, []):
try:
q.put_nowait(message)
except asyncio.QueueFull:
pass
async def broadcast_stage_message(workflow_id: str, task_id: str, message: str) -> None:
"""Broadcast stage/progress update for a running task.
Args:
workflow_id: ID of the workflow
task_id: ID of the task
message: Human-readable stage message (e.g., "Computing vibrational frequencies...")
"""
stage_message = {
"type": "step_message",
"task_id": task_id,
"message": message,
}
await broadcast(workflow_id, stage_message)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies. | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |
| meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要". | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |