Ejemplo n.º 1
0
  @Override
  public boolean reduceLoad(ResourceNode node, int loadValue) throws MonitorException {
    String nodeId = node.getNodeId();
    if (this.loadMap.containsKey(nodeId)) {
      int currLoad = loadMap.get(nodeId);
      currLoad = Math.min(0, currLoad - loadValue);
      this.loadMap.put(nodeId, currLoad);
    } else {
      this.loadMap.put(nodeId, 0);
    }

    return true;
  }
Ejemplo n.º 2
0
  @Override
  public int getLoad(ResourceNode node) throws MonitorException {
    Map<String, String> nodeProperties;
    String nodeId = node.getNodeId();
    nodeProperties = this.locateNode(nodeId);
    if (nodeProperties == null) {
      throw new MonitorException("GangliaMonitor: not tracking requested node: [" + nodeId + "]");
    }

    // calculate load
    double calcLoad = this.loadCalculator.calculateLoad(nodeProperties);
    System.out.println(calcLoad);
    int load = Long.valueOf(Math.round(calcLoad)).intValue();
    System.out.println("LOAD is: " + load);
    return load;
  }
Ejemplo n.º 3
0
 @Override
 public boolean assignLoad(ResourceNode node, int loadValue) throws MonitorException {
   // technically this method should simply do nothing, since
   // putting a job onto a node should cause Ganglia to detect
   // for now we'll simply track what the current perceived load
   // on a node is - we may want to factor this into the weighting
   // in load calculator later
   String nodeId = node.getNodeId();
   if (loadMap.containsKey(nodeId)) {
     int currLoad = loadMap.get(nodeId);
     currLoad += loadValue;
     loadMap.put(nodeId, currLoad);
   } else {
     loadMap.put(nodeId, loadValue);
   }
   return true;
 }