The command queue is used as a central message bus to orchestrate the single components.

Structure of a message

The structure of the message is described in the following table.

start byte length meaning
0 4 session id length as 32 bit integer (s)
4 s session id
s + 4 1 Command id as byte
s + 5   data (optional)

It can be seen that the first part of a message contains the session id of the benchmark to which the message belongs to (preceded by the session id length). After that, the id of the “command” follows as single byte. Some messages might have additional data that is simply added at the end of the message behind the command id.

API

The command queue uses a RabbitMQ Exchange. Connecting a component to this exchange can be done as described in the RabbitMQ Publish/Subscribe tutorial. The exchange itself has to be setup with:

  • name="hobbit.command"
  • type="fanout"
  • durable=false
  • autoDelete=true
  • and no additional arguments.

The queue that is bound to the exchange can have an autogenerated name. The queue can be used to send messages to the exchange. Additionally, a consumer should be bound to the queue to be able to receive messages from the exchange.

Predefined command ids

The platform uses already predefined command ids. They can be reused by benchmark and system implementations if they are interacting with the platform. The predefined commands can be found in https://github.com/hobbit-project/core/blob/master/src/main/java/org/hobbit/core/Commands.java

constant name id description
SYSTEM_READY_SIGNAL 1 The signal sent by the benchmarked system to indicate that the system is ready.
BENCHMARK_READY_SIGNAL 2 The signal sent by the benchmark controller to indicate that the benchmark is ready.
DATA_GENERATOR_READY_SIGNAL 3 The signal sent by the data generator to indicate that it is ready.
TASK_GENERATOR_READY_SIGNAL 4 The signal sent by the task generator to indicate that it is ready.
EVAL_STORAGE_READY_SIGNAL 5 The signal sent by the evaluation storage to indicate that it is ready.
EVAL_MODULE_READY_SIGNAL 6 The signal sent by the evaluation module to indicate that it is ready.
DATA_GENERATOR_START_SIGNAL 7 The signal sent by the benchmark controller to start the data generators.
TASK_GENERATOR_START_SIGNAL 8 The signal sent by the benchmark controller to start the task generators.
EVAL_MODULE_FINISHED_SIGNAL 9 The signal sent by the evaluation module to inform the benchmark controller that the evaluation is done. The message contains the evaluation results as additional data.
EVAL_STORAGE_TERMINATE 10 The signal that lets the evaluation storage terminate.
BENCHMARK_FINISHED_SIGNAL 11 The signal sent by the benchmark controller to the platform to indicate that the benchmark has been finished. It contains the evaluation result as RDF model.
DOCKER_CONTAINER_START 12 Command used to ask a docker managing component to start a certain container. The command is followed by a String containing the following JSON data: {<br>"image": "image-to-run",<br> "type": "system|benchmark",<br> "parent":"parent-container-id"<br>}
DOCKER_CONTAINER_STOP 13 Command used to ask a docker managing component to stop a certain container. The command is followed by a String containing the following JSON data: {<br>"containerId": "container-to-stop"<br>}
DATA_GENERATION_FINISHED 14 The signal sent by the benchmark controller to the system to indicate that all data has been generated.
TASK_GENERATION_FINISHED 15 The signal sent by the benchmark controller to the system to indicate that all tasks have been generated and sent.
DOCKER_CONTAINER_TERMINATED 16 The message that is sent if a container terminates. The message contains the container name.
START_BENCHMARK_SIGNAL 17 The message sent by the platform controller to inform the benchmark controller that everything is ready to start the benchmarking.
REQUEST_SYSTEM_RESOURCES_USAGE 18 The message sent by the benchmark to the platform controller to request system resource consumption statistics.
REPORT_ERROR 19 The message with which a system or a benchmark component can report an error. This should only be used for severe errors that should be part of the result model.

For implementing components, it is possible to use other than the predefined command ids. In this case it should be made sure that the used command ids do not overlap with the predefined ids. In general, it is recommended to use one an id of a free range listed in the following table.

id range status
0 - 100 reserved for predefined commands
101 - 122 free
123 reserved for future extensions
124 - 255 free

Predefined data objects

Some of the predefined commands come with data objects that are described in the following.

Error object

When reporting an error, the error data is represented as JSON:

{ 
  "containerId": "container reporting the error",
  "errorType": "IRI of the error type",
  "label": "A string that can be used as short label of an error"
  "description": "A string that can be used as a short description of an error"
}

The org.hobbit.core.data.ErrorData class can be used to represent this data as Java object.