Something went wrong. Try again.
Mirrored from GitHub github.com/roostorg/osprey
Something went wrong. Try again.
1.3 kB · 31 lines
Python
at commit ce4e6960
1234567891011121314151617181920212223242526272829303132"""Example plugin registrations for the experimental asyncio worker.
This is the async counterpart to ``register_plugins`` (which targets the syncgevent worker). It is discovered via the ``osprey_async_plugin`` entry-pointgroup and loaded by the async worker's plugin manager, so it never runs in thesync worker.
Registers a pure-computation UDF (``TextContains`` runs inline in the asyncexecutor — no I/O, so it needs no async variant) and an example async outputsink. UDFs that perform I/O must subclass ``AsyncUDFBase`` instead; see``osprey.async_worker.stdlib_udfs.async_mx_lookup`` for that pattern."""
from typing import Any, Sequence, Type
from async_sinks.example_async_output_sink import ExampleAsyncOutputSinkfrom osprey.async_worker.adaptor.interfaces import AsyncBaseOutputSinkfrom osprey.async_worker.adaptor.plugin_manager import hookimpl_osprey_asyncfrom osprey.engine.udf.base import UDFBasefrom osprey.worker.lib.config import Configfrom udfs.text_contains import TextContains
@hookimpl_osprey_asyncdef register_udfs() -> Sequence[Type[UDFBase[Any, Any]]]: return [TextContains]
@hookimpl_osprey_asyncdef register_async_output_sinks(config: Config) -> Sequence[AsyncBaseOutputSink]: return [ExampleAsyncOutputSink()]