Skip to main content

A new protocol for SDSS actors.

Project description

Python Versions PyPI version black Build Status Documentation Status Coverage Status

CLU implements a new protocol for SDSS actor while providing support for legacy-style actor.

Features

  • Asynchronous API based on asyncio.

  • New-style actor with message passing based on AMQP and RabbitMQ.

  • Legacy-style actor for TCP socket communication via tron.

  • Tools for device handling.

  • Messages are validated JSON strings.

  • click-enabled command parser.

Installation

CLU can be installed using pip as

pip install sdss-clu

or from source

git clone https://github.com/sdss/clu
cd clu
pip install .

Development

clu uses poetry for dependency management and packaging. To work with an editable install it’s recommended that you setup poetry and install clu in a virtual environment by doing

poetry install

Pip does not support editable installs with PEP-517 yet. That means that running pip install -e . will fail because poetry doesn’t use a setup.py file. As a workaround, you can use the create_setup.py file to generate a temporary setup.py file. To install clu in editable mode without poetry, do

pip install --pre poetry
pip install -U setuptools
python create_setup.py
pip install -e .

Quick start

Creating a new actor with CLU is easy. To instantiate and run an actor you can simply do

import asyncio
from clu import AMQPActor

async def main(loop):
    actor = await Actor('my_actor').start()
    await actor.run_forever()

asyncio.run(main(loop))

Next, head to the Getting started section for more information about using actors. More examples are available here.

Why a new messaging protocol for SDSS?

Say whatever you want about it, the current SDSS message passing protocol based on Tron, opscore, and actorcore is stable and robust. So, why should we replace it? Here is a list of reasons:

  • It reinvents the wheel. Ok, in all honesty Tron and opscore were written when wheel were still not completely circular, but the truth is that nowadays there are more robust, standard, and better documented technologies out there for message passing.

  • We can remove the need for a central hub product by relying in open-source message brokers such as RabbitMQ.

  • Tron and opscore are Python 2 and it’s unclear the amount of effort that would be needed to convert them to Python 3.

  • While there is some documentation for Tron and opscore, and the code is well written, it’s also cumbersome and difficult to modify by people that didn’t write it. It’s ultimately non-maintainable.

  • The opsctore/actorkeys datamodel is custom-built and extremely difficult to maintain. Standard solutions such as JSON with a JSON schema validator should be preferred.

  • asyncio provides an asynchronous API that is cleaner and easier to code than using threads. It is also more readable and less convoluted than twisted and it’s a Python core library with very active development.

  • CLU uses click for parsing commands, providing a well-defined, easy to use parser.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

sdss-clu-1.5.5.tar.gz (119.5 kB view details)

Uploaded Source

Built Distribution

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

sdss_clu-1.5.5-py3-none-any.whl (133.7 kB view details)

Uploaded Python 3

File details

Details for the file sdss-clu-1.5.5.tar.gz.

File metadata

  • Download URL: sdss-clu-1.5.5.tar.gz
  • Upload date:
  • Size: 119.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for sdss-clu-1.5.5.tar.gz
Algorithm Hash digest
SHA256 21a5e164ed45fd210b5d33bd645ead1887596646c9b208f828ba1f962f70123d
MD5 e3b5515d4f395a90870d615eca2d02cf
BLAKE2b-256 c10a825baa87cb572b47791c23e30f99ef7ce11823deefb825afcec9adfd5548

See more details on using hashes here.

File details

Details for the file sdss_clu-1.5.5-py3-none-any.whl.

File metadata

  • Download URL: sdss_clu-1.5.5-py3-none-any.whl
  • Upload date:
  • Size: 133.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for sdss_clu-1.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a078c9771259b025c59375806026db20f56a86af0b5f62fb681ce31f21aa45ff
MD5 a3112f201d4cdd5e517d3cde774308f0
BLAKE2b-256 7b5f04c9dff08bcf7c5bd4aa3534b863a37850c03fc4dee19c6a5c344c4c1ff4

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 Pingdom Monitoring Sentry Error logging StatusPage Status page