BaseLabJackDataClient#

class lsst.ts.ess.labjack.BaseLabJackDataClient(config, topics, log, simulation_mode=0)#

Bases: BaseReadLoopDataClient, ABC

Base class for ESS data clients that read a LabJack T7 or similar.

Parameters:
  • name (str)

  • config (types.SimpleNamespace) – The configuration, after validation by the schema returned by get_config_schema and conversion to a types.SimpleNamespace.

  • topics (salobj.Controller) – The telemetry topics this model can write, as a struct with attributes such as tel_temperature.

  • log (logging.Logger) – Logger.

  • simulation_mode (int, optional) – Simulation mode; 0 for normal operation.

Notes

In simulation mode the mock LabJack returns unspecified values, and those values may change in future versions of the LabJack software.

Attributes Summary

Methods Summary

connect()

Connect to the LabJack.

descr()

Return a brief description, without the class name.

disconnect()

Disconnect from the LabJack.

run_in_thread(func, timeout)

Run a blocking function in a thread pool executor.

start()

Start the run task.

stop()

Stop reading and publishing data.

Attributes Documentation

connected#

Methods Documentation

async connect()#

Connect to the LabJack.

Disconnect first, if connected.

Raises:

RuntimeError – If we cannot read the data.

Return type:

None

descr()#

Return a brief description, without the class name.

This should be just enough information to distinguish one instance of this client from another.

Return type:

str

async disconnect()#

Disconnect from the LabJack. A no-op if disconnected.

Return type:

None

async run_in_thread(func, timeout)#

Run a blocking function in a thread pool executor.

Only one function will run at a time, because all calls use the same thread pool executor, which only has a single thread.

Parameters:
  • func (Callable) – The blocking function to run; The function must take no arguments. For example: self._blocking_connect.

  • timeout (float) – Time limit (seconds).

Return type:

Any

async start()#

Start the run task.

Return type:

None

async stop()#

Stop reading and publishing data.

This is alway safe to call, whether connected or not. This should raise no exceptions except asyncio.CancelledError. If disconnect raises, this logs the exception and continues.

Return type:

None