diff options
author | Magdalena GrodziĆska <mag.grodzinska@gmail.com> | 2020-01-29 23:08:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-29 23:08:43 +0100 |
commit | 4cafea9a2022d3f7be640d02075cfb279175037a (patch) | |
tree | 60c9712455b7fcaff37aeda008ed4f632ae66037 | |
parent | a85b80446ea7c7f669aadebf9af5e81b277107ce (diff) | |
parent | d7efd88eedd47d0879a1fb3712f3a622ece5a9e9 (diff) |
Cleanup logs and whitespace
-rw-r--r-- | README.md | 104 | ||||
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/agent/HierarchyConfig.java | 33 | ||||
-rw-r--r-- | src/main/java/pl/edu/mimuw/cloudatlas/client/ClientController.java | 12 |
3 files changed, 106 insertions, 43 deletions
@@ -2,8 +2,8 @@ ## Running -The agent, fetcher, and interpreter take an optional `-Dhostname=<agent's external hostname` -argument, which defaults to `localhost`. +The agent, fetcher, and interpreter take optional `-Dflagname=flagvalue` +argument. Otherwise those values are set to default ones, as described below. ### Query Signer # start rmiregistry @@ -13,7 +13,16 @@ argument, which defaults to `localhost`. # run Query Signer ./gradlew runQuerySigner -### API Agent +Relies on generation of public and private keys by scripts/generate_keys.sh. + +Flags: + +* java.rmi.server.hostname - RMI registry hostname, default: localhost +* querySignerHostname - query signer public RMI API hostname, default: localhost +* publicKeyFilename - path to public key file, relative to root of project, default: build/tmp/query_signer.pub +* privateKeyFilename - path to private key file, relative to root of project, default: build/tmp/query_signer + +### Agent # start rmiregistry ./scripts/registry @@ -22,13 +31,35 @@ argument, which defaults to `localhost`. Relies on keys generated during query signer setup. +Flags: + +* java.rmi.server.hostname - RMI registry hostname, default: localhost +* freshnessPeriod - data refresh period, default: 60 * 1000 +* queryPeriod - query rerun period, default: 5 * 1000 +* gossipPeriod - gossiping period, default: 5 * 1000 +* hostname - public UDP server hostname, default: hostname +* 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, + 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 + ### Client ./gradlew runClient -Relies on a running agent. +Exposes a web application on `localhost:8082`. -Exposes a web application on `localhost:8080`. +Relies on a running agent with fetcher. + +Flags: + +* hostname - agent RMI API hostname, default: localhost +* zonePath - zone pathname of agent, default: /uw/violet07 +* querySignerHostname - query signer RMI API hostname, default: localhost ### Fetcher @@ -36,6 +67,15 @@ Exposes a web application on `localhost:8080`. Sends system information to an agent. +Relies on a running agent. + +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: \{\"/uw/violet07\":[192,168,0,11]} + ### Interpreter ./gradlew runInterpreter @@ -53,3 +93,57 @@ 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 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 + + ./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 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..280a11f 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<ZMI> 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<Value> valueSetOrig = contactsValue.getValue(); - System.out.println("valueSetOrig: " + valueSetOrig.toString()); - Set<Value> valueSet = new HashSet(valueSetOrig); - System.out.println("valueSet: " + valueSet.toString()); + Set<Value> 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 <T> ValueContact selectContactFromSet(Set<T> 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<ZMI> getSiblings(ZMI root, PathName path) { try { - System.out.println("DEBUG: path in getSiblings: " + path.toString()); List<ZMI> siblingsImm = root.findDescendant(path).getFather().getSons(); - System.out.println("DEBUG: siblingsImm: " + siblingsImm.toString()); List<ZMI> 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,9 @@ 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!"); - } + } } } 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(); |