Skip to content

Add Support for Batch Publishing Non-Scalar Measurement Values#133

Merged
hunter-ni merged 30 commits into
mainfrom
users/hunter-ni/publish-measurement-batch-non-scalar
May 28, 2026
Merged

Add Support for Batch Publishing Non-Scalar Measurement Values#133
hunter-ni merged 30 commits into
mainfrom
users/hunter-ni/publish-measurement-batch-non-scalar

Conversation

@hunter-ni
Copy link
Copy Markdown
Contributor

@hunter-ni hunter-ni commented May 19, 2026

What does this Pull Request accomplish?

This set of changes updates the MDS Python API to support the batch publishing of non-scalar measurement values (e.g., AnalogWaveform). This is in addition to the pre-existing support for batch publishing scalar measurement values.

This reflects the addition of this support to the service API itself in ni/ni-apis#161.

Implementation

  • Updates _grpc_conversion.py to handle an Iterable of the various supported non-scalar data types being supplied as the values object being passed into publish_measurement_batch.
    • This use of Iterable is consistent with our existing support of an Iterable of float, int, str, and bool being supplied for batch publishing scalar values.
  • Updated _grpc_conversion.py to handle an Iterable being supplied to publish_condition_batch that cannot be iterated more than once.

Why should this Pull Request be merged?

This PR should be submitted to maintain feature support/consistency between the MDS Python API and the DataStoreService itself.

What testing has been done?

  • Added new unit tests related to populating the PublishMeasurementBatchRequest appropriately from batched, non-scalar values supplied to publish_measurement_batch
    • Includes error cases for heterogeneous Iterables and unsupported types being supplied
  • Added acceptance tests verifying that non-scalar measurement data can successfully be batch published and then read back from MDS
  • Added a notebook example describing and exercising both the scalar and non-scalar data cases of publish_measurement_batch (in addition to publish_condition_batch).
  • Added new unit tests for better test coverage of populating PublishConditionBatchRequest appropriately

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request extends the NI DataStore Python client’s batch publishing support to include non-scalar measurement value types (e.g., AnalogWaveform, Vector, XYData) in addition to the existing scalar batch support, aligning the client with updated service API capabilities.

Changes:

  • Updated gRPC request population logic to accept Iterables of supported non-scalar measurement types and map them into the appropriate PublishMeasurementBatchRequest fields.
  • Added extensive unit and acceptance tests validating successful conversions/publishing and error handling for heterogeneous/unsupported iterables.
  • Added a notebook example demonstrating batch publishing for both scalar and non-scalar measurements (and conditions).

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/unit/data/test_publish_measurement.py Updates an assertion to match the new unsupported-iterable error message format.
tests/unit/data/test_grpc_conversion.py Adds unit tests covering batch conversion for multiple non-scalar types and error cases.
tests/acceptance/test_publish_measurement_batch_and_read_data.py Adds acceptance tests for batch publishing/read-back of non-scalar values (e.g., AnalogWaveform, per-iteration Vector).
src/ni/datastore/data/_grpc_conversion.py Implements iterable-of-non-scalar handling for publish_measurement_batch request construction.
pyproject.toml Bumps ni-measurements-data-v1-client minimum prerelease version to pick up new API support.
poetry.lock Updates locked dependency versions consistent with the updated client/proto requirements.
examples/notebooks/publish/publish_batch.ipynb New notebook documenting and exercising scalar + non-scalar batch publishing flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@hunter-ni hunter-ni marked this pull request as ready for review May 20, 2026 17:43
@hunter-ni hunter-ni requested review from a team and mjohanse-emr May 20, 2026 17:43
Comment thread examples/notebooks/publish/publish_batch.ipynb
Comment thread src/ni/datastore/data/_grpc_conversion.py Outdated
Comment thread tests/acceptance/test_publish_measurement_batch_and_read_data.py
Comment thread tests/unit/data/test_grpc_conversion.py
Comment thread src/ni/datastore/data/_grpc_conversion.py
Copy link
Copy Markdown
Collaborator

@dixonjoel dixonjoel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with a suggestion for code cleanup. I'm not doing 'Request Changes' since I'll be out on vacation as of tomorrow, so I'll trust you to address those.

Comment thread src/ni/datastore/data/_grpc_conversion.py
@hunter-ni hunter-ni merged commit b23ba71 into main May 28, 2026
29 checks passed
@hunter-ni hunter-ni deleted the users/hunter-ni/publish-measurement-batch-non-scalar branch May 28, 2026 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants