Deployer Example

This tool is intended as an example of deploying different Nimble configurations at runtime. You can find it under tools/zmq_deployer. This example also uses tools/zmq_subscriber to listen to the Nimble output, you can find the subscriber example here Subscriber Example. First you will need to make sure that your license manager is configured, and that you have the latest docker images:

user@host:~$ docker-compose pull

To run the example:

user@host:~$ docker-compose up

Code Breakdown

First we read in the example JOSN files.

configs = []
for file in glob.glob("config/*.json"):
    print(f"Found configuration file: {file}")
    with open(file) as f:
        configs.append(json.load(f))

Connect to the deployment socket, this much match the --port (-p) number. This is the socket we will be sending the JSON configuration data over:

context = zmq.Context()
config_socket = context.socket(zmq.REQ)
config_socket.connect("tcp://nimble:22940")

For the purpose of the example the configuration files are looped over infinitely. Next the configuration data is sent over the socket:

config_message = config_socket.send_json(config_data)

Finally the status of the deployment is requested:

recv_message = config_socket.recv_json()

The socket will return the status as a JSON with a message:

{
        "status": bool,
        "message": string
}