ni_measurementlink_service
releases/1.4
  • API Reference
ni_measurementlink_service
  • ni_measurementlink_service.session_management._reservation
  • Edit on GitHub

ni_measurementlink_service.session_management._reservation

Session management reservation classes.

Module Contents

Classes

MultiplexerSessionContainer

Manages multiplexer session information.

BaseReservation

Manages session reservation.

SingleSessionReservation

Manages reservation for a single session.

MultiSessionReservation

Manages reservation for multiple sessions.

class ni_measurementlink_service.session_management._reservation.MultiplexerSessionContainer(session_management_client, multiplexer_session_info)[source]

Bases: _BaseSessionContainer

Manages multiplexer session information.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

property multiplexer_session_info: Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

Multiplexer session information object.

Return type:

Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

__enter__()[source]

Context management protocol. Returns self.

Return type:

Self

__exit__(exc_type, exc_val, traceback)[source]

Context management protocol.

Parameters:
  • exc_type (Optional[Type[BaseException]]) –

  • exc_val (Optional[BaseException]) –

  • traceback (Optional[types.TracebackType]) –

Return type:

None

initialize_multiplexer_session(session_constructor, multiplexer_type_id=None)[source]

Initialize a single multiplexer session.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a multiplexer session information

object. The session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_multiplexer_sessions(session_constructor, multiplexer_type_id=None)[source]

Initialize multiple multiplexer sessions.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session information

objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]]

initialize_niswitch_multiplexer_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize a single NI-SWITCH multiplexer session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_MULTIPLEXER_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a session information object. The

multiplexer session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_multiplexer_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize multiple NI-SWITCH multiplexer sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_MULTIPLEXER_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session

information objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

class ni_measurementlink_service.session_management._reservation.BaseReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: _BaseSessionContainer

Manages session reservation.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property multiplexer_session_info: Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

Multiplexer session information object.

Return type:

Sequence[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]

__enter__()[source]

Context management protocol. Returns self.

Return type:

Self

__exit__(exc_type, exc_val, traceback)[source]

Context management protocol. Calls unreserve().

Parameters:
  • exc_type (Optional[Type[BaseException]]) –

  • exc_val (Optional[BaseException]) –

  • traceback (Optional[types.TracebackType]) –

Return type:

Literal[False]

unreserve()[source]

Unreserve sessions.

Return type:

None

initialize_session(session_constructor, instrument_type_id)[source]

Initialize a single instrument session.

This is a generic method that supports any instrument driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.SessionInformation], ni_measurementlink_service.session_management._types.TSession]) – A function that constructs sessions based on session information.

  • instrument_type_id (str) –

    Instrument type ID for the session.

    For custom instruments, use the instrument type id defined in the pin map file.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If the instrument type ID is empty, no reserved sessions match the instrument type ID, or too many reserved sessions match the instrument type ID.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[ni_measurementlink_service.session_management._types.TSession]]

initialize_multiplexer_session(session_constructor, multiplexer_type_id=None)[source]

Initialize a single multiplexer session.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a multiplexer session information

object. The session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_sessions(session_constructor, instrument_type_id)[source]

Initialize multiple instrument sessions.

This is a generic method that supports any instrument driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.SessionInformation], ni_measurementlink_service.session_management._types.TSession]) – A function that constructs sessions based on session information.

  • instrument_type_id (str) –

    Instrument type ID for the session.

    For custom instruments, use the instrument type id defined in the pin map file.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If the instrument type ID is empty or no reserved sessions matched the instrument type ID.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[ni_measurementlink_service.session_management._types.TSession]]]

initialize_multiplexer_sessions(session_constructor, multiplexer_type_id=None)[source]

Initialize multiple multiplexer sessions.

This is a generic method that supports any multiplexer driver.

Parameters:
  • session_constructor (Callable[[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation], ni_measurementlink_service.session_management._types.TMultiplexerSession]) – A function that constructs multiplexer sessions based on multiplexer session information.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session information

objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[ni_measurementlink_service.session_management._types.TMultiplexerSession]]]

get_connection(session_type, pin_or_relay_name=None, site=None, instrument_type_id=None)[source]

Get the connection matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The session type.

  • pin_or_relay_name (Optional[str]) – The pin or relay name to match against. If not specified, the pin or relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[ni_measurementlink_service.session_management._types.TSession]

get_connection_with_multiplexer(session_type, multiplexer_session_type, pin_or_relay_name=None, site=None, instrument_type_id=None)[source]

Get the connection matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The instrument session type.

  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_or_relay_name (Optional[str]) – The pin or relay name to match against. If not specified, the pin or relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[ni_measurementlink_service.session_management._types.TSession, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_connections(session_type, pin_or_relay_names=None, sites=None, instrument_type_id=None)[source]

Get all connections matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The expected session type.

  • pin_or_relay_names (Union[str, Iterable[str], None]) – The pin or relay name(s) to match against. If not specified, the pin or relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[ni_measurementlink_service.session_management._types.TSession]]

get_connections_with_multiplexer(session_type, multiplexer_session_type, pin_or_relay_names=None, sites=None, instrument_type_id=None)[source]

Get all connections matching the specified criteria.

This is a generic method that supports any instrument driver.

Parameters:
  • session_type (Type[ni_measurementlink_service.session_management._types.TSession]) – The instrument session type.

  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_or_relay_names (Union[str, Iterable[str], None]) – The pin or relay name(s) to match against. If not specified, the pin or relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

  • instrument_type_id (Optional[str]) – The instrument type ID to match against. If not specified, the instrument type ID is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[ni_measurementlink_service.session_management._types.TSession, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

create_nidaqmx_task(initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Create a single NI-DAQmx task.

Parameters:

initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will create a new task or attach to an existing task.

Returns:

A context manager that yields a session information object. The task object is available via the session field.

Raises:

ValueError – If no NI-DAQmx tasks are reserved or too many NI-DAQmx tasks are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidaqmx.Task]]

Note

If the session_exists field is False, the returned task is empty and the caller is expected to add channels to it.

See also

For more details, see nidaqmx.Task.

create_nidaqmx_tasks(initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Create multiple NI-DAQmx tasks.

Parameters:

initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will create a new task or attach to an existing task.

Returns:

A context manager that yields a sequence of session information objects. The task objects are available via the session field.

Raises:

ValueError – If no NI-DAQmx tasks are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidaqmx.Task]]]

Note

If the session_exists field is False, the returned tasks are empty and the caller is expected to add channels to them.

See also

For more details, see nidaqmx.Task.

get_nidaqmx_connection(pin_name=None, site=None)[source]

Get the NI-DAQmx connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidaqmx.Task]

get_nidaqmx_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DAQmx connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidaqmx.Task, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidaqmx_connections(pin_names=None, sites=None)[source]

Get all NI-DAQmx connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidaqmx.Task]]

get_nidaqmx_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DAQmx connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidaqmx.Task, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidcpower_session(reset=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-DCPower instrument session.

Parameters:
  • reset (bool) – Specifies whether to reset channel(s) during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDCPOWER_SIMULATE, NIDCPOWER_BOARD_TYPE, and NIDCPOWER_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-DCPower sessions are reserved or too many NI-DCPower sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidcpower.Session]]

See also

For more details, see nidcpower.Session.

initialize_nidcpower_sessions(reset=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-DCPower instrument sessions.

Parameters:
  • reset (bool) – Specifies whether to reset channel(s) during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDCPOWER_SIMULATE, NIDCPOWER_BOARD_TYPE, and NIDCPOWER_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-DCPower sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidcpower.Session]]]

See also

For more details, see nidcpower.Session.

get_nidcpower_connection(pin_name=None, site=None)[source]

Get the NI-DCPower connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidcpower.Session]

get_nidcpower_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DCPower connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidcpower.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidcpower_connections(pin_names=None, sites=None)[source]

Get all NI-DCPower connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidcpower.Session]]

get_nidcpower_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DCPower connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidcpower.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidigital_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-Digital Pattern instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDIGITAL_SIMULATE, NIDIGITAL_BOARD_TYPE, and NIDIGITAL_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-Digital sessions are reserved or too many NI-Digital sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidigital.Session]]

See also

For more details, see nidigital.Session.

initialize_nidigital_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-Digital Pattern instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDIGITAL_SIMULATE, NIDIGITAL_BOARD_TYPE, and NIDIGITAL_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-Digital sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidigital.Session]]]

See also

For more details, see nidigital.Session.

get_nidigital_connection(pin_name=None, site=None)[source]

Get the NI-Digital Pattern connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidigital.Session]

get_nidigital_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-Digital Pattern connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidigital.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidigital_connections(pin_names=None, sites=None)[source]

Get all NI-Digital Pattern connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidigital.Session]]

get_nidigital_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-Digital Pattern connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidigital.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nidmm_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-DMM instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDMM_SIMULATE, NIDMM_BOARD_TYPE, and NIDMM_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-DMM sessions are reserved or too many NI-DMM sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidmm.Session]]

See also

For more details, see nidmm.Session.

initialize_nidmm_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-DMM instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIDMM_SIMULATE, NIDMM_BOARD_TYPE, and NIDMM_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-DMM sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nidmm.Session]]]

See also

For more details, see nidmm.Session.

get_nidmm_connection(pin_name=None, site=None)[source]

Get the NI-DMM connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nidmm.Session]

get_nidmm_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-DMM connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidmm.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nidmm_connections(pin_names=None, sites=None)[source]

Get all NI-DMM connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nidmm.Session]]

get_nidmm_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-DMM connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nidmm.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_nifgen_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-FGEN instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIFGEN_SIMULATE, NIFGEN_BOARD_TYPE, and NIFGEN_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-FGEN sessions are reserved or too many NI-FGEN sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[nifgen.Session]]

See also

For more details, see nifgen.Session.

initialize_nifgen_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-FGEN instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NIFGEN_SIMULATE, NIFGEN_BOARD_TYPE, and NIFGEN_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-FGEN sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[nifgen.Session]]]

See also

For more details, see nifgen.Session.

get_nifgen_connection(pin_name=None, site=None)[source]

Get the NI-FGEN connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[nifgen.Session]

get_nifgen_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-FGEN connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nifgen.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_nifgen_connections(pin_names=None, sites=None)[source]

Get all NI-FGEN connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[nifgen.Session]]

get_nifgen_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-FGEN connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[nifgen.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_niscope_session(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-SCOPE instrument session.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NISCOPE_SIMULATE, NISCOPE_BOARD_TYPE, and NISCOPE_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no NI-SCOPE sessions are reserved or too many NI-SCOPE sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[niscope.Session]]

See also

For more details, see niscope.Session.

initialize_niscope_sessions(reset_device=False, options=None, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-SCOPE instrument sessions.

Parameters:
  • reset_device (bool) – Specifies whether to reset the instrument during the initialization procedure.

  • options (Optional[Dict[str, Any]]) – Specifies the initial value of certain properties for the session. If this argument is not specified, the default value is an empty dict, which you may override by specifying NISCOPE_SIMULATE, NISCOPE_BOARD_TYPE, and NISCOPE_MODEL in the configuration file (.env).

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no NI-SCOPE sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[niscope.Session]]]

See also

For more details, see niscope.Session.

get_niscope_connection(pin_name=None, site=None)[source]

Get the NI-SCOPE connection matching the specified criteria.

Parameters:
  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[niscope.Session]

get_niscope_connection_with_multiplexer(multiplexer_session_type, pin_name=None, site=None)[source]

Get the NI-SCOPE connection matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_name (Optional[str]) – The pin name to match against. If not specified, the pin name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection along with its multiplexer info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[niscope.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]

get_niscope_connections(pin_names=None, sites=None)[source]

Get all NI-SCOPE connections matching the specified criteria.

Parameters:
  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[niscope.Session]]

get_niscope_connections_with_multiplexer(multiplexer_session_type, pin_names=None, sites=None)[source]

Get all NI-SCOPE connections matching the specified criteria.

Parameters:
  • multiplexer_session_type (Type[ni_measurementlink_service.session_management._types.TMultiplexerSession]) – The multiplexer session type.

  • pin_names (Union[str, Iterable[str], None]) – The pin name(s) to match against. If not specified, the pin name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections along with their multiplexer(s) info.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnectionWithMultiplexer[niscope.Session, ni_measurementlink_service.session_management._types.TMultiplexerSession]]

initialize_niswitch_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize a single NI-SWITCH relay driver instrument session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a session information object. The session object is available via the session field.

Raises:

ValueError – If no relay driver sessions are reserved or too many relay driver sessions are reserved.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO)[source]

Initialize multiple NI-SWITCH relay driver instrument sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

Returns:

A context manager that yields a sequence of session information objects. The session objects are available via the session field.

Raises:

ValueError – If no relay driver sessions are reserved.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

get_niswitch_connection(relay_name=None, site=None)[source]

Get the NI-SWITCH relay driver connection matching the specified criteria.

Parameters:
  • relay_name (Optional[str]) – The relay name to match against. If not specified, the relay name is ignored when matching connections.

  • site (Optional[int]) – The site number to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connection.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match or too many reserved connections match.

Return type:

ni_measurementlink_service.session_management._types.TypedConnection[niswitch.Session]

get_niswitch_connections(relay_names=None, sites=None)[source]

Get all NI-SWITCH relay driver connections matching the specified criteria.

Parameters:
  • relay_names (Union[str, Iterable[str], None]) – The relay name(s) to match against. If not specified, the relay name is ignored when matching connections.

  • sites (Union[int, Iterable[int], None]) – The site number(s) to match against. If not specified, the site number is ignored when matching connections.

Returns:

The matching connections.

Raises:
  • TypeError – If the argument types or session type are incorrect.

  • ValueError – If no reserved connections match.

Return type:

Sequence[ni_measurementlink_service.session_management._types.TypedConnection[niswitch.Session]]

initialize_niswitch_multiplexer_session(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize a single NI-SWITCH multiplexer session.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a session information object. The

multiplexer session object is available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available or too many multiplexer sessions are available.

Return type:

ContextManager[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]

See also

For more details, see niswitch.Session.

initialize_niswitch_multiplexer_sessions(topology=None, simulate=None, reset_device=False, initialization_behavior=SessionInitializationBehavior.AUTO, multiplexer_type_id=None)[source]

Initialize multiple NI-SWITCH multiplexer sessions.

Parameters:
  • topology (Optional[str]) – Specifies the switch topology. If this argument is not specified, the default value is “Configured Topology”, which you may override by setting MEASUREMENTLINK_NISWITCH_TOPOLOGY in the configuration file (.env).

  • simulate (Optional[bool]) – Enables or disables simulation of the switch module. If this argument is not specified, the default value is False, which you may override by setting MEASUREMENTLINK_NISWITCH_SIMULATE in the configuration file (.env).

  • reset_device (bool) – Specifies whether to reset the switch module during the initialization procedure.

  • initialization_behavior (ni_measurementlink_service.session_management._types.SessionInitializationBehavior) – Specifies whether the NI gRPC Device Server will initialize a new session or attach to an existing session.

  • multiplexer_type_id (Optional[str]) – User-defined identifier for the multiplexer type in the pin map editor. If not specified, the multiplexer type id is ignored when matching multiplexer sessions.

Returns:

A context manager that yields a sequence of multiplexer session

information objects. The session objects are available via the session field.

Raises:
  • TypeError – If the argument types are incorrect.

  • ValueError – If no multiplexer sessions are available.

Return type:

ContextManager[Sequence[ni_measurementlink_service.session_management._types.TypedMultiplexerSessionInformation[niswitch.Session]]]

See also

For more details, see niswitch.Session.

class ni_measurementlink_service.session_management._reservation.SingleSessionReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: BaseReservation

Manages reservation for a single session.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property session_info: ni_measurementlink_service.session_management._types.SessionInformation

Single session information object.

Return type:

ni_measurementlink_service.session_management._types.SessionInformation

class ni_measurementlink_service.session_management._reservation.MultiSessionReservation(session_management_client, session_info, multiplexer_session_info=None, pin_or_relay_group_mappings=None, reserved_pin_or_relay_names=None, reserved_sites=None)[source]

Bases: BaseReservation

Manages reservation for multiple sessions.

Parameters:
  • session_management_client (ni_measurementlink_service.session_management._client.SessionManagementClient) –

  • session_info (Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.SessionInformation]) –

  • multiplexer_session_info (Optional[Sequence[ni_measurementlink_service._internal.stubs.ni.measurementlink.sessionmanagement.v1.session_management_service_pb2.MultiplexerSessionInformation]]) –

  • pin_or_relay_group_mappings (Optional[Mapping[str, Iterable[str]]]) –

  • reserved_pin_or_relay_names (Union[str, Iterable[str], None]) –

  • reserved_sites (Optional[Iterable[int]]) –

property session_info: List[ni_measurementlink_service.session_management._types.SessionInformation]

Multiple session information objects.

Return type:

List[ni_measurementlink_service.session_management._types.SessionInformation]


© Copyright 2024, National Instruments. Revision 2ba12c60.

Built with Sphinx using a theme provided by Read the Docs.