From 36da6a754624f93e555bcaba8b3d0cdc28c17a0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sat, 11 Jan 2020 10:56:26 +0100 Subject: Make exp increases in good direction --- .../cloudatlas/agent/modules/GossipGirlStrategies.java | 13 ++++++------- .../cloudatlas/agent/modules/GossipGirlStrategyTest.java | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategies.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategies.java index 4cd534e..79efe39 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategies.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategies.java @@ -34,7 +34,6 @@ public class GossipGirlStrategies { ArrayList> zoneProbabilities; zoneProbabilities = new ArrayList<>(fullPathLength); - // TODO check if we decrease in good direction for (int i = 0; i < fullPathLength; i++) { Pair probPair = new Pair(fullPathComponents.get(i), Math.exp((double) i+1)); zoneProbabilities.add(probPair); @@ -48,7 +47,6 @@ public class GossipGirlStrategies { zoneProbabilities = new ArrayList<>(fullPathLength); Double uniformProb = 1.0/fullPathLength; - // TODO good direction for (int i = 0; i < fullPathLength; i++) { Pair probPair = new Pair(fullPathComponents.get(i), uniformProb); zoneProbabilities.add(probPair); @@ -72,10 +70,9 @@ public class GossipGirlStrategies { } private String updateRoundRobinExpFreqs() { - // TODO good direction - for (int i = roundRobinExpFreqs.size() - 1; i > 0; i--) { + for (int i = 0; i < roundRobinExpFreqs.size() - 1; i++) { Pair p = roundRobinExpFreqs.get(i); - Pair nextP = roundRobinExpFreqs.get(i-1); + Pair nextP = roundRobinExpFreqs.get(i+1); if (2 * p.getSecond() < nextP.getSecond()) { roundRobinExpFreqs.set(i, new Pair(p.getFirst(), p.getSecond() + 1)); @@ -83,8 +80,10 @@ public class GossipGirlStrategies { } } - Pair rootPath = roundRobinExpFreqs.get(0); - roundRobinExpFreqs.set(0, new Pair(rootPath.getFirst(), rootPath.getSecond() + 1)); + Pair rootPath = roundRobinExpFreqs.get(roundRobinExpFreqs.size() - 1); + roundRobinExpFreqs.set( + roundRobinExpFreqs.size() - 1, + new Pair(rootPath.getFirst(), rootPath.getSecond() + 1)); return rootPath.getFirst(); } diff --git a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java index 681483d..8fba76e 100644 --- a/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java +++ b/src/test/java/pl/edu/mimuw/cloudatlas/agent/modules/GossipGirlStrategyTest.java @@ -26,6 +26,7 @@ public class GossipGirlStrategyTest { gossipGirlStrategies.selectStrategy(GossipGirlStrategies.ZoneSelectionStrategy.ROUND_ROBIN_EXP_FREQ); freqs.put(selectedPath, freqs.get(selectedPath) + 1); System.out.println(selectedPath); + System.out.println(freqs); } } } -- cgit v1.2.3 From 5aa6345de1464a372bc69219ef9b777991bde1dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sat, 11 Jan 2020 12:39:54 +0100 Subject: Add adding missing zones on attribute creation --- src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java index 6761c94..3fca1d5 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/modules/Stanik.java @@ -1,5 +1,6 @@ package pl.edu.mimuw.cloudatlas.agent.modules; +import java.nio.file.Path; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -141,7 +142,11 @@ public class Stanik extends Module { */ public void handleSetAttribte(SetAttributeMessage message) { try { - ZMI zmi = hierarchy.findDescendant(new PathName(message.getPathName())); + PathName descendantPath = new PathName(message.getPathName()); + if (!hierarchy.descendantExists(descendantPath)) { + addMissingZones(descendantPath); + } + ZMI zmi = hierarchy.findDescendant(descendantPath); ValueTime updateTimestamp = message.getUpdateTimestamp(); ValueTime currentTimestamp = (ValueTime) zmi.getAttributes().getOrNull("timestamp"); if (ValueUtils.valueLower(currentTimestamp, updateTimestamp)) { -- cgit v1.2.3 From de08aa61aa15a6a3925a1e110c40eb36fc70e8b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sat, 11 Jan 2020 12:42:49 +0100 Subject: Add some prefetching and curses to load js quicker --- .../java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 1 + .../pl/edu/mimuw/cloudatlas/client/templates/attribChart.html | 10 +++++++--- .../pl/edu/mimuw/cloudatlas/client/templates/home.html | 2 ++ 3 files changed, 10 insertions(+), 3 deletions(-) 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 120d80d..0715af5 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -53,6 +53,7 @@ public class ClientController { } }; this.currentZoneName = "/uw/violet07"; + fetchAttributeData(); // fetch attribute data as early as possible } @GetMapping("/") diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html index ab83053..841d995 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/attribChart.html @@ -4,8 +4,11 @@ Attributes chart + + - + + diff --git a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html index 47b19af..043ac76 100644 --- a/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html +++ b/src/main/resources/pl/edu/mimuw/cloudatlas/client/templates/home.html @@ -6,6 +6,8 @@ CloudAtlas Client - home + + -- cgit v1.2.3 From fb16df8494e39327038a78b768538fefa3025337 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Sat, 11 Jan 2020 12:43:09 +0100 Subject: Fix spring port for the sake of testing --- src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bb48ff5..ee983e2 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,7 +1,7 @@ -server.port=0 +server.port=8082 spring.application.name=CloudAtlas Client -spring.thymeleaf.cache=false +spring.thymeleaf.cache=true spring.thymeleaf.enabled=true spring.thymeleaf.prefix=classpath:/pl/edu/mimuw/cloudatlas/client/templates/ spring.thymeleaf.suffix=.html -- cgit v1.2.3