Class DspsrApplicationManager

Inheritance Relationships

Base Type

Derived Types

Class Documentation

class DspsrApplicationManager : public ska::pst::common::ApplicationManager

An ApplicationManager Adapter for DSPSR based applications.

All perform_* commands are forwarded to a stateless DspsrPipeline instance.

Subclassed by ska::pst::dsp::DetectedFilterbankManager, ska::pst::dsp::FlowThroughManager

Public Functions

DspsrApplicationManager(const std::string &entity, bool initialize_self = true)

Construct a new DspsrApplicationManager object, initialising the State to Unknown.

During the execution of DspsrApplicationManager constructor, it can only call it’s own perform_initialise method because the pointers to the overrides of any derived classes are not yet set in the vtable. This is not the desired behaviour if the derived class overrides the perform_initialize virtual method. Therefore, if the derived class overrides perform_initialize, it should pass initialize_self=false and call the initialise() method in its own constructor.

Parameters
  • entity – name of the entity for logging context

  • initialize_self – if true, the constructor will call initialise()

~DspsrApplicationManager()

Destroy the DspsrApplicationManager object.

void configure_from_file(const std::string &config_file)

Configure beam and scan as described by the configuration file.

Parameters

config_file – configuration file containing beam and scan configuration parameters

const ::dsp::Pipeline *get_dspsr_pipeline() const

Return the pointer to the DSPSR pipeline.

const ::dsp::ASCIIObservation *get_info() const

Return the ASCIIObservation that describes the current scan.

dspsr_monitoring_stats_t get_current_stats()

Get the current stats object.

Returns

the current DSPSR pipeline monitoring stats or an empty struct if the pipeline is currently not being monitor (e.g. pipeline has not be constructed or it is not currently running).

inline bool can_monitor_pipeline() const

Return true if the pipeline can be monitored.

inline void set_timeout(int timeout_secs)

Set the timeout to use during connection to DataBlocks.

Parameters

timeout_secs – timeout to wait in seconds during DataBlock connections.

inline bool is_pipeline_running() const

check if DSPSR pipeline is running or not

Returns true if the DSPSR pipeline running.

inline void assign_cuda_device(int _device_id)

pass the cuda device id to the DSPSR pipeline

virtual void validate_configure_beam(const common::AsciiHeader &config, common::ValidationContext *context) override

Validates Beam configuration.

Validation errors should not be raised as exceptions but added to the validation context. The caller of the method can decide what to do with the validation errors.

Parameters
  • config – Beam configuration to validate

  • context – A validation context where errors should be added.

virtual void validate_configure_scan(const common::AsciiHeader &config, common::ValidationContext *context) override

Validates Scan configuration.

Validation errors should not be raised as exceptions but added to the validation context. The client of the method can decide what to do with the validation errors.

Parameters
  • config – Scan configuration to validate

  • context – A validation context where errors should be added.

virtual void validate_start_scan(const common::AsciiHeader &config) override

Validates the StartScan configuration.

Validation errors should not be raised as exceptions but added to the validation context. The caller of the method can decide what to do with the validation errors.

Parameters

config – StartScan configuration to validate

inline const std::vector<std::string> &get_required_beam_config_keys() const

List of mandatory beam config keys.

inline const std::vector<std::string> &get_required_scan_config_keys() const

List of mandatory scan config keys.

inline const std::vector<std::string> &get_required_startscan_config_keys() const

List of mandatory start scan config keys.

Protected Functions

virtual void perform_initialise() override

Initialisation callback to be implemented in the child class. The method should wait for the Unknown state and transition the state model to the Initialised.

virtual void perform_configure_beam() override

Beam configuration callback implemented in the child class taking actions needed for the Idle to BeamConfigured transition.

virtual void perform_configure_scan() override

Scan configuration callback implemented in the child class taking actions needed for the BeamConfigured to ScanConfigured transition.

virtual void perform_start_scan() override

Start Scan callback implemented in the child class taking actions needed for the StartingScan to Scanning transition.

virtual void perform_scan() override

Scan callback implemented in the child class that is executed in the scan_thread.

Note

This method is expected to block until the scan is complete.

virtual bool perform_scan_initialise()

This function is called within perform_scan while the scan mutex is locked.

Note

This method is performs additional initialization steps needed for scanning.

Returns

true if scanning should continue, false to abort the scan.

virtual void perform_stop_scan() override

StopScan callback implemented in the child class taking actions needed for the Scanning to ScanConfigured transition.

virtual void perform_abort_scan() override

Perform any necessary steps to abort a scan for the application manager.

virtual void perform_deconfigure_scan() override

Scan callback implemented in the child class taking actions needed for the ScanConfigured to BeamConfigured transition.

virtual void perform_deconfigure_beam() override

Scan callback implemented in the child class taking actions needed for the BeamConfigured to Idle transition.

inline virtual void perform_terminate() override

Terminate callback implemented in the child class taking actions needed for the Idle to Terminating transition.

void handle_dspsr_error(const Error &error)

handle a DSPSR/PSRCHIVE error in a standard way.

This will convert the Error into a std::runtime_error

Throws

std::runtime_error – the error message is the full error, including function stack, of the error

virtual void configure_dspsr_pipeline()

Configure a DSPSR signal processing pipeline.

void stop_or_abort_scan_work()

Internally, both abort and stop scan do the same thing.

Protected Attributes

std::shared_ptr<DspsrPipeline> pipeline = {nullptr}

DSPSR pipeline interface.

std::vector<std::string> required_beam_config_keys = {"DATA_KEY", "WEIGHTS_KEY"}

List of mandatory beam config keys.

std::vector<std::string> required_scan_config_keys = {"EB_ID"}

List of mandatory scan config keys.

std::vector<std::string> required_startscan_config_keys = {"SCAN_ID"}

List of mandatory start scan config keys.

std::string recording_base_path

base directory to where files will be written

std::unique_ptr<DspsrPipelineMonitor> pipeline_monitor = {nullptr}

the DSPSR pipeline monitor

std::string input_data_key = {""}

shared memory key for the input data DataBlock

std::string input_weights_key = {""}

shared memory key of the input weights DataBlock

Reference::To<::dsp::DADABuffer> input_data_block

input data DADABuffer shared memory object

Reference::To<::dsp::DADABuffer> input_weights_block

input weights DADABuffer shared memory object

std::unique_ptr<ska::pst::smrb::DataBlockView> input_data_viewer = {nullptr}

input data block used to sneak a peak at the next buffer

std::unique_ptr<ska::pst::smrb::DataBlockView> input_weights_viewer = {nullptr}

input weights block used to sneak a peak at the next buffer

ska::pst::common::AsciiHeader data_config

config provided on the data ring buffer

ska::pst::common::AsciiHeader weights_config

config provided on the weights ring buffer

ska::pst::common::AsciiHeader data_header

header provided on the data ring buffer

ska::pst::common::AsciiHeader weights_header

header provided on the weights ring buffer

int timeout = {120}

timeout, in seconds, to wait when attempting to connect to the DataBlockView object.

bool pipeline_running = {false}

indicator of if pipeline is running or not.

std::filesystem::path scan_path

sub directory for the active scan (eb_id / subsystem_id / scan_id)

std::recursive_mutex scan_mutex

recursive mutex to handle synchronisation issues between start / stop scan

int device_id = -1

The cuda device id.