Supervisor

org.eso.ias.supervisor.Supervisor
See theSupervisor companion object
class Supervisor extends InputsListener, InputSubscriber, OutputPublisher, AutoCloseable

A Supervisor is the container to run several DASUs into the same JVM.

The Supervisor blindly forward inputs to each DASU and sends the outpts to the BSDB without adding any other heuristic: things like updating validities when an input is not refreshed are not part of the Supervisor.

The Supervisor gets IASIOs from a InputSubscriber and publishes IASValues to the BSDB by means of a OutputPublisher. The Supervisor itself is the publisher and subscriber for the DASUs i.e. the Supervisor acts as a bridge:

  • IASIOs read from the BSDB are forwarded to the DASUs that need them as input: the Supervisor has its own subscriber to receive values from the BSDB that are then forwarded to each DASU for processing
  • values produced by the DASUs are forwarded to the BSDB: the DASUs publishes the output they produce to the supervisor that, in turn, forward each of them to its own publisher.

The same interfaces, InputSubscriber and OutputPublisher, are used by DASUs and Supervisors in this way a DASU can be easily tested directly connected to Kafka (for example) without the need to have it running into a Supervisor.

DASUs are built by invoking the dasufactory passed in the constructor: test can let the Supervisor run with their mockup implementation of a DASU.

If not defined, the constructor builds the HB producer, the output publisher and the command manager using the passed SimpleStringProducer. All those producers are those used in operatons i.e. sending data to the kafka servers. The constructor allows to override this implementation passing special producers, a feature useful for testing

Value parameters

cdbReader

the CDB reader to get the configuration of the DASU from the CDB

commandManagerOpt

the command manager

dasuFactory:

factory to build DASU

hbProducerOpt

the subscriber to send heartbeats

inputSubscriber

the subscriber to get events to be processed

kafkaBrokers

the string with kafka brokers

logLevelFromCommandLine

The log level from the command line; None if the parameter was not set in the command line

outputPublisherOpt

the publisher to send the output

stringProducerOpt

the string producer to push in kafka

supervisorIdentifier

the identifier of the Supervisor

Attributes

Companion
object
Graph
Supertypes
trait AutoCloseable
class Object
trait Matchable
class Any
Show all

Members list

Value members

Constructors

def this(supervisorIdentifier: Identifier, outputPublisher: OutputPublisher, inputSubscriber: InputSubscriber, hbProducer: HbProducer, commandManager: CommandManager, cdbReader: CdbReader, dasuFactory: (DasuDao, Identifier, OutputPublisher, InputSubscriber) => Dasu, logLevelFromCommandLine: Option[LogLevelDao])

Constructor that allows to override standard kafka producer with the passed in the parameters.

Constructor that allows to override standard kafka producer with the passed in the parameters.

This constructor is intended for testing purposes.

Value parameters

cdbReader

the CDB reader to get the configuration of the DASU from the CDB

dasuFactory:

factory to build DASU

hbProducer

the subscriber to send heartbeats

inputSubscriber

the subscriber getting events to be processed

logLevelFromCommandLine

The log level from the command line; None if the parameter was not set in the command line

outputPublisher

the publisher to send the output

supervisorIdentifier

the identifier of the Supervisor

Attributes

Returns

a new Supervisor

def this(supervisorIdentifier: Identifier, kafkaBrokers: String, inputSubscriber: InputSubscriber, cdbReader: CdbReader, dasuFactory: (DasuDao, Identifier, OutputPublisher, InputSubscriber) => Dasu, logLevelFromCommandLine: Option[LogLevelDao])

Factory method to build a Supervisor with kafka producers and consumers

Factory method to build a Supervisor with kafka producers and consumers

This methods builds the Supervisor used in operation and connected with Kafka server.

Value parameters

cdbReader

the CDB reader to get the configuration of the DASU from the CDB

dasuFactory:

factory to build DASU

inputSubscriber

the subscriber to get events to be processed

kafkaBrokers

the string with kafka brokers

logLevelFromCommandLine

The log level from the command line; None if the parameter was not set in the command line

supervisorIdentifier

the identifier of the Supervisor

Attributes

Returns

a new Supervisor

Concrete methods

def cleanUpPublisher(): Try[Unit]

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher. The clean up will be done by by the supervisor on its own publisher so this method, invoked by each DASU, does nothing and always return success.

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher. The clean up will be done by by the supervisor on its own publisher so this method, invoked by each DASU, does nothing and always return success.

Attributes

Returns

Success or Failure if the clean up went well or encountered a problem

def cleanUpSubscriber(): Try[Unit]

The Supervisor has its own subscriber so this clean up invoked by each DASU, does nothing but returning Success.

The Supervisor has its own subscriber so this clean up invoked by each DASU, does nothing but returning Success.

Attributes

def close(): Unit

Release all the resources

Release all the resources

Attributes

def enableAutoRefreshOfOutput(enable: Boolean): Unit

Enable or diable the auto-refresh of the outputs in the DASUs

Enable or diable the auto-refresh of the outputs in the DASUs

Value parameters

enable

if true enable the autorefresh, otherwise disable the autorefresh

Attributes

def initializePublisher(): Try[Unit]

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher. The initialization has already been made by the supervisor so this method, invoke by each DASU, does nothing and always return success.

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher. The initialization has already been made by the supervisor so this method, invoke by each DASU, does nothing and always return success.

Attributes

Returns

Success or Failure if the initialization went well or encountered a problem

def initializeSubscriber(): Try[Unit]

The Supervisor has its own subscriber so this initialization, invoked by each DASU, does nothing but returning Success.

The Supervisor has its own subscriber so this initialization, invoked by each DASU, does nothing but returning Success.

Attributes

override def inputsReceived(iasios: Iterable[IASValue[_]]): Unit

Notify the DASUs of new inputs received from the consumer

Notify the DASUs of new inputs received from the consumer

Value parameters

iasios

the inputs received

Attributes

Definition Classes
def publish(iasio: IASValue[_]): Try[Unit]

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher.

The Supervisor acts as publisher for the DASU by forwarding IASIOs to its own publisher.

Value parameters

iasio

the not IASIO to publish

Attributes

Returns

a try to let the caller aware of errors publishing

def start(): Try[Unit]

Start the loop:

Start the loop:

  • get events from the BSDB
  • forward events to the DASUs

Attributes

Returns

Success if the there were no errors starting the supervisor, Failure otherwise

def startSubscriber(listener: InputsListener, acceptedInputs: Set[String]): Try[Unit]

The Supervisor has its own subscriber to get events from: the list of IDs to be accepted is composed of the IDs accepted by each DASUs.

The Supervisor has its own subscriber to get events from: the list of IDs to be accepted is composed of the IDs accepted by each DASUs.

Each DASU calls this method when ready to accept IASIOs; the Supervisor

  • uses the passedInputs to tune its list of accepted IDs.
  • uses the passed listener to forward to each DAUS the IASIOs it receives

Value parameters

acceptedInputs

the IDs of the inputs accepted by the listener

listener

the listener of events

Attributes

Concrete fields

val cleanedUp: AtomicBoolean

The command executor that executes the commands received from the cmd topic

The command executor that executes the commands received from the cmd topic

Attributes

val commandManager: CommandManager

The command manager to get and execute commands

The command manager to get and execute commands

Attributes

val dasuDaos: Set[DasuDao]
val dasuIds: Set[String]

The IDs of the DASUs instantiated in the Supervisor

The IDs of the DASUs instantiated in the Supervisor

Attributes

val dasus: Map[String, Dasu]
val dasusToDeploy: Set[DasuToDeployDao]

Gets the definitions of the DASUs to run in the Supervisor from the CDB

Gets the definitions of the DASUs to run in the Supervisor from the CDB

Attributes

The heartbeat Engine

The heartbeat Engine

Attributes

val iasDao: IasDao
val iasiosToDasusMap: Map[String, Set[String]]

Associate each DASU with the Set of inputs it needs.

Associate each DASU with the Set of inputs it needs.

the key is the ID of the DASU, the value is the set of inputs to send to the DASU

Attributes

val id: String

The ID of the Supervisor

The ID of the Supervisor

Attributes

val refreshRate: Long

The refresh rate in mseconds

The refresh rate in mseconds

The refresh rate is used only to detetct if the Supervisor is too slow processing values. Auto refresh is, in fact, implemented by DASUs

Attributes

val shutDownThread: Thread
val started: AtomicBoolean

Flag to know if the Supervisor has been started

Flag to know if the Supervisor has been started

Attributes

val supervDao: SupervisorDao
lazy val tfIDs: List[String]