Skip to content
Snippets Groups Projects
Commit cea69988 authored by nabil.abdennad's avatar nabil.abdennad
Browse files

no version in docker-compose.yml. added : decker compose down in README.

parent 5aab3d98
No related branches found
No related tags found
No related merge requests found
...@@ -43,6 +43,10 @@ Where <num_nodes> is the number of nodes in your network and <image_name> is the ...@@ -43,6 +43,10 @@ Where <num_nodes> is the number of nodes in your network and <image_name> is the
docker compose up docker compose up
## Stop the execution
docker compose down
## Troubleshooting ## 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. - Ensure that all environment variables are correctly set and that the neighbors' file is correctly configured.
\ No newline at end of file
version: '3.8' #version: '3.8'
services: services:
node0: node0:
......
...@@ -5,7 +5,7 @@ import argparse ...@@ -5,7 +5,7 @@ import argparse
def generate_docker_compose(image_name, num_nodes): def generate_docker_compose(image_name, num_nodes):
docker_compose_template = """\ docker_compose_template = """\
version: '3.8' #version: '3.8'
services: services:
""" """
......
...@@ -32,6 +32,10 @@ def mainProg(neighbors, rank, base_port, ip_address): ...@@ -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}") logger.info(f"Server {rank} listening on {ip_address} and port {base_port}")
while True: 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: for neighbor in neighbors:
try: try:
neighbor_ip = f"node{neighbor}" neighbor_ip = f"node{neighbor}"
...@@ -41,8 +45,6 @@ def mainProg(neighbors, rank, base_port, ip_address): ...@@ -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}.") logger.error(f"Exception {e}\nConnection refused when {rank} tried to connect to {neighbor}'s service {neighbor_ip}.")
continue continue
logger.info(f"I am at -- iteration {iteration}")
readable, _, _ = select.select([server_socket], [], [], 1) # x seconds timeout readable, _, _ = select.select([server_socket], [], [], 1) # x seconds timeout
if readable: if readable:
...@@ -51,7 +53,7 @@ def mainProg(neighbors, rank, base_port, ip_address): ...@@ -51,7 +53,7 @@ def mainProg(neighbors, rank, base_port, ip_address):
message_rcvd, sender = json.loads(data) message_rcvd, sender = json.loads(data)
conn.close() conn.close()
if message_rcvd == "REQUEST_WEIGHT": if message_rcvd == "REQUEST_WEIGHT": # a Neighbor is asking help
try: try:
sender = f"node{sender}" sender = f"node{sender}"
send_Message(rank,sender,"WEIGHTS") send_Message(rank,sender,"WEIGHTS")
...@@ -59,7 +61,7 @@ def mainProg(neighbors, rank, base_port, ip_address): ...@@ -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}.") logger.error(f"Exception {e}\nConnection refused when {rank} tried to send WEIGHTS to {sender}'s service {sender}.")
continue 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 received_dict[sender] = True
logger.info(f"I am here -- iteration {iteration} and message received {message_rcvd} from {sender}") logger.info(f"I am here -- iteration {iteration} and message received {message_rcvd} from {sender}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment