From cea6998871ab097cf1d2299d9f42a0fa3d76ab2b Mon Sep 17 00:00:00 2001
From: "nabil.abdennad" <nabil.abdennadher@hesge.ch>
Date: Sun, 22 Sep 2024 16:02:04 +0200
Subject: [PATCH] no version in docker-compose.yml. added : decker compose down
 in README.

---
 Local-Without-Prediction/README.md                  |  6 +++++-
 Local-Without-Prediction/docker-compose.yml         |  2 +-
 Local-Without-Prediction/generate-docker-compose.py |  2 +-
 Local-Without-Prediction/sock.py                    | 10 ++++++----
 4 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/Local-Without-Prediction/README.md b/Local-Without-Prediction/README.md
index 4e5d53f..3af53e5 100644
--- a/Local-Without-Prediction/README.md
+++ b/Local-Without-Prediction/README.md
@@ -43,6 +43,10 @@ Where <num_nodes> is the number of nodes in your network and <image_name> is the
 
     docker compose up
 
+ ## Stop the execution
+
+    docker compose down   
+
 ## Troubleshooting
-- Check the container logs 
+- Check the container logs: docker logs <nodexx>, where xx is the number of the node.
 - Ensure that all environment variables are correctly set and that the neighbors' file is correctly configured.
\ No newline at end of file
diff --git a/Local-Without-Prediction/docker-compose.yml b/Local-Without-Prediction/docker-compose.yml
index 95565c9..bd06d59 100644
--- a/Local-Without-Prediction/docker-compose.yml
+++ b/Local-Without-Prediction/docker-compose.yml
@@ -1,4 +1,4 @@
-version: '3.8'
+#version: '3.8'
 services:
 
   node0:
diff --git a/Local-Without-Prediction/generate-docker-compose.py b/Local-Without-Prediction/generate-docker-compose.py
index 766823d..294a66f 100644
--- a/Local-Without-Prediction/generate-docker-compose.py
+++ b/Local-Without-Prediction/generate-docker-compose.py
@@ -5,7 +5,7 @@ import argparse
 
 def generate_docker_compose(image_name, num_nodes):
     docker_compose_template = """\
-version: '3.8'
+#version: '3.8'
 services:
 """
 
diff --git a/Local-Without-Prediction/sock.py b/Local-Without-Prediction/sock.py
index bae24f6..027015a 100644
--- a/Local-Without-Prediction/sock.py
+++ b/Local-Without-Prediction/sock.py
@@ -32,6 +32,10 @@ def mainProg(neighbors, rank, base_port, ip_address):
     logger.info(f"Server {rank} listening on {ip_address} and port {base_port}")
 
     while True:
+        #Read a measure
+        #Do a forecast
+        #Calculate the NMSE (assess the performance of the forecast
+        #If "low performance data" ... Send REQUEST-WEIGHT to neigbors (code below)
         for neighbor in neighbors:
             try:
                 neighbor_ip = f"node{neighbor}" 
@@ -41,8 +45,6 @@ def mainProg(neighbors, rank, base_port, ip_address):
                 logger.error(f"Exception {e}\nConnection refused when {rank} tried to connect to {neighbor}'s service {neighbor_ip}.")
                 continue
 
-        logger.info(f"I am at -- iteration {iteration}")
-
         readable, _, _ = select.select([server_socket], [], [], 1)  # x seconds timeout
 
         if readable:
@@ -51,7 +53,7 @@ def mainProg(neighbors, rank, base_port, ip_address):
             message_rcvd, sender = json.loads(data)
             conn.close()
             
-            if message_rcvd == "REQUEST_WEIGHT":
+            if message_rcvd == "REQUEST_WEIGHT": # a Neighbor is asking help
                 try:
                     sender = f"node{sender}" 
                     send_Message(rank,sender,"WEIGHTS")
@@ -59,7 +61,7 @@ def mainProg(neighbors, rank, base_port, ip_address):
                     logger.error(f"Exception {e}\nConnection refused when {rank} tried to send WEIGHTS to {sender}'s service {sender}.")
                     continue
 
-            if message_rcvd == "WEIGHTS":
+            if message_rcvd == "WEIGHTS":   #a Neighbor to whom I have sent a help REQUEST_WEIGHT just replied to my request
                 received_dict[sender] = True
                 logger.info(f"I am here -- iteration {iteration} and message received {message_rcvd} from {sender}")
 
-- 
GitLab