From 8644de307a17ad7a2f8695b53c0e3d0c42087ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sat, 11 Jan 2020 22:05:03 +0100 Subject: Switching zone to violet08 by hand --- src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 4 +++- src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index 210505d..f6c49cf 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -53,7 +53,8 @@ public class ClientController { return size() > MAX_ENTRIES; } }; - this.currentZoneName = "/uw/violet07"; + // TODO set zone in config + this.currentZoneName = "/uw/violet08"; fetchAttributeData(); // fetch attribute data as early as possible } @@ -445,6 +446,7 @@ public class ClientController { return "zoneForm"; } + // TODO available zones dont work when our zone changed @PostMapping("/zones") public String zonesPostPage(@ModelAttribute DataStringInput zoneName, Model model) { this.currentZoneName = zoneName.getString(); diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java index 15f8a59..f96d259 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java @@ -111,7 +111,8 @@ public class Fetcher { deserializedAttribs = deserializeAttribs(jsonAttribs); for (int i = 0; i < fetcherAttributeNames.size(); i++) { api.setAttributeValue( - "/uw/violet07", + // TODO enable setup in config + "/uw/violet08", fetcherAttributeNames.get(i), packAttributeValue( deserializedAttribs.get(i), -- cgit v1.2.3 From 226f36d1de3e71a34c344d9b859216ad2de3fb16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 14:40:05 +0100 Subject: Add fix to attrib sending logic in gossip girl --- src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java index dd8f0b7..0cfa527 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirl.java @@ -158,7 +158,7 @@ public class GossipGirl extends Module { GossipGirlState state = gossipStates.get(message.getReceiverGossipId()); if (state != null) { state.gotAttributes(message); - if (state.state == GossipGirlState.State.SEND_INFO) { + if (state.state == GossipGirlState.State.SEND_INFO || state.state == GossipGirlState.State.SEND_INFO_AND_FINISH) { sendInfo(state); } UpdateAttributesMessage updateMessage = new UpdateAttributesMessage("", 0, message.getPath().toString(), message.getAttributes()); -- cgit v1.2.3 From 7a4508bfa906eff853dfb2424e3b91761a886da6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 14:54:47 +0100 Subject: Switch zones by flags in agent, client, fetcher --- src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java | 3 ++- src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java | 4 ++-- .../java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 4 +--- src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java index 0cbda2d..53255aa 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java @@ -44,12 +44,13 @@ public class Agent { // TODO config setup String zonePath = System.getProperty("zone_path"); + System.out.println("zonePAth " + zonePath); String selectionStrategy = System.getProperty("Gossip.zone_strategy"); Long queryPeriod = Long.getLong("query_period"); Long gossipPeriod = Long.getLong("gossip_period"); HierarchyConfig hierarchyConfig = new HierarchyConfig(eventBus, zonePath, selectionStrategy); hierarchyConfig.startQueries(queryPeriod); - hierarchyConfig.startGossip(gossipPeriod); + hierarchyConfig.startGossip(gossipPeriod, zonePath); } } diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java index dc5241d..f9e323a 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java @@ -37,7 +37,7 @@ public class HierarchyConfig { } } - public void startGossip(long gossipPeriod) { + public void startGossip(long gossipPeriod, String zonePath) { Supplier taskSupplier = () -> new TimerScheduledTask() { public void run() { @@ -47,7 +47,7 @@ public class HierarchyConfig { ValueContact contact = selectContactFromLevel(gossipLevel); if (contact != null) { System.out.println("INFO: found a contact " + contact.toString()); - InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName("/uw/violet07"), contact); + InitiateGossipMessage message = new InitiateGossipMessage("", 0, new PathName(zonePath), contact); sendMessage(message); } else { System.out.println("DEBUG: couldn't find contact for gossip"); diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java index f6c49cf..4019696 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -53,8 +53,7 @@ public class ClientController { return size() > MAX_ENTRIES; } }; - // TODO set zone in config - this.currentZoneName = "/uw/violet08"; + this.currentZoneName = System.getProperty("zone_path"); fetchAttributeData(); // fetch attribute data as early as possible } @@ -446,7 +445,6 @@ public class ClientController { return "zoneForm"; } - // TODO available zones dont work when our zone changed @PostMapping("/zones") public String zonesPostPage(@ModelAttribute DataStringInput zoneName, Model model) { this.currentZoneName = zoneName.getString(); diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java index f96d259..12d795a 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/fetcher/Fetcher.java @@ -92,7 +92,7 @@ public class Fetcher { } // https://jj09.net/interprocess-communication-python-java/ - private static void fetchData() { + private static void fetchData(String zonePath) { BufferedReader bufferRead; ArrayList deserializedAttribs; String jsonAttribs; @@ -111,8 +111,7 @@ public class Fetcher { deserializedAttribs = deserializeAttribs(jsonAttribs); for (int i = 0; i < fetcherAttributeNames.size(); i++) { api.setAttributeValue( - // TODO enable setup in config - "/uw/violet08", + zonePath, fetcherAttributeNames.get(i), packAttributeValue( deserializedAttribs.get(i), @@ -144,7 +143,8 @@ public class Fetcher { } public static void main(String[] args) { + String zonePath = System.getProperty("zone_path"); parseArgs(args); - fetchData(); + fetchData(zonePath); } } -- cgit v1.2.3 From 5995da144818842e69b9d0afa9f392a9e6419508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 14:57:35 +0100 Subject: Remove redundant log --- src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java index 53255aa..24ed0c1 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/Agent.java @@ -42,9 +42,7 @@ public class Agent { // TODO: make query period confiurable with config file and from tests - // TODO config setup String zonePath = System.getProperty("zone_path"); - System.out.println("zonePAth " + zonePath); String selectionStrategy = System.getProperty("Gossip.zone_strategy"); Long queryPeriod = Long.getLong("query_period"); Long gossipPeriod = Long.getLong("gossip_period"); -- cgit v1.2.3 From 3ebdb1ce162e13c5accf7f3e65a35863504026dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sun, 12 Jan 2020 15:10:27 +0100 Subject: Reduce sleeps --- .../pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java | 4 ++-- .../java/pl/edu/mimuw/cloudatlas/agent/SchedulerTest.java | 6 +++--- src/test/java/pl/edu/mimuw/cloudatlas/agent/UDUPTest.java | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java index e2c12d6..9028026 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/AgentIntegrationTest.java @@ -48,9 +48,9 @@ public class AgentIntegrationTest { @BeforeClass public static void bindApi() throws Exception { registryProcess = Runtime.getRuntime().exec("./scripts/registry"); - Thread.sleep(10000); + Thread.sleep(5000); agentProcess = Runtime.getRuntime().exec("./gradlew runAgent -Dhostname=localhost -DfreshnessPeriod=10000000 -DqueryPeriod=100"); - Thread.sleep(10000); + Thread.sleep(5000); registry = LocateRegistry.getRegistry("localhost"); api = (Api) registry.lookup("Api"); diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/SchedulerTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/SchedulerTest.java index 4a9eb87..99051ff 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/SchedulerTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/SchedulerTest.java @@ -60,7 +60,7 @@ public class SchedulerTest { } })); - Thread.sleep(1000); + Thread.sleep(300); } @Test @@ -92,7 +92,7 @@ public class SchedulerTest { })); - Thread.sleep(1000); + Thread.sleep(300); } @Test @@ -129,6 +129,6 @@ public class SchedulerTest { } })); - Thread.sleep(1000); + Thread.sleep(300); } } diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/UDUPTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/UDUPTest.java index ac2c587..f731706 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/UDUPTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/UDUPTest.java @@ -30,7 +30,7 @@ public class UDUPTest { UDUPServer server2 = null; UDUPMessage msg1 = null; boolean testSuccess = true; - int timeout = 5000; + int timeout = 500; try { System.out.println("Starting udp1"); @@ -72,7 +72,7 @@ public class UDUPTest { udpThread2.start(); try { - Thread.sleep(500); + Thread.sleep(100); if (udp1 == null | udp2 == null) { testSuccess = false; } else { @@ -102,7 +102,7 @@ public class UDUPTest { UDUPServer server2 = null; UDUPMessage msg1 = null; boolean testSuccess = true; - int timeout = 3000; + int timeout = 1000; try { System.out.println("Starting udp1"); @@ -144,7 +144,7 @@ public class UDUPTest { udpThread2.start(); try { - Thread.sleep(500); + Thread.sleep(100); if (udp1 == null | udp2 == null) { testSuccess = false; } else { @@ -177,7 +177,7 @@ public class UDUPTest { UDUPMessage msg2 = null; UDUPMessage msg3 = null; boolean testSuccess = true; - int timeout = 3000; + int timeout = 1000; try { System.out.println("Starting udp1"); @@ -231,7 +231,7 @@ public class UDUPTest { udpThread2.start(); try { - Thread.sleep(500); + Thread.sleep(100); if (udp1 == null | udp2 == null) { testSuccess = false; } else { -- cgit v1.2.3