Package: ocs
OverviewThe OCS makes it easy to coordinate hardware operation and I/O tasks in a
distributed system such as an astronomical observatory or test laboratory. OCS
relies on the use of a central WAMP router (currentlycrossbar.io) for
coordinating the communication and control of these distributed systems.The OCS provides Python (and JavaScript) functions and classes to allow
“Clients” to talk to “Agents”. An Agent is a software program that knows how to
do something interesting and useful, such as acquire data from some device or
perform cleanup operations on a particular file system. A Control Client could
be a web page with control buttons and log windows, or a script written by a
user to perform a series of unattended, interlocking data acquisition tasks.This repository,OCS, contains library code and core system
components.  Additional code for operating specific hardware can be
found in theSimons Observatory Control System (SOCS)repository.
Grafana and InfluxDB are supported to provide a near real-time monitoring and
historical look back of the housekeeping data.DependenciesThis code targets Python 3.7+.so3g- Required for using the HK Aggregator Agent.crossbar(optional) - The supported WAMP router. Controllable viaocsbow. Can be installed with pip
or run via Docker.InstallationInstall and update with pip:$ pip3 install -U ocsIf you need to install the optional so3g module you can do so via:$ pip3 install -U ocs[so3g]Installing from SourceIf you are considering contributing to OCS, or would like to use an unreleased
feature, you will want to install from source. To do so, clone this repository
and install using pip:$ git clone https://github.com/simonsobs/ocs.git
$ cd ocs/
$ pip3 install -r requirements.txt
$ pip3 install .Note:If you want to install locally, not globally, throw the–userflag
on the pip3 commands.Docker ImagesDocker images for OCS and each Agent are available onDocker Hub. Official
releases will be tagged with their release version, i.e.v0.1.0. These are
only built on release, and thelatesttag will point to the latest of these
released tags. These should be considered stable.Test images will be tagged with the latest released version tag, the number of
commits ahead of that release, the latest commit hash, i.e.v0.6.0-53-g0e390f6. These get built on each commit to themainbranch,
and are useful for testing and development, but should be considered unstable.DocumentationThe OCS documentation can be built using Sphinx. There is a separaterequirements.txtfile in thedocs/directory to install Sphinx and any
additional documentation dependencies:$ cd docs/
$ pip3 install -r requirements.txt
$ make htmlYou can then opendocs/_build/html/index.htmlin your preferred web
browser. You can also find a copy hosted onRead the Docs.TestsThe tests for OCS can be run using pytest, and should be run from thetests/directory:$ cd tests/
$ python3 -m pytestTo run the tests within a Docker container (useful if your local environment is
missing some dependencies), first make sure you build the latest ocs image,
then use docker run:$ docker build -t ocs .
$ docker run --rm -w="/app/ocs/tests/" ocs sh -c "python3 -m pytest -m 'not integtest'"For more details seetests/README.rst.ExampleA self contained example, demonstrating the operation of a small observatory
with a single OCS Agent is contained inexample/miniobs/.  See thereadmein that directory for details.ContributingFor guidelines on how to contribute to OCS seeCONTRIBUTING.rst.LicenseThis project is licensed under the BSD 2-Clause License - see theLICENSE.txtfile for details.