-
Notifications
You must be signed in to change notification settings - Fork 0
Run simulation
First, launch RabbitMQ (message broker) and Redis (results data base) containers.
docker run -d -p 5672:5672 --name ict-rabbit integrcity/rabbitmq
docker run -d -p 6379:6379 --name ict-redis redis:alpine
We created a RabbitMQ image dedicated to IntegrCiTy in order the predefined user access, the very simple Dockerfile used to create this image can be found here.
By specifying image:alpine, the chosen image will be based on Alpine which is a lightweight Linux distibution. Images based on Alpine are usually smaller than other distributions.
The -p 0000:9999 option allow us to link ports between containers (9999) and host (0000). 5672 and 6397 are the defaults ports for respectively RabbitMQ and Redis.
Then, launch the orchestrator container specifying the RabbitMQ host address.
docker run -it --rm integrcity/orchestrator <IP_RABBIT> <SCE_FILE> <RUN_FILE>
For the DemoGA's scenario:
docker run -it --rm integrcity/orchestrator 172.17.0.1 DemoGA/data/sce.json DemoGA/data/run.json
It will return something like:
2017-09-06 06:35:19,655 - obnl.impl.node - INFO - scheduler is connecting...
2017-09-06 06:35:19,673 - obnl.impl.node - INFO - scheduler is connected!
2017-09-06 06:35:19,676 - obnl.impl.node - INFO - scheduler Queues are created.
2017-09-06 06:35:19,676 - obnl.impl.node - INFO - scheduler Consuming...
2017-09-06 06:35:19,677 - obnl.impl.server - INFO - Waiting for connection...
For the sake of simplicity, all the <SCE_FILE>, <RUN_FILE> and <WRAP_FILE> have been already added to the orchestrator and fmu_node images. For next simulations, those files can be transfered to containers at run time by mounting volumes between host and containers, more on data management in containers here. To get the path for the different scenario files, please check the Dockerfiles used to create IntegrCiTy images here.
Wait for the orchestrator node to be running (waiting for connections) and finally, launch all the simulation nodes, specifying each time the name of the dedicated wrapper file, the RabbitMQ and the Redis host addresses.
docker run -it --rm integrcity/node <WRAP_FILE.py> <IP_RABBIT>
For the DemoGA's scenario:
docker run -it --rm integrcity/node DemoGA/wrappers/cool_consumer.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/heat_consumer.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/hp_central.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/hp_heating.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/hp_cooling.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/power_network.py 172.17.0.1
docker run -it --rm integrcity/node DemoGA/wrappers/thermal_network.py 172.17.0.1
The -d option allow to detach from the container, so it will run in background and logs will not be directly available. If you use the -it option, the container is launch in interactive mode and stay connected to the container. You will need to open a new terminal to run other containers, more on run command options here.
Each time a node connect to the orchestrator you will see a log in the orchestrator terminal:
2017-09-06 06:36:33,708 - obnl.impl.server - INFO - Simulator 'ConsumerCooling' is connected.
When all the simulation nodes have acknowledge to the orchestrator via the message broker, the simulation start.