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

ni_measurementlink_service.session_management._client

Session management client class.

Module Contents

Classes

SessionManagementClient

Client for accessing the MeasurementLink session management service.

class ni_measurementlink_service.session_management._client.SessionManagementClient(*, discovery_client=None, grpc_channel=None, grpc_channel_pool=None)[source]

Bases: object

Client for accessing the MeasurementLink session management service.

Parameters:
  • discovery_client (Optional[ni_measurementlink_service.discovery.DiscoveryClient]) –

  • grpc_channel (Optional[grpc.Channel]) –

  • grpc_channel_pool (Optional[ni_measurementlink_service.grpc.channelpool.GrpcChannelPool]) –

reserve_session(context, pin_or_relay_names=None, instrument_type_id=None, timeout=0.0)[source]

Reserve a single session.

Reserve the session matching the given pins, sites, and instrument type ID and return the information needed to create or access the session.

Parameters:
  • context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the Pin Map Service, as well as the list of sites for the measurement.

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

    One or multiple pins, pin groups, relays, or relay groups to use for the measurement.

    If unspecified, reserve sessions for all pins and relays in the registered pin map resource.

  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, this method reserve sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

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

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the session and unreserve it.

Return type:

ni_measurementlink_service.session_management._reservation.SingleSessionReservation

reserve_sessions(context, pin_or_relay_names=None, instrument_type_id=None, timeout=0.0)[source]

Reserve multiple sessions.

Reserve sessions matching the given pins, sites, and instrument type ID and return the information needed to create or access the sessions.

Parameters:
  • context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the Pin Map Service, as well as the list of sites for the measurement.

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

    One or multiple pins, pin groups, relays, or relay groups to use for the measurement.

    If unspecified, reserve sessions for all pins and relays in the registered pin map resource.

  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, this method reserves sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

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

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the sessions and unreserve them.

Return type:

ni_measurementlink_service.session_management._reservation.MultiSessionReservation

register_sessions(session_info)[source]

Register sessions with the session management service.

Indicates that the sessions are open and will need to be closed later.

Parameters:

session_info (Iterable[ni_measurementlink_service.session_management._types.SessionInformation]) – Sessions to register.

Return type:

None

unregister_sessions(session_info)[source]

Unregisters sessions from the session management service.

Indicates that the sessions have been closed and will need to be reopened before they can be used again.

Parameters:

session_info (Iterable[ni_measurementlink_service.session_management._types.SessionInformation]) – Sessions to unregister.

Return type:

None

reserve_all_registered_sessions(instrument_type_id=None, timeout=0.0)[source]

Reserve all sessions currently registered with the session management service.

Parameters:
  • instrument_type_id (Optional[str]) –

    Instrument type ID for the measurement.

    If unspecified, reserve sessions for all instrument types connected in the registered pin map resource.

    For NI instruments, use instrument type id constants, such as INSTRUMENT_TYPE_NI_DCPOWER or INSTRUMENT_TYPE_NI_DMM.

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

  • timeout (Optional[float]) –

    Timeout in seconds.

    Allowed values: 0 (non-blocking, fails immediately if resources cannot be reserved), -1 (infinite timeout), or any other positive numeric value (wait for that number of seconds)

Returns:

A reservation object with which you can query information about the sessions and unreserve them.

Return type:

ni_measurementlink_service.session_management._reservation.MultiSessionReservation

register_multiplexer_sessions(multiplexer_session_info)[source]

Register multiplexer sessions with the session management service.

Indicates that the sessions are open and will need to be closed later.

Parameters:

multiplexer_session_info (Iterable[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]) – Sessions to register.

Return type:

None

unregister_multiplexer_sessions(multiplexer_session_info)[source]

Unregisters multiplexer sessions from the session management service.

Indicates that the sessions have been closed and will need to be reopened before they can be used again.

Parameters:

multiplexer_session_info (Iterable[ni_measurementlink_service.session_management._types.MultiplexerSessionInformation]) – Sessions to unregister.

Return type:

None

get_multiplexer_sessions(pin_map_context, multiplexer_type_id=None)[source]

Get all multiplexer session infos matching the specified criteria.

Returns the information needed to create or access the multiplexer sessions without reserving the connected instruments.

Parameters:
  • pin_map_context (ni_measurementlink_service.session_management._types.PinMapContext) – Includes the pin map ID for the pin map in the pin map service, as well as the list of sites for the measurement.

  • 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:

The multiplexer session container with the matching session infos.

Return type:

ni_measurementlink_service.session_management._reservation.MultiplexerSessionContainer

get_all_registered_multiplexer_sessions(multiplexer_type_id=None)[source]

Get all multiplexer session infos registered with the session management service.

Parameters:

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:

The multiplexer session container with the matching session infos registered with the session management service.

Return type:

ni_measurementlink_service.session_management._reservation.MultiplexerSessionContainer


© Copyright 2024, National Instruments. Revision 2ba12c60.

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