|
| 1 | +gRPC Support |
| 2 | +============ |
| 3 | + |
| 4 | +Support for using NI-RFSG over gRPC |
| 5 | + |
| 6 | +.. py:currentmodule:: nirfsg |
| 7 | +
|
| 8 | +
|
| 9 | +
|
| 10 | +SessionInitializationBehavior |
| 11 | +----------------------------- |
| 12 | + |
| 13 | +.. py:class:: SessionInitializationBehavior |
| 14 | +
|
| 15 | + .. py:attribute:: SessionInitializationBehavior.AUTO |
| 16 | +
|
| 17 | +
|
| 18 | + The NI gRPC Device Server will attach to an existing session with the specified name if it exists, |
| 19 | + otherwise the server will initialize a new session. |
| 20 | + |
| 21 | + .. note:: When using the Session as a context manager and the context exits, the behavior depends on what happened when the constructor |
| 22 | + was called. If it resulted in a new session being initialized on the NI gRPC Device Server, then it will automatically close the |
| 23 | + server session. If it instead attached to an existing session, then it will detach from the server session and leave it open. |
| 24 | + |
| 25 | + |
| 26 | + .. py:attribute:: SessionInitializationBehavior.INITIALIZE_SERVER_SESSION |
| 27 | +
|
| 28 | +
|
| 29 | + Require the NI gRPC Device Server to initialize a new session with the specified name. |
| 30 | + |
| 31 | + .. note:: When using the Session as a context manager and the context exits, it will automatically close the |
| 32 | + server session. |
| 33 | + |
| 34 | + |
| 35 | + .. py:attribute:: SessionInitializationBehavior.ATTACH_TO_SERVER_SESSION |
| 36 | +
|
| 37 | +
|
| 38 | + Require the NI gRPC Device Server to attach to an existing session with the specified name. |
| 39 | + |
| 40 | + .. note:: When using the Session as a context manager and the context exits, it will detach from the server session |
| 41 | + and leave it open. |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | +GrpcSessionOptions |
| 46 | +------------------ |
| 47 | + |
| 48 | + |
| 49 | +.. py:class:: GrpcSessionOptions(self, grpc_channel, session_name, initialization_behavior=SessionInitializationBehavior.AUTO) |
| 50 | +
|
| 51 | +
|
| 52 | + Collection of options that specifies session behaviors related to gRPC. |
| 53 | + |
| 54 | + Creates and returns an object you can pass to a Session constructor. |
| 55 | + |
| 56 | + |
| 57 | + :param grpc_channel: |
| 58 | + |
| 59 | + |
| 60 | + Specifies the channel to the NI gRPC Device Server. |
| 61 | + |
| 62 | + |
| 63 | + |
| 64 | + :type grpc_channel: grpc.Channel |
| 65 | + |
| 66 | + |
| 67 | + :param session_name: |
| 68 | + |
| 69 | + |
| 70 | + User-specified name that identifies the driver session on the NI gRPC Device Server. |
| 71 | + |
| 72 | + This is different from the resource name parameter many APIs take as a separate |
| 73 | + parameter. Specifying a name makes it easy to share sessions across multiple gRPC clients. |
| 74 | + You can use an empty string if you want to always initialize a new session on the server. |
| 75 | + To attach to an existing session, you must specify the session name it was initialized with. |
| 76 | + |
| 77 | + |
| 78 | + |
| 79 | + :type session_name: str |
| 80 | + |
| 81 | + |
| 82 | + :param initialization_behavior: |
| 83 | + |
| 84 | + |
| 85 | + 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. |
| 86 | + |
| 87 | + The driver session exists on the NI gRPC Device Server. |
| 88 | + |
| 89 | + |
| 90 | + |
| 91 | + :type initialization_behavior: :py:data:`nirfsg.SessionInitializationBehavior` |
0 commit comments