Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,7 @@
- `SCRIPTS` added to enum `LoadOptions`
- `DO_NOT_DRIVE_SIGNAL` added to enum `PulseModulationSource`
- `numpy` is now an install dependency
- gRPC support, enabling remote session management via NI gRPC Device Server
- Changed
- Removed

Expand Down
12 changes: 11 additions & 1 deletion docs/nirfsg/class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Session
=======

.. py:class:: Session(self, resource_name, id_query=False, reset_device=False, options={})
.. py:class:: Session(self, resource_name, id_query=False, reset_device=False, options={}, *, grpc_options=None)



Expand Down Expand Up @@ -111,6 +111,16 @@ Session

:type options: dict

:param grpc_options:


MeasurementLink gRPC session options




:type grpc_options: nirfsg.GrpcSessionOptions


Methods
=======
Expand Down
10 changes: 10 additions & 0 deletions docs/nirfsg/errors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ SelfTestError
An error due to a failed self-test


RpcError
--------

.. py:currentmodule:: nirfsg.errors

.. exception:: RpcError

An error specific to sessions to the NI gRPC Device Server


DriverWarning
-------------

Expand Down
91 changes: 91 additions & 0 deletions docs/nirfsg/grpc_session_options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
gRPC Support
============

Support for using NI-RFSG over gRPC

.. py:currentmodule:: nirfsg



SessionInitializationBehavior
-----------------------------

.. py:class:: SessionInitializationBehavior

.. py:attribute:: SessionInitializationBehavior.AUTO


The NI gRPC Device Server will attach to an existing session with the specified name if it exists,
otherwise the server will initialize a new session.

.. note:: When using the Session as a context manager and the context exits, the behavior depends on what happened when the constructor
was called. If it resulted in a new session being initialized on the NI gRPC Device Server, then it will automatically close the
server session. If it instead attached to an existing session, then it will detach from the server session and leave it open.


.. py:attribute:: SessionInitializationBehavior.INITIALIZE_SERVER_SESSION


Require the NI gRPC Device Server to initialize a new session with the specified name.

.. note:: When using the Session as a context manager and the context exits, it will automatically close the
server session.


.. py:attribute:: SessionInitializationBehavior.ATTACH_TO_SERVER_SESSION


Require the NI gRPC Device Server to attach to an existing session with the specified name.

.. note:: When using the Session as a context manager and the context exits, it will detach from the server session
and leave it open.



GrpcSessionOptions
------------------


.. py:class:: GrpcSessionOptions(self, grpc_channel, session_name, initialization_behavior=SessionInitializationBehavior.AUTO)


Collection of options that specifies session behaviors related to gRPC.

Creates and returns an object you can pass to a Session constructor.


:param grpc_channel:


Specifies the channel to the NI gRPC Device Server.



:type grpc_channel: grpc.Channel


:param session_name:


User-specified name that identifies the driver session on the NI gRPC Device Server.

This is different from the resource name parameter many APIs take as a separate
parameter. Specifying a name makes it easy to share sessions across multiple gRPC clients.
You can use an empty string if you want to always initialize a new session on the server.
To attach to an existing session, you must specify the session name it was initialized with.



:type session_name: str


:param initialization_behavior:


Specifies whether it is acceptable to initialize a new session or attach to an existing one, or if only one of the behaviors is desired.

The driver session exists on the NI gRPC Device Server.



:type initialization_behavior: :py:data:`nirfsg.SessionInitializationBehavior`
1 change: 1 addition & 0 deletions docs/nirfsg/toc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ API Reference
enums
errors
examples
grpc_session_options

1 change: 1 addition & 0 deletions generated/nirfsg/nirfsg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from nirfsg.enums import * # noqa: F403,F401,H303
from nirfsg.errors import DriverWarning # noqa: F401
from nirfsg.errors import Error # noqa: F401
from nirfsg.grpc_session_options import * # noqa: F403,F401,H303
from nirfsg.session import Session # noqa: F401


Expand Down
Loading
Loading