Class AbstractBenchmarkController

All Implemented Interfaces:
Closeable, AutoCloseable, CommandReceivingComponent, Component, PlatformConnector

public abstract class AbstractBenchmarkController extends AbstractPlatformConnectorComponent
This abstract class implements basic methods for a benchmark controller.
Author:
Michael Röder (roeder@informatik.uni-leipzig.de)
  • Field Details

    • LOGGER

      private static final org.slf4j.Logger LOGGER
    • DEFAULT_EVAL_STORAGE_IMAGE

      protected static final String DEFAULT_EVAL_STORAGE_IMAGE
      See Also:
    • DEFAULT_EVAL_STORAGE_PARAMETERS

      protected static final String[] DEFAULT_EVAL_STORAGE_PARAMETERS
    • resultModel

      protected org.apache.jena.rdf.model.Model resultModel
      The benchmark result as RDF model received from the evaluation module.
    • resultModelMutex

      protected Semaphore resultModelMutex
      The benchmark result as RDF model received from the evaluation module.
    • startBenchmarkMutex

      protected Semaphore startBenchmarkMutex
      Mutex used to wait for the start signal from the controller.
    • dataGenReadyMutex

      protected Semaphore dataGenReadyMutex
      Mutex used to wait for the data generators to be ready.
    • taskGenReadyMutex

      protected Semaphore taskGenReadyMutex
      Mutex used to wait for the task generators to be ready.
    • evalStoreReadyMutex

      protected Semaphore evalStoreReadyMutex
      Mutex used to wait for the evaluation storage to be ready.
    • benchmarkStartSignalMutex

      protected Semaphore benchmarkStartSignalMutex
      Mutex used to wait for the start signal for this benchmark.
    • dataGenTerminatedMutex

      protected Semaphore dataGenTerminatedMutex
      Mutex used to wait for the data generators to terminate.
    • taskGenTerminatedMutex

      protected Semaphore taskGenTerminatedMutex
      Mutex used to wait for the task generators to terminate.
    • systemTerminatedMutex

      protected Semaphore systemTerminatedMutex
      Mutex used to wait for the benchmarked system to terminate.
    • evalStoreTerminatedMutex

      protected Semaphore evalStoreTerminatedMutex
      Mutex used to wait for the evaluation storage to terminate.
    • evalModuleTerminatedMutex

      protected Semaphore evalModuleTerminatedMutex
      Mutex used to wait for the evaluation module to terminate.
    • dataGenContainerIds

      protected Set<String> dataGenContainerIds
      The set of data generator container ids.
    • taskGenContainerIds

      protected Set<String> taskGenContainerIds
      The set of task generator container ids.
    • evalStoreContainerId

      protected String evalStoreContainerId
      The container id of the evaluation storage.
    • evalModuleContainerId

      protected String evalModuleContainerId
      The container id of the evaluation module.
    • systemContainerId

      protected String systemContainerId
      The container id of the benchmarked system.
    • systemExitCode

      protected int systemExitCode
      The exit code of the system container
    • benchmarkParamModel

      protected org.apache.jena.rdf.model.Model benchmarkParamModel
      The RDF model containing the benchmark parameters.
    • experimentUri

      protected String experimentUri
      The URI of the experiment.
  • Constructor Details

    • AbstractBenchmarkController

      public AbstractBenchmarkController()
      Constructor.
  • Method Details

    • init

      public void init() throws Exception
      Description copied from interface: Component
      This method initializes the component.
      Specified by:
      init in interface Component
      Overrides:
      init in class AbstractCommandReceivingComponent
      Throws:
      Exception - if an error occurs during the initialization
    • run

      public void run() throws Exception
      Description copied from interface: Component
      This method executes the component.
      Throws:
      Exception - if an error occurs during the execution
    • executeBenchmark

      protected abstract void executeBenchmark() throws Exception
      Throws:
      Exception
    • createDataGenerators

      protected void createDataGenerators(String dataGeneratorImageName, int numberOfDataGenerators, String[] envVariables)
      Creates the given number of data generators using the given image name and environment variables.
      Parameters:
      dataGeneratorImageName - name of the data generator Docker image
      numberOfDataGenerators - number of generators that should be created
      envVariables - environment variables for the data generators
    • createTaskGenerators

      protected void createTaskGenerators(String taskGeneratorImageName, int numberOfTaskGenerators, String[] envVariables)
      Creates the given number of task generators using the given image name and environment variables.
      Parameters:
      taskGeneratorImageName - name of the task generator Docker image
      numberOfTaskGenerators - number of generators that should be created
      envVariables - environment variables for the task generators
    • createGenerator

      private void createGenerator(String generatorImageName, int numberOfGenerators, String[] envVariables, Set<String> generatorIds)
      Internal method for creating generator components.
      Parameters:
      generatorImageName - name of the generator Docker image
      numberOfGenerators - number of generators that should be created
      envVariables - environment variables for the task generators
      generatorIds - set of generator container names
    • createEvaluationModule

      protected void createEvaluationModule(String evalModuleImageName, String[] envVariables)
      Creates the evaluate module using the given image name and environment variables.
      Parameters:
      evalModuleImageName - name of the evaluation module image
      envVariables - environment variables that should be given to the module
    • createEvaluationStorage

      protected void createEvaluationStorage()
      Creates the default evaluation storage using the given image name and environment variables.
    • createEvaluationStorage

      protected void createEvaluationStorage(String evalStorageImageName, String[] envVariables)
      Creates the evaluate storage using the given image name and environment variables.
      Parameters:
      evalStorageImageName - name of the evaluation storage image
      envVariables - environment variables that should be given to the component
    • waitForComponentsToInitialize

      protected void waitForComponentsToInitialize()
      This method waits for the data generators, task generators and evaluation storage to send their ready signals.
    • waitForDataGenToFinish

      protected void waitForDataGenToFinish()
      Waits for the termination of all data generators.
    • waitForTaskGenToFinish

      protected void waitForTaskGenToFinish()
      Waits for the termination of all task generators.
    • waitForSystemToFinish

      protected boolean waitForSystemToFinish(long maxWaitingTime)
      This method waits for the benchmarked system to terminate or times out after the given amount of time (in milliseconds).
      Parameters:
      maxWaitingTime - maximum waiting time in milliseconds
      Returns:
      true if the system has been terminated or false if the method timed out
    • waitForSystemToFinish

      protected void waitForSystemToFinish()
      This method waits for the benchmarked system to terminate.
    • waitForEvalComponentsToFinish

      protected void waitForEvalComponentsToFinish()
      Waits for the termination of the evaluation module and the evaluation storage.
    • setResultModel

      protected void setResultModel(org.apache.jena.rdf.model.Model resultModel)
      Uses the given model as result model if the result model is null. Else, the two models are merged.
      Parameters:
      resultModel - the new result model
    • generateErrorResultModel

      protected void generateErrorResultModel()
      Generates a default model containing an error code and the benchmark parameters if no result model has been received from the evaluation module until now. If the model already has been received, the error is added to the existing model.
    • addParametersToResultModel

      protected void addParametersToResultModel()
      Adds the benchmarkParamModel triples to the resultModel .
    • sendResultModel

      protected void sendResultModel(org.apache.jena.rdf.model.Model model)
      Sends the result RDF model to the platform controller.
      Parameters:
      model - model containing the results
    • receiveCommand

      public void receiveCommand(byte command, byte[] data)
      Description copied from interface: CommandReceivingComponent
      This method is called if a command is received and might be interesting for this particular component.
      Specified by:
      receiveCommand in interface CommandReceivingComponent
      Overrides:
      receiveCommand in class AbstractPlatformConnectorComponent
      Parameters:
      command - the byte encoding the command
      data - additional data that was sent together with the command
    • containerTerminated

      protected void containerTerminated(String containerName, int exitCode)
      This method handles messages from the command bus containing the information that a container terminated. It checks whether the container belongs to the current benchmark and whether it has to react.
      Parameters:
      containerName - the name of the terminated container
      exitCode - the exit code of the terminated container
    • containerCrashed

      protected void containerCrashed(String containerName)