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.3.1.tar.gz (63.6 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.3.1-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ods_exd_api_box-1.3.1.tar.gz
  • Upload date:
  • Size: 63.6 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.3.1.tar.gz
Algorithm Hash digest
SHA256 4eb95cbc3db47e6d7ad82308d02e8ff58bf2e284c9d31f0bd1490c2eed1ed9e7
MD5 db0f6bd8ad978f94544af0895f033e0a
BLAKE2b-256 2c263663f59a0b6f558c0422c5502e639ff60b9f620e372f3502e8b708d5d731

See more details on using hashes here.

Provenance

The following attestation bundles were made for ods_exd_api_box-1.3.1.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.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ods_exd_api_box-1.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 03a00d09a004b5eca8f7f2bf11dfc93a922e917ea4eedcbf76dafa3409e3e9da
MD5 837faf127e51f7b2ab19972f7fe41638
BLAKE2b-256 a275366caf1867468ab8eefcf18b1deb70d5567addcfa4cfc5f06c7dcbcc06c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ods_exd_api_box-1.3.1-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