Skip to main content

This library is a framework for writing Xapps in python. There may or may not be many Xapps written in python; however rmr, sdl, and logging libraries all exist for python, and this framework brings them together.

There are (at the time of writing) two “kinds” of Xapps one can instantiate with this framework that model “push” (RMR Xapps) and “pull” (General Xapps), as described below.

RMR Xapps

This class of Xapps are purely reactive to rmr; data is always “pushed” to it via rmr. That is, every time the Xapp receives an rmr message, they do something, then wait for the next message to arrive, end never need to execute functionality at another time (if they do, use the next class). This is represented by a very simple callback consume that is invoked every time an rmr message arrives (note, this is subject to change, with more callbacks for specific messages like A1_POLICY_REQUEST). 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

In this class of Xapp the user simply provides a function that gets invoked, and typically that function has a while (something) in it. If the function returns, the Xapp will stop. In this type of Xapp, the Xapp must “pull” it’s own data, typically from SDL, rmr (ie query another component for data), or other sources. The framework is “lighter” in this case then the former; it sets up an SDL connection, an rmr thread, and then calls the client provided function. This is to be used for Xapps that are not purely event driven.

RMR Threading in the framework

NOTE: this is an implementation detail! We expose this for transparency but most users will not have to worry about this.

In both types of Xapp, the framework launches a seperate 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 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 queue. The framework is implemented this way so that a long running client function (e.g., consume) cannot block rmr reads. This is important because rmr is not a persistent message bus, if any 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, so that long running client code can never lead to lost messages.

Examples

There are two examples in the examples directory; ping which is a general Xapp, and pong which is an RMR Xapp. Ping sends a message, pong receives the message and use rts to reply. Ping then reads it’s own mailbox and demonstrates other functionality. The highlight to note is that pong is purely reactive, it only does anything when a message is received. Ping uses a general that also happens to read it’s rmr mailbox inside.

Current gaps

The following are known gaps or potential enhancements at the time of writing.

* a logger has to be provided to the xapp
* the ability to specify more callacks per message type?

Download files

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

Source Distribution

ricxappframe-0.2.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

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

ricxappframe-0.2.0-py3-none-any.whl (12.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ricxappframe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 92fd5bddd66e76f248fed651f5a7e06e3a76a51b7dd2b80858c7018487580cb7
MD5 d282fbb7fee1961a43c9094d824d671e
BLAKE2b-256 8a55501c2eb391d49edba643635a74d05fe2694a60547842803aa42f8fbcb1de

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ricxappframe-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.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/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.8

File hashes

Hashes for ricxappframe-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb161f2bf53227c8dc3e91edc6763f9efd51a0a6f2322d4e751bf6dc58fa0433
MD5 97d567a516440c66ab5dcbe27e17faff
BLAKE2b-256 ac885611483873bb5f7cba8f6c68d736f45aef78bfb8d2a3d953737717c56a20

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