diff --git a/Local-Without-Prediction/README.md b/Local-Without-Prediction/README.md index 4e5d53f28d6311e4f02345c76c44d8cf423c9f26..3af53e55067b74de389a01fa45eda3d4b7ad6642 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 95565c9796d953ec024ad17de4eaea9eb17608bf..bd06d59148349c834796065776316b6e3eabdd53 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 766823dc498d416c1ca34a74df6b918ac52759b3..294a66fe23b13f3e894f9059d37d94398eec220b 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 bae24f6e0320291d85712f005f66956557fe4251..027015a3ba8cb39780fff804d370fc54cfcbfac7 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}")