Skip to main content

Helper package to build ASAM ODS EXD API grpc plugins.

Project description

ASAM ODS EXD-API for NI TDMS Files

Python 3.12+ License: MIT Code style: black Type checking: mypy

ASAM ODS EXD-API Architecture

sequenceDiagram

actor CLIENT as Client
participant PDTT as 🛠️Importer
participant PODS as 🗃️ASAM ODS server
participant PLUGIN as 📊EXD-API plugin
participant FILE as 🗂️File Storage

autonumber

opt Import phase
  FILE ->>+ PDTT: New file shows up
  PDTT ->>+ PLUGIN : Get Structure
  PLUGIN -> FILE: Extract content information
  PLUGIN ->> PLUGIN: Create Structure
  PLUGIN ->>- PDTT: Return Structure
  PDTT ->> PODS: Import ODS structure
  Note right of PDTT: Create hierarchy<br/>AoTest,AoMeasurement,...
  PDTT ->>- PODS: Add External Data info
  Note right of PDTT: Attach AoFile ... for external data<br/>AoFile,AoSubmatrix,AoLocalColumn,...
end

Note over CLIENT, FILE: Now we can work with the imported files

loop Runtime phase
  CLIENT ->> PODS: Establish ODS session
  CLIENT ->> PODS: Work with meta data imported from structure
  CLIENT ->> PODS: Access external channel in preview
  PODS ->> PLUGIN: GetValues
  PLUGIN ->> FILE: Get Channel values
  PLUGIN ->> PODS: Return values of channels
  PODS ->> CLIENT: Return values needed for plot
end

Configuration & Usage

Server Options

python external_data_file.py --help

Key configuration options:

Option Default Description
--port 50051 gRPC server port
--bind-address [::] Server bind address
--max-workers CPU count × 2 Thread pool size
--max-concurrent-streams None Max concurrent gRPC streams
--use-tls False Enable TLS/SSL
--tls-cert-file - Path to server certificate (PEM)
--tls-key-file - Path to server private key (PEM)
--tls-client-ca-file - CA bundle for client verification
--require-client-cert False Require valid client certificate
--verbose False Enable debug logging
--health-check-enabled False Enable health check service

TLS Configuration

Basic TLS:

python external_data_file.py \
  --use-tls \
  --tls-cert-file /path/to/server.crt \
  --tls-key-file /path/to/server.key

Mutual TLS (mTLS):

python external_data_file.py \
  --use-tls \
  --tls-cert-file /path/to/server.crt \
  --tls-key-file /path/to/server.key \
  --tls-client-ca-file /path/to/client-ca.crt \
  --require-client-cert

Docker with TLS:

docker run \
  -v /path/to/certs:/certs \
  -p 50051:50051 \
  ghcr.io/totonga/asam-ods-exd-api-nptdms:latest \
  --use-tls \
  --tls-cert-file /certs/server.crt \
  --tls-key-file /certs/server.key

Development

Setup Development Environment

# Install with development dependencies
pip install -e ".[dev]"

Type Checking

mypy .

Running Tests

python -m unittest discover -s tests

Running Docker Integration Tests

python -m unittest tests.test_docker_integration -v

Code Style

The project uses:

  • Black for code formatting
  • isort for import sorting
  • Pylint for linting
  • Mypy for static type checking

Updating Protocol Buffers

The protobuf files are generated from the ASAM ODS standard specifications:

# Download latest proto files
curl -o ods.proto https://raw.githubusercontent.com/asam-ev/ASAM-ODS-Interfaces/main/ods.proto
curl -o ods_external_data.proto https://raw.githubusercontent.com/asam-ev/ASAM-ODS-Interfaces/main/ods_external_data.proto

# Generate Python stubs
mkdir -p ods_exd_api_box/proto
python3 -m grpc_tools.protoc \
  -I. \
  --python_out=ods_exd_api_box/proto/. \
  --pyi_out=ods_exd_api_box/proto/. \
  --grpc_python_out=ods_exd_api_box/proto/. \
  ods.proto ods_external_data.proto

Performance Considerations

  • File Caching - Opened files are cached to minimize I/O operations
  • Reference Counting - Automatic resource cleanup with reference counting
  • Thread Pool - Configurable worker threads for parallel request handling
  • Message Size Limits - Configurable max send/receive message sizes

Troubleshooting

Connection Refused

Ensure the server is running and listening on the correct port:

netstat -tlnp | grep 50051

TLS Certificate Errors

Verify certificate paths and permissions:

openssl x509 -in /path/to/cert.crt -text -noout

Type Checking Failures

Ensure all dependencies are installed with type stubs:

pip install -e ".[dev]"
mypy .

Contributing

Contributions are welcome! Please:

  1. Use dev container or set up local dev environment
  2. Ensure type checking passes: `mypy .
  3. Run tests: python -m unittest discover -s tests
  4. Follow code style (Black, isort)
  5. Add tests for new features

License

MIT License - see LICENSE file for details.

References

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

ods_exd_api_box-1.2.0.tar.gz (54.5 kB view details)

Uploaded Source

Built Distribution

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

ods_exd_api_box-1.2.0-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file ods_exd_api_box-1.2.0.tar.gz.

File metadata

  • Download URL: ods_exd_api_box-1.2.0.tar.gz
  • Upload date:
  • Size: 54.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for ods_exd_api_box-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1b0b827aab19c65615b2d41f2ff83963fe6c72b92d6fb2ee9f88ee85bf652afa
MD5 7fd1e6eccdf1306ed899afe5435d2bf7
BLAKE2b-256 c8d0a85e457d376f817b2575ae97165a1eafcf31bb1ad1a47dbbe445335a36fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ods_exd_api_box-1.2.0.tar.gz:

Publisher: build.yml on totonga/ods-exd-api-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ods_exd_api_box-1.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ods_exd_api_box-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b003f5758d7e45ddc5191252509107ae6249298c3a25a90579c5112d7c79af3
MD5 8e47a0096db880fa15a170cf39b4592b
BLAKE2b-256 de71f88f4871db9e895792b7504a49f21f6a1c3e53f81c0926f5c706f0a0680b

See more details on using hashes here.

Provenance

The following attestation bundles were made for ods_exd_api_box-1.2.0-py3-none-any.whl:

Publisher: build.yml on totonga/ods-exd-api-box

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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