Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples: Check for DAQmx event registration errors #928

Merged
merged 3 commits into from
May 25, 2023

Conversation

bkeryan
Copy link
Contributor

@bkeryan bkeryan commented May 18, 2023

What does this Pull Request accomplish?

Change the DAQmx event examples to explicitly check for stream errors after waiting for initial metadata.
If the stream was closed with an error, it is "done" and reading a response will throw an exception.

Why should this Pull Request be merged?

Demonstrates how to benefit from #927

What testing has been done?

Tested examples as written.

Tested error handling by changing EVERY_N_SAMPLES_EVENT_TYPE_ACQUIRED_INTO_BUFFER to EVERY_N_SAMPLES_EVENT_TYPE_TRANSFERRED_FROM_BUFFER and adding a return after the error check to prevent the worker thread/async task from being started.

@astarche
Copy link
Collaborator

daqmx is still the only driver that's excluded from the validate_examples pipeline step. I think maybe that was because of the async examples?

Note that script can also run the examples if you run it locally with a "server url" param.

No action required, just pointing out a helpful tool that's not helping here.

Base automatically changed from users/bkeryan/nidaqmx-threaded-event-example to main May 19, 2023 11:44
@bkeryan
Copy link
Contributor Author

bkeryan commented May 19, 2023

daqmx is still the only driver that's excluded from the validate_examples pipeline step. I think maybe that was because of the async examples?

Note that script can also run the examples if you run it locally with a "server url" param.

No action required, just pointing out a helpful tool that's not helping here.

I got validate_examples working this morning:

#930
#931

Signed-off-by: Brad Keryan <brad.keryan@ni.com>
- Extract a check_for_stream_error function.
- For non-aio, use stream.exception() to check for errors
- For aio, use stream.code() to check for errors because
  the aio interfaces don't support stream.exception()

Signed-off-by: Brad Keryan <brad.keryan@ni.com>
@bkeryan bkeryan force-pushed the users/bkeryan/nidaqmx-event-example-registration-errors branch from 782dab1 to 5fc9c53 Compare May 22, 2023 21:03
grpc-stubs doesn't treat the object returned from a
UnaryStreamMultiCallable as a Future.

shabbyrobe/grpc-stubs#41
Signed-off-by: Brad Keryan <brad.keryan@ni.com>
@bkeryan bkeryan merged commit d6cd810 into main May 25, 2023
@bkeryan bkeryan deleted the users/bkeryan/nidaqmx-event-example-registration-errors branch May 25, 2023 12:21
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.

3 participants