Skip to main content

Distributed sardana recorder

Project description

Sardana Streams

Pypi python versions Pypi version Pypi status License

Sardana data streaming infrastucture. Comprises:

  • redis based sardana scan recorder
  • Client recorders:
    • generic scan stream client (library)
    • SPEC recorder daemon
    • HDF5 recorder daemon
    • Scan GUI

Installation

From within your favorite python environment:

$ pip install sardana-streams

Usage

The name acme used in the following examples represents a fictional corporation that features prominently in the Road Runner cartoons.

Configuration

Activate sardana redis recorder:

  • Put the installation directory where the sardana_streams/recorder resides in RecorderPath tango property of the MacroServer. (ex: /usr/local/lib/python3.5/dist-packages/sardana_streams/recorder)
  • From spock:
    • activate the recorder with: senv DataRecorder "['RedisRecorder']"
    • configure the recorder with senv RedisRecorder "{'host': 'acme.org', 'port': 7379, 'db': 1}" (replace host, port and db with your own)

The RedisRecorder env can be a string or a dictionary identifying the Redis database.

In case a string is given, it recognizes the same format url argument from redis.from_url().

In case a dict is given it recognizes the same keyword arguments as redis.from_url() plus:

  • TTL: scan time to live in seconds (defaults to one week)
  • key_prefix: scan key prefix (defaults to <macro server name>:sardana:scan)

Example

Here is a simple example of a client which simply listens to scan events and prints them on screen:

import contextlib

import redis
from sardana_streams.client import ScanStream

db = redis.from_url('redis://acme.org:7379/1')
prefix = "acme:sardana:scan"
stream = ScanStream(db, prefix)
with contextlib.closing(stream):
    for event in stream:
        print(event)

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

sardana-streams-0.1.0.tar.gz (6.6 kB view hashes)

Uploaded Source

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