Updates behavior when new session name is in use in different resource repository. #687
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
SessionException
struct in the shared librarySessionException
and return a gRPC Status ofINVALID_ARGUMENT
with the exception's message attached.SessionException
to be thrown when trying to add a session where the session name is already in use in a different resource repository.Why should this Pull Request be merged?
Addresses #685
If a proposed session name is already used by a different driver, grpc-device was returning a warning status 1 on the return message's status field. This both allows programs making the call to keep running since it's treated as a warning and if the client does check the status code it can be ambiguous depending on the driver.
This change addresses this by instead immediately returning a gRPC Status of
INVALID_ARGUMENT
with a message explaining that the session name is already in use.What testing has been done?
Updated a unit test testing the old behavior to now ensure the new SessionException is thrown if the session name is used in a different resource repository.
Ran the examples like they were specified in the Issue.
Now, running the daqmx example while dcpower is running using "my task" as the session name produces:
And similarly, running the dcpower example while the daqmx example is running (with
time.wait(60.0)
) stops the program with the same message: