Files
buryan-infra/ops/events/adapter_plugins/registry.py
T
architect 506ae58410
lint / hygiene (pull_request) Failing after 17s
standard / check (pull_request) Successful in 7s
lint / hygiene (push) Failing after 1m11s
standard / check (push) Successful in 8s
[STAGE4] Adapter SDK, 4 adapters, contract tests, preview
2026-11-27 20:40:19 +03:00

30 lines
866 B
Python

"""Discover and run event adapters without editing the pipeline core."""
import importlib
import pkgutil
from pathlib import Path
from .base import Adapter
def load_adapters():
adapters = []
pkg_dir = Path(__file__).resolve().parent
for mod in sorted(pkgutil.iter_modules([str(pkg_dir)])):
if mod.name in ("base", "registry") or mod.name.startswith("_"):
continue
m = importlib.import_module("adapter_plugins." + mod.name)
for obj in vars(m).values():
if isinstance(obj, type) and issubclass(obj, Adapter) and obj is not Adapter:
adapters.append(obj())
return adapters
def run_all(conn):
out = {}
for a in load_adapters():
try:
out[a.name] = a.poll(conn)
except Exception as e:
out[a.name] = "error:%s" % str(e)[:120]
return out