Commit 3beee85a authored by Steven Murdoch's avatar Steven Murdoch
Browse files

Find the nodes which are considered useful (for now, just makes this 90% uptime)

parent 2605eec1
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@ class RouterInfo {
    samplesRunning += 1
  }

  def isUseful = (samplesRunning.toDouble/RouterInfo.totalSamples.toDouble*100) >= 90.0

  override def toString = {
    val percent = samplesRunning.toDouble/RouterInfo.totalSamples.toDouble*100
    "Running %d out of %d (%5.5f%%)".format(samplesRunning, RouterInfo.totalSamples, percent)
@@ -132,6 +134,14 @@ object AutoPromotion {
    val nodeInfo = invertMapping(runningNodes) // Mapping of node -> node information
    for ((k,v) <- nodeInfo)
      System.out.println(k + " -- " + v)

    // Find out which nodes are considered useful
    val usefulNodes = nodeInfo.filter{kv => kv._2.isUseful}.keySet
    System.out.println("Useful nodes")
    for (k <- usefulNodes)
      System.out.println(k)

    // For each time, how right are we?
  }
}