JLab Alarm Warning System (JAWS)

"Don't get bit!"
An alarm system built on Kafka that supports pluggable alarm sources. This project defines Kafka topics and AVRO schemas, ties together the message pipeline services that make up the core alarm system in a docker-compose file, and provides Python scripts for configuring and interacting with the system. JAWS attempts to comply with ANSI/ISA 18.2-2016 where appropriate.
Overview
The JAWS alarm system is composed primarily of two subsystems: registrations and notifications.
The inventory of all possible alarms (the master alarm database) are stored in Kafka as alarm instances, and these instances are organized into classes so that some properties are provided by their assigned alarm class. The alarm instances are maintained on the alarm-instances topic. Alarm classes define group-shared properties such as corrective action and rationale and are persisted on the alarm-classes topic. The JAWS effective processor joins classes to instances to form effective alarm registrations on the effective-registrations topic.
Activations indicate an alarm is annunciating (active), and timely operator action is required. Alarms are triggered active by producing messages on the alarm-activations topic. An alarm can be overridden to either suppress or incite the active state by placing a message on the alarm-overrides topic. The effective notification state considering both activations and overrides is calculated by JAWS from activations and overrides and made available on the effective-notifications topic.
Both effective registrations and effective notifications are combined by the JAWS effective processor on the effective-alarms topic.
Services
- jaws-effective-processor: Process classes and overrides and provide effective state on the effective-registrations, effective-notifications, and effective-alarms topics
- jaws-admin-gui: GUI for managing alarm registrations
- jaws-operator-gui: GUI for monitoring alarms and managing overrides
APIs
Data
Plugins
- jaws-epics2kafka: Connects EPICS alarms to JAWS
- registrations2epics: Notifies epics2kafka of EPICS alarm registration updates
Quick Start with Compose
- Grab project
git clone https://github.com/JeffersonLab/jaws
cd jaws
- Launch Docker
docker compose up
- Monitor active alarms
docker exec -it jaws /scripts/client/list_activations.py --monitor
- Trip an alarm
docker exec jaws /scripts/client/set_activation.py alarm1
Note: The docker-compose services require significant system resources - tested with 4 CPUs and 4GB memory.
See: More Usage Examples
Install
Core scripts
Requires Python 3.9+
pip install jaws-scripts
Note: It's generally recommended to use a Python virtual environment to avoid dependency conflicts (else a dedicated Docker container can be used).
Entire application
The entire JAWS application consists of multiple microservices and each one has a separate installation. However, you can launch them all using the docker compose here. This compose file (and it's references) answers the question of which version of each microservice to use. In a production environment you'll likely want to use some orchestration tooling, which could be literally anything from bash scripts leveraging systemctl --host to Ansible/Chef/Puppet/Whatever, or perhaps Kubernetes + tooling.
API
Admin Scripts API
Configure
The following environment variables are required by the scripts:
| Name | Description |
|---|---|
| BOOTSTRAP_SERVER | Host and port pair pointing to a Kafka server to bootstrap the client connection to a Kafka Cluster; example: kafka:9092 |
| SCHEMA_REGISTRY | URL to Confluent Schema Registry; example: http://registry:8081 |
The Docker container requires the script environment variables, plus can optionally handle the following environment variables as well:
| Name | Description |
|---|---|
| ALARM_LOCATIONS | Path to an alarm locations file to import (example file), else an https URL to a file, else a comma separated list of location definitions with fields separated by the pipe symbol. Example Inline CSV: name|parent |
| ALARM_CATEGORIES | Path to an alarm categories file to import (example file), else an https URL to a file, else a comma separated list of catgory definitions with fields. Example Inline CSV: name |
| ALARM_CLASSES | Path to an alarm classes file to import (example file), else an https URL to a file, else a comma separated list of class definitions with fields separated by the pipe symbol. Example Inline CSV: name|category|priority|rationale|correctiveaction|pointofcontactusername|latching|filterable|ondelayseconds|offdelayseconds |
| ALARM_INSTANCES | Path to an alarm instances file to import (example file), else an https URL to a file, else a comma separated list of instance definitions with fields separated by the pipe symbol. Leave epicspv field empty for SimpleProducer. Example Inline CSV: name|class|epicspv|location|maskedby|screencommand |
Build
This Python 3.9+ project is built with setuptools and may be run using either the Python virtual environment feature or a dedicated Docker container to isolate dependencies. The pip tool can be used to download dependencies. Docker was used extensively for development due to the dependency on the Kafka ecosystem.
git clone https://github.com/JeffersonLab/jaws
cd jaws
python -m build
Note for JLab On-Site Users: Jefferson Lab has an intercepting proxy
See: Python Development Notes and Docker Development Quick Reference
Test
The integration tests require a docker container environment and are run automatically as a GitHub Action on git push. You can also run tests from a local workstation using the following instructions:
- Start Docker Test environment
docker compose -f test.yml up
- Execute Tests
docker exec -i jaws bash -c "cd /tests; pytest -p no:cacheprovider"
Note: You can also run tests directly on the host (instead of inside the jaws container) if you set the environment variables as:
BOOTSTRAP_SERVERS=localhost:9094 and SCHEMA_REGISTRY=http://localhost:8081
Release
- Bump the version number in setup.cfg and commit and push to GitHub (using Semantic Versioning).
- Create a new release on the GitHub Releases page corresponding to same version in setup.cfg (Enumerate changes and link issues)
- Clean build by removing
build,dist, anddocsrc/source/_autosummarydirectories - Activate virtual env
- From venv build package, build docs, lint, test, and publish new artifact to PyPi with:
python -m build
sphinx-build -b html docsrc/source build/docs
pylint src/jaws_scripts
python -m twine upload --repository pypi dist/*
- Build and push Docker image
- Update Sphinx docs by copying them from build dir into gh-pages branch and updating index.html (commit, push).
See Also
Metadata
Release files for jaws-scripts 4.5.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jaws-scripts-4.5.4.tar.gz | 19.2 kB | Without provenance | Details for jaws-scripts-4.5.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jaws_scripts-4.5.4-py3-none-any.whl | Python 3 | none | any | Details for jaws_scripts-4.5.4-py3-none-any.whl |
Total release size: 49.3 kB
Release files / jaws-scripts-4.5.4.tar.gz
| Download URL | jaws-scripts-4.5.4.tar.gz |
|---|---|
| Size | 19.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a0c1f5ca0c915f0e3562dd3f996425380af14f23f87299d7e7231234fe796453
|
|
BLAKE2b-256 checksum How to use checksums |
5c176f38f68929d2f3f5247925154e202ed44610533392ccaa60c374f0f4bd74
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
|
Release files / jaws_scripts-4.5.4-py3-none-any.whl
| Download URL | jaws_scripts-4.5.4-py3-none-any.whl |
|---|---|
| Size | 30.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ee9bf6c7c8e8457b0729dce07e4184103c1c8d035a0066addcf2d8aa3b63fe2
|
|
BLAKE2b-256 checksum How to use checksums |
18981387a3e9f7f9960c6f02d34c81a475a5b1e9c92809a4079994958cc85aba
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
|
Security for jaws-scripts 4.5.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.