From fce948560bdd05bc7750c53c694cb2e3878b825f Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 29 Jan 2020 17:43:13 +0100 Subject: Cleanup logs and whitespace --- .../mimuw/cloudatlas/agent/HierarchyConfig.java | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) 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 11d6ef0..71ccf3d 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java @@ -50,10 +50,8 @@ public class HierarchyConfig { PathName gossipLevel = gossipGirlStrategies.selectStrategy(zoneSelectionStrategy); ValueContact contact; if (random.nextDouble() < 0.2) { - System.out.println("FORCING FALLBACK"); contact = selectFallbackContact(state.getContacts()); } else { - System.out.println("LOOKING FOR CONTACT"); contact = selectContactFromLevel(gossipLevel, state); } @@ -68,7 +66,7 @@ public class HierarchyConfig { System.out.println("Interrupted while initiating gossip"); } catch (Exception e) { System.out.println("ERROR: something happened " + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } } }; @@ -80,21 +78,14 @@ public class HierarchyConfig { ZMI root = state.getZMI(); List siblings = getSiblings(root, path); filterEmptyContacts(siblings); - System.out.println("filtered siblings: " + siblings.toString()); if (siblings.isEmpty()) { - System.out.println("SIBLINGS IS EMPTY!!!"); return selectFallbackContact(state.getContacts()); } ZMI zmi = selectZMI(siblings); - System.out.println("SELECTED: " + zmi.toString()); ValueSet contactsValue = (ValueSet) zmi.getAttributes().getOrNull("contacts"); - System.out.println("ITS CONTACTS: " + contactsValue.toString()); Set valueSetOrig = contactsValue.getValue(); - System.out.println("valueSetOrig: " + valueSetOrig.toString()); - Set valueSet = new HashSet(valueSetOrig); - System.out.println("valueSet: " + valueSet.toString()); + Set valueSet = new HashSet(valueSetOrig); filterOurContact(valueSet); - System.out.println("FILTERED VALUE SET: " + valueSet.toString()); return selectContactFromSet(valueSet); } @@ -140,12 +131,10 @@ public class HierarchyConfig { } private ValueContact selectContactFromSet(Set contacts) throws Exception { - if (contacts.size() == 0) { - System.out.println("GOT EMPTY SET FOR SELECTION"); - return null; - } + if (contacts.size() == 0) { + return null; + } int i = random.nextInt(contacts.size()); - System.out.println("ROLLED RANDOM: " + Integer.toString(i)); for (T contact : contacts) { if (i == 0) { return (ValueContact) contact; @@ -158,14 +147,11 @@ public class HierarchyConfig { private List getSiblings(ZMI root, PathName path) { try { - System.out.println("DEBUG: path in getSiblings: " + path.toString()); List siblingsImm = root.findDescendant(path).getFather().getSons(); - System.out.println("DEBUG: siblingsImm: " + siblingsImm.toString()); List siblings = new ArrayList(); for (ZMI siblingOrI : siblingsImm) { - siblings.add(siblingOrI); + siblings.add(siblingOrI); } - System.out.println("found siblings: " + siblings.toString()); return siblings; } catch (ZMI.NoSuchZoneException e) { System.out.println("ERROR: didn't find path when looking for siblings"); @@ -178,14 +164,10 @@ public class HierarchyConfig { while (iterator.hasNext()) { ZMI zmi = iterator.next(); ValueSet contacts = (ValueSet) zmi.getAttributes().getOrNull("contacts"); - System.out.println("checking zmi " + zmi.toString()); - System.out.println("its contacts: " + contacts.toString()); if (contacts == null || contacts.isNull() || contacts.isEmpty() || onlyContactIsUs(contacts)) { - System.out.println("Let's remove it!"); iterator.remove(); } else { - System.out.println("Let's keep it!"); - } + } } } -- cgit v1.2.3 From ebad8e2dc7c84ee392d87dd5fbdec2d38727792c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 29 Jan 2020 21:35:26 +0100 Subject: Fix idents --- src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 71ccf3d..a1fc7ab 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java @@ -66,7 +66,7 @@ public class HierarchyConfig { System.out.println("Interrupted while initiating gossip"); } catch (Exception e) { System.out.println("ERROR: something happened " + e.toString()); - e.printStackTrace(); + e.printStackTrace(); } } }; @@ -150,7 +150,7 @@ public class HierarchyConfig { List siblingsImm = root.findDescendant(path).getFather().getSons(); List siblings = new ArrayList(); for (ZMI siblingOrI : siblingsImm) { - siblings.add(siblingOrI); + siblings.add(siblingOrI); } return siblings; } catch (ZMI.NoSuchZoneException e) { @@ -166,8 +166,7 @@ public class HierarchyConfig { ValueSet contacts = (ValueSet) zmi.getAttributes().getOrNull("contacts"); if (contacts == null || contacts.isNull() || contacts.isEmpty() || onlyContactIsUs(contacts)) { iterator.remove(); - } else { - } + } } } -- cgit v1.2.3 From 8b41f1f1d5b9c5117115ec9e81e04988f17abd0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 29 Jan 2020 21:38:27 +0100 Subject: One last small ident fix --- src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 a1fc7ab..280a11f 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java @@ -131,9 +131,9 @@ public class HierarchyConfig { } private ValueContact selectContactFromSet(Set contacts) throws Exception { - if (contacts.size() == 0) { - return null; - } + if (contacts.size() == 0) { + return null; + } int i = random.nextInt(contacts.size()); for (T contact : contacts) { if (i == 0) { -- cgit v1.2.3 From 60102d4c2b644c6e30f1f8281086e8a55664e4d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 29 Jan 2020 21:41:49 +0100 Subject: Remove logs from client --- .../pl/edu/mimuw/cloudatlas/client/ClientController.java | 12 ------------ 1 file changed, 12 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 bbdb8dc..a83e403 100644 --- a/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java +++ b/src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java @@ -45,21 +45,9 @@ public class ClientController { String agentHostname = System.getProperty("agent_hostname"); Registry registry = LocateRegistry.getRegistry(agentHostname); this.agentApi = (Api) registry.lookup("Api"); - System.out.println("agent api:"); - System.out.println(this.agentApi); - String querySignerHostname = System.getProperty("query_signer_hostname"); Registry querySignerRegistry = LocateRegistry.getRegistry(querySignerHostname); - System.out.println("querySignerHostname: " + querySignerHostname); - System.out.println(InetAddress.getByName("localhost")); - System.out.println(InetAddress.getByName(querySignerHostname)); - System.out.println("LIST:"); - System.out.println(querySignerRegistry.list()); - System.out.println("registry:"); - System.out.println(querySignerRegistry); this.querySignerApi = (QuerySignerApi) querySignerRegistry.lookup("QuerySignerApi"); - System.out.println("api:"); - System.out.println(this.querySignerApi); } catch (Exception e) { System.err.println("Client exception:"); e.printStackTrace(); -- cgit v1.2.3 From e077bc66a89220b0326f65f0bc5fea96f2576483 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 29 Jan 2020 22:32:35 +0100 Subject: Describe demo setup scripts --- README.md | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/README.md b/README.md index 3a5ad5b..834574a 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,55 @@ a hard-coded test hierarchy. ./gradlew test --tests InterpreterTests.fileTest13 Generates an HTML test report at `build/reports/tests/test/index.html`. + +## Demo setup + +The `scripts/` directory contains a bundle of scripts that can be helpful when +setting up a simple hierarchy. + +### Envrionment Variables + +The scripts assume that there are 5 machines with hostnames `rainbow01`, ..., +`rainbow05`. Each machine should have the following environment variables +available: + +* `NODE_NUMBER`: ranging from `01` to `05` +* `ZONE`: a level-1 zone name (e.g. `uw`) + +For example, if `rainbow01` corresponds to node `/uw/rainbow01` in the +hierarchy, it should have `NODE_NUMBER=01` and `ZONE=uw`. + +### RMI registry + +Each node should have an RMI registry running, started with + + ./scripts/registry + +### Query signer + +The scripts assume that the query signer runs on `rainbow01`. Before starting +it, run + + ./scripts/generate_keys.sh + +If `rainbow01` has ssh access to the other machines, the public key can then be +distributed with + + ./scripts/copyKey.sh + +Finally, start the query signer on `rainbow01` with + + ./scripts/runQuerySigner.sh + +### Agent and fetcher + +On each machine, the agent and fetcher components should be started with + + ./scripts/runAgent.sh + ./scripts/runFetcher.sh + +### Client (optional) + +A client connected to the local agent can be optionally started with + + ./scripts/runClient.sh -- cgit v1.2.3 From 7b8d1f5adfe49341de5cd2b595030955c2186ac8 Mon Sep 17 00:00:00 2001 From: Marcin Chrzanowski Date: Wed, 29 Jan 2020 22:37:50 +0100 Subject: Mention that keys need only be generated once --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 834574a..e159904 100644 --- a/README.md +++ b/README.md @@ -79,11 +79,13 @@ Each node should have an RMI registry running, started with ### Query signer -The scripts assume that the query signer runs on `rainbow01`. Before starting -it, run +The scripts assume that the query signer runs on `rainbow01`. Before first +starting it, run ./scripts/generate_keys.sh +to generate keys. + If `rainbow01` has ssh access to the other machines, the public key can then be distributed with -- cgit v1.2.3 From c964ff60a53ec57c4da02bce9cb7d8ef5cb3f806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 29 Jan 2020 23:04:51 +0100 Subject: Add flags README --- README.md | 51 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e159904..d4689c3 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,8 @@ ## Running -The agent, fetcher, and interpreter take an optional `-Dhostname= Date: Wed, 29 Jan 2020 23:06:22 +0100 Subject: Small fixes to README --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d4689c3..5000d06 100644 --- a/README.md +++ b/README.md @@ -41,10 +41,11 @@ Flags: * port - public UDP port, default: 5999 * timeout - UDP server timeout, default: 5 * 1000 * bufsize - UDP message buffer size, default: 512 -* zoneSelectionStrategy - zone selection strategy for gossiping, default: RandomUniform +* zoneSelectionStrategy - zone selection strategy for gossiping, default: RandomUniform, available options: RoundRobinExp, RoundRobinUniform, RandomExp, RandomUniform * zonePath - zone pathname of agent, default: /uw/violet07 -* publicKeyFilename - path to public key file, relative to root of project, default: build/tmp/query_signer.pub +* publicKeyFilename - path to public key file, relative to root of project, + default: build/tmp/query_signer.pub ### Client @@ -75,6 +76,7 @@ Flags: * ownAddr - public IP address or domain name of agent/fetcher machine * fallbackContacts - initialize fallback contacts, default: {}, example: + -DfallbackContacts=\{\"/uw/violet07\":[192,168,0,11]} ### Interpreter -- cgit v1.2.3 From d7efd88eedd47d0879a1fb3712f3a622ece5a9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magdalena=20Grodzi=C5=84ska?= Date: Wed, 29 Jan 2020 23:07:19 +0100 Subject: One last fix to flags, lol --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 5000d06..877b150 100644 --- a/README.md +++ b/README.md @@ -74,10 +74,7 @@ Flags: * hostname - agent RMI API hostname, default: localhost * zonePath - zone pathname of agent, default: /uw/violet07 * ownAddr - public IP address or domain name of agent/fetcher machine -* fallbackContacts - initialize fallback contacts, default: {}, example: - - - -DfallbackContacts=\{\"/uw/violet07\":[192,168,0,11]} +* fallbackContacts - initialize fallback contacts, default: {}, example: \{\"/uw/violet07\":[192,168,0,11]} ### Interpreter -- cgit v1.2.3