Daq Server

This module implements a gRPC DAQ server.

class ska_low_mccs_daq_interface.server.DaqServer(backend)

An implementation of a DaqServer.

BandpassMonitorStart(request, context)

Begin monitoring antenna bandpasses.

Parameters:
  • request (bandpassMonitorStartRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

Iterator[bandpassMonitorStartResponse]

BandpassMonitorStop(request, context)

Stop monitoring antenna bandpasses.

Parameters:
  • request (bandpassMonitorStopRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

ConfigureDaq(request, context)

Configure the DaqReceiver.

Applies the specified configuration to the DaqReceiver.

Parameters:
  • request (configDaqRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

DaqStatus(request, context)

Provide status information for this MccsDaqReceiver.

This method returns status as a json string with entries for; - Daq Health; [HealthState.name; str, HealthState.value; int] - Running Consumers; [DaqMode.name; str, DaqMode.value; int] - Receiver Interface; “Interface Name”; str - Receiver Ports; [Port_List]; list[int] - Receiver IP; “IP_Address”; str

Parameters:
  • request (daqStatusRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

daqStatusResponse

Returns:

A json string containing the status of this DaqReceiver.

DataRateMonitorStart(request, context)

Start monitoring the data rate over the receiver interface.

Parameters:
  • request (dataRateMonitorStartRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

DataRateMonitorStop(request, context)

Stop monitoring the data rate over the receiver interface.

Parameters:
  • request (dataRateMonitorStopRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

GetConfiguration(request, context)

Get the Configuration from DAQ.

Parameters:
  • request (getConfigRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

ConfigurationResponse

Returns:

A JSON-encoded dictionary of the configuration.

>>> dp.tango.DeviceProxy("low-mccs/daqreceiver/001")
>>> jstr = dp.command_inout("GetConfiguration")
>>> dict = json.loads(jstr)
GetDataRate(request, context)

Get the current data rate in Gb/s, or None if it is not being monitored.

Parameters:
  • request (getDataRateRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

getDataRateResponse

InitDaq(request, context)

Initialise a new DaqReceiver instance.

Parameters:
  • request (initDaqRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

Returns:

a commandResponse object containing result_code and message

StartDaq(request, context)

Start the DaqConsumers.

The MccsDaqReceiver will begin watching the interface specified in the configuration and will start the configured consumers.

Parameters:
  • request (startDaqRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Yield:

Responsed to be streamed, containing the call_state or call_info message indicating events posted by server. The message is for information purpose only.

Return type:

Iterator[startDaqResponse]

StopDaq(request, context)

Stop the DaqReceiver.

The DAQ receiver will cease watching the specified interface and will stop all running consumers.

Parameters:
  • request (stopDaqRequest) – the gRPC request

  • context (ServicerContext) – the gRPC servicer context

Return type:

commandResponse

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

class ska_low_mccs_daq_interface.server.DaqServerBackendProtocol(*args, **kwargs)

Protocol for a class that can act as a backend for this server.

configure(config)

Configure the DaqReceiver.

Applies the specified configuration to the DaqReceiver.

Parameters:

config (dict[str, Any]) – the configuration to apply

Return type:

tuple[ResultCode, str]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

get_configuration()

Get the Configuration from DAQ.

Return type:

dict[str, Any]

Returns:

A JSON-encoded dictionary of the configuration.

>>> dp.tango.DeviceProxy("low-mccs/daqreceiver/001")
>>> jstr = dp.command_inout("GetConfiguration")
>>> dict = json.loads(jstr)
get_data_rate()

Get the current data rate in Gb/s, or None if it is not being monitored.

Return type:

Optional[float]

Returns:

the current data rate in Gb/s, or None if it is not being monitored.

get_status()

Return station information for this DAQ instance.

This method returns status as a dictionary with entries for; - Daq Health; [HealthState.name; str, HealthState.value; int] - Running Consumers; [DaqMode.name; str, DaqMode.value; int] - Receiver Interface; “Interface Name”; str - Receiver Ports; [Port_List]; list[int] - Receiver IP; “IP_Address”; str

Return type:

dict[str, Any]

Returns:

A status dictionary.

initialise(config, libaavsdaq_filepath)

Initialise a new DaqReceiver instance.

Parameters:
  • config (dict[str, Any]) – the configuration to apply

  • libaavsdaq_filepath (str) – Filepath to a custom version of libaavsdaq.so

Return type:

tuple[ResultCode, str]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

start(modes_to_start)

Start the DaqConsumers.

The MccsDaqReceiver will begin watching the interface specified in the configuration and will start the configured consumers.

Parameters:

modes_to_start (str) – the DAQ modes to start

Return type:

Iterator[str | tuple[str, str, str]]

Returns:

A streamed response containing a the call_state or call_info message indicating events posted by server. The message is for information purpose only.

start_bandpass_monitor(argin)

Begin monitoring antenna bandpasses.

Parameters:

argin (str) – A json string with keywords - station_config_path Path to a station configuration file. - plot_directory Directory in which to store bandpass plots. - monitor_rms Whether or not to additionally produce RMS plots. Default: False. - auto_handle_daq Whether DAQ should be automatically reconfigured, started and stopped without user action if necessary. This set to False means we expect DAQ to already be properly configured and listening for traffic and DAQ will not be stopped when StopBandpassMonitor is called. Default: False.

Return type:

Iterator[tuple[TaskStatus, str, Optional[str], Optional[str], Optional[str]]]

Returns:

A streamed response containing bandpass plots.

start_measuring_data_rate(interval)

Start monitoring the data rate over the receiver interface.

Parameters:

interval (float) – The interval in seconds at which to measure the data rate.

Return type:

tuple[ResultCode, str]

Returns:

A result code and a message.

stop()

Stop the DaqReceiver.

The DAQ receiver will cease watching the specified interface and will stop all running consumers.

Return type:

tuple[ResultCode, str]

Returns:

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

stop_bandpass_monitor()

Cease monitoring antenna bandpasses.

Return type:

tuple[ResultCode, str]

stop_measuring_data_rate()

Stop monitoring the data rate over the receiver interface.

Return type:

tuple[ResultCode, str]

Returns:

A result code and a message.

ska_low_mccs_daq_interface.server.run_server_forever(backend, port)

Run the DAQ server until terminated.

Parameters:
  • backend (DaqServerBackendProtocol) – the backend for which this server provides an interface.

  • port (int) – the port on which to run the server. If set to 0, the server will be run on any available port. The actual port on which the server is running will be printed to stdout.

Return type:

None

ska_low_mccs_daq_interface.server.server_context(backend, port=50051)

Run the DAQ server in a context.

The server will be launched when the context is entered, and shut down when the context is exited.

Parameters:
  • backend (DaqServerBackendProtocol) – the backend for which this server provides an interface.

  • port (int) – the port on which to run the server. If set to 0, the server will be run on any available port. The actual port on which the server is running will be yielded as the context handle.

Yield:

the actual port on which the server is running.

Return type:

Iterator[int]