gRPC for the PANOSETI project.
Project description
PANOSETI gRPC Services
This repository contains the microservice architecture for the PANOSETI observatory. It provides gRPC interfaces for real-time data access, observatory control, and general telemetry logging. See here for the main software repo.
Service Directory
Each service operates independently. Click the links below for detailed API documentation and configuration guides.
| Service | Description | Status | Documentation |
|---|---|---|---|
| DAQ Data | Streams real-time science data directly from Hashpipe. | 🟢 Production | Read Docs |
| U-blox Control | Controls and configures GNSS chips (F9T/F9P). | 🟢 Production | Read Docs |
| Telemetry | Collects metadata from remote Linux machines. | 🟡 Beta | Read Docs |
📦 Installation (Client Mode)
If you only need to write scripts to control the observatory or analyze data, install the package from PyPI:
pip install panoseti-grpc
Example Usage:
from panoseti_grpc.telemetry.client import TelemetryClient
# Connect to a running Telemetry Service
client = TelemetryClient("localhost", 50051)
# Upload metadata
client.log_flexible("dev", "weather-01", {"status": "Online", "is-raining": True})
🛠️ Development & Contribution
Environment Setup
If you are deploying the servers on the head node or contributing to the codebase, we recommend installing miniconda (link), then following these steps to setup your environment:
# 0. Clone this repo and go to the repo root
git clone https://github.com/panoseti/panoseti_grpc.git
cd panoseti_grpc
# 1. Create the grpc-py39 conda environment
conda create -n grpc-py39 python=3.9
conda activate grpc-py39
# 2. Install in editable mode with development dependencies
pip install -e .
🧪 Testing
We use a comprehensive CI pipeline (GitHub Actions) to verify every commit. You can—and should—run these same tests locally before pushing code.
Run CI Tests Locally via Bash Scripts (Recommended)
To run a CI test locally, use one of the scripts in scripts/run-ci-tests/.
Each service has an associated script which builds the Docker containers and runs the appropriate test suites.
Examples:
# Run DAQ Data Service tests
./scripts/run-ci-tests/run-daq-data-ci-test.sh
# Run U-blox Control Service tests
./scripts/run-ci-tests/run-ublox-control-ci-test.sh
🚀 Adding New Services
The PANOSETI gRPC architecture is designed to be extensible. If you are developing a new service (e.g., the upcoming daq_control), follow this standard workflow.
0. Branching Strategy
Always create a new feature branch off the development branch:
git checkout dev
git checkout -b feature/daq-control-service
1. Define the Interface (.proto)
Create a new Protocol Buffer definition file in the protos/ directory. This defines the contract between your client and server.
- File:
protos/daq_control.proto - Example:
syntax = "proto3";
package panoseti.daq_control;
service DaqControl {
rpc SetHighVoltage (VoltageRequest) returns (StatusResponse) {}
}
message VoltageRequest { float voltage = 1; }
message StatusResponse { bool success = 1; }
2. Compile the Protos
Run the compilation script to generate the Python gRPC code.
python scripts/compile_protos.py
This will automatically generate two files in src/panoseti_grpc/generated/:
daq_control_pb2.py(Message definitions)daq_control_pb2_grpc.py(Client/Server stubs)
3. Create the Service Module
Create a new directory for your service source code. You must include an __init__.py file for Python to recognize it as a package.
mkdir -p src/panoseti_grpc/daq_control
touch src/panoseti_grpc/daq_control/__init__.py
4. Implement Client & Server
Develop your application logic. You can now import your generated protobuf code using the package path.
Example src/panoseti_grpc/daq_control/server.py:
import grpc
from panoseti_grpc.generated import daq_control_pb2, daq_control_pb2_grpc
class DaqControlServicer(daq_control_pb2_grpc.DaqControlServicer):
def SetHighVoltage(self, request, context):
print(f"Setting voltage to {request.voltage}")
return daq_control_pb2.StatusResponse(success=True)
5. Add CI Tests
Finally, ensure your new service is robust by adding a test suite.
- Create a test directory:
tests/daq_control/ - Add a
Dockerfilefor your test environment. - Add a generic runner script in
scripts/run-ci-tests/run-daq-control-ci-test.sh. - Create unit and integration tests with pytest.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file panoseti_grpc-0.2.13.tar.gz.
File metadata
- Download URL: panoseti_grpc-0.2.13.tar.gz
- Upload date:
- Size: 16.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18b49d4811fd8981462ab437233ad20ef1b0f9c9358785d26e477c3b67c54a00
|
|
| MD5 |
79f72a6236467738228dee54cfc9e4c7
|
|
| BLAKE2b-256 |
0fd7616166b0558e9ceba374a73f040e1bd6de6f5c09a5257eb8aa47e5c457e7
|
File details
Details for the file panoseti_grpc-0.2.13-py3-none-any.whl.
File metadata
- Download URL: panoseti_grpc-0.2.13-py3-none-any.whl
- Upload date:
- Size: 16.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc80a5a4afc87d3ff35f52468f98d9f6ed56096fa87936e0d8ea4189cc1ee2ad
|
|
| MD5 |
1d158063f88902452ab15677ede35a76
|
|
| BLAKE2b-256 |
105437f3d482bff64b38619f66b69118737847aba30324129b92ef34b8564e68
|