Skip to main content

Asynchronous xApp framework

Project description

aiomsa

build style PyPI - Downloads

aiomsa is a Python 3.7+ framework built using asyncio. At its core, aiomsa provides a simple and standardized way to write xApps that can be deployed as microservices in Python.

Installation

aiomsa can be installed from PyPI.

pip install aiomsa

You can also get the latest code from GitHub.

poetry add git+https://github.com/facebookexternal/aiomsa

Getting Started

The follwing example shows how to use aiomsa to create a simple xApp for subscribing to the E2T service for a particular custom service model.

from aiomsa import init
from aiomsa.e2 import E2Client

from .models import MyModel


async def main():
   with E2Client(
      app_id="my_app", e2t_endpoint="e2t:5150", e2sub_endpoint="e2sub:5150"
   ) as e2:
      conns = await e2.list_nodes()
      subscription = await e2.subscribe(
         e2_node_id=conns[0],
         service_model_name="my_model",
         service_model_version="v1",
         trigger=bytes(MyModel(param="foo")),
      )

      async for msg in subscription:
         print(msg)


if __name__ == "__main__":
   init(lambda: main())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aiomsa-0.1.0a3.tar.gz (36.3 kB view hashes)

Uploaded Source

Built Distribution

aiomsa-0.1.0a3-py3-none-any.whl (50.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page