Skip to main content

This package is a framework for writing Xapps in python. The framework reduces the amount of code required in an Xapp by providing common features needed by all Python-based Xapps including communication with the RIC message router (RMR) and the Shared Data Layer (SDL).

The framework was designed to suport many types of Xapps, including applications that are purely reactive to RMR messages, and applications that initiate actions according to other criteria.

Reactive Xapps

A reactive Xapp acts on messages that are delivered (pushed) via RMR. The Xapp only takes action upon receipt of an RMR message. The Xapp never takes action at another time.

This type of application is constructed by creating callback functions and registering them with the framework by message type. When an RMR message arrives, the appropriate callback is invoked. An Xapp may define and register a separate callback for each expected message type. Every Xapp must define a default callback function, which is invoked when a message arrives for which no type-specific callback was registered. An analogy of this is AWS Lambda: “execute this code every time an event comes in” (the code to execute can depend on the type of event).

General Xapps

A general Xapp acts according to its own criteria, which may include receipt of RMR messages.

This type of application is constructed by creating a function that gets invoked by the framework. Typically that function contains a while (something) event loop. If the function returns, the Xapp stops. In this type of Xapp, the Xapp must fetch its own data, either from RMR, SDL or other source. The framework does less work for a general application compared to a reactive application. The framework sets up an RMR thread and an SDL connection, then invokes the client-provided function.

Threading in the Framework

RMR interactions are processed in a thread started by the framework. This implementation detail is documented here for transparency, but most users will not have to worry about this.

In both types of Xapp, the framework launches a separate thread whose only job is to read from RMR and deposit all messages (and their summaries) into a thread-safe queue. When the client Xapp reads from RMR using the framework (this read is done by the framework itself in the RMR Xapp, but by the client in a general Xapp), the read is done from the framework-managed queue. The framework is implemented this way so that a long-running client function (e.g., consume) will not block RMR reads. This is important because RMR is not a persistent message bus, if an RMR client does not read fast enough, messages can be lost. So in this framework the client code is not in the same thread as the RMR reads, to ensure that long-running client code will not cause message loss.

In the case of RMR Xapps, there are currently 3 potential threads; the thread that reads from RMR directly, and the user can optionally have the RMR queue read run in a thread, returning execution back to the user thread. The default is only two threads however, where .run does not return back execution and the user code is finished at that point.

Healthchecks

The framework provides a default RMR healthcheck probe handler for reactive Xapps. When an RMR healthcheck message arrives, this handler checks that the RMR thread is healthy (of course the Xapp cannot even reply if the thread is not healthy!), and that the SDL connection is healthy. The handler responds accordingly via RMA. The Xapp can override this probe handler by registering a new callback for the appropriate message type.

The framework provides no healthcheck handler for general Xapps. Those applications must handle healthcheck probe messages appropriately when they read their RMR mailboxes.

There is no http service in the framework, so there is no support for HTTP-based healthcheck probes, such as what a deployment manager like Kubernetes may use.

Examples

Two sample Xapps using this framework are provided in the examples directory of the git repository. The first, ping, is a general Xapp that defines a main function that reads its RMR mailbox in addition to other work. The second, pong, is a reactive Xapp that only takes action when a message is received.

To run a demonstration, build the Docker images for both examples using the supplied Dockerfiles. Then start the Pong container (the listener) followed by the Ping container (the sender). The Ping application sends a message, the pong application receives the message and use RMR’s return-to-sender feature to reply. Ping then reads its own mailbox and demonstrates other functionality.

Download files

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

Source Distribution

ricxappframe-1.1.1.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ricxappframe-1.1.1-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file ricxappframe-1.1.1.tar.gz.

File metadata

  • Download URL: ricxappframe-1.1.1.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8

File hashes

Hashes for ricxappframe-1.1.1.tar.gz
Algorithm Hash digest
SHA256 15e9db41d79e626b04641adbc3342399c3e33a08a58ef1e6c903b6cc8c433fbe
MD5 b1a65c4e4fa445e5e145b01f9435095a
BLAKE2b-256 609d7ce792f1d3c6dbcad7b5e6edb527253e7ce608ce4974b7dfa5ab8212bad7

See more details on using hashes here.

File details

Details for the file ricxappframe-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: ricxappframe-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8

File hashes

Hashes for ricxappframe-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9b463c439069074d6824636cc4873826e8144ea976af4034a9ee0efd22da4007
MD5 fb5e2bc5e443dec26be3c877d6b72fd3
BLAKE2b-256 8ee5819cd3d2a5d2d906f2664a08bccaf7e0dc2fbba2584e3214260ef0440c52

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page