Redefined checkThresholds method for multiple links per worker

parent 81b3c673
......@@ -5,12 +5,14 @@ import java.util.ArrayList;
import es.bsc.compss.nfr.model.COMPSsApplication;
import es.bsc.compss.nfr.model.ElasticSystem;
import es.bsc.compss.nfr.model.Node;
import es.bsc.compss.nfr.model.Worker;
public abstract class ResourceManager {
protected ElasticSystem elasticSystem;
protected ArrayList<COMPSsApplication> apps;
protected ArrayList<Node> nodes;
protected ArrayList<Worker> workers;
/*
* Public Getters & Setters
......
......@@ -17,6 +17,7 @@ import org.json.JSONObject;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.MappingNode;
import es.bsc.compss.nfr.model.CommunicationLink;
import es.bsc.compss.nfr.model.ElasticSystem;
import es.bsc.compss.nfr.model.Node;
import es.bsc.compss.nfr.model.Worker;
......@@ -40,7 +41,7 @@ public class ResourceManagerComms extends ResourceManager {
this.fileUtils = new FileUtils();
}
public Map<String, Integer> checkThresholds(JSONObject telemetry, List<String> ymlAttrPathRtt, List<String> ymlAttrPathPll) {
/*public Map<String, Integer> checkThresholds(JSONObject telemetry, List<String> ymlAttrPathRtt, List<String> ymlAttrPathPll) {
Map<String, Integer> intTelemetryMap = new HashMap<>();
JSONObject netInterfaces = (JSONObject) telemetry.query("/net_interfaces");
......@@ -55,8 +56,29 @@ public class ResourceManagerComms extends ResourceManager {
}
return intTelemetryMap;
}*/
public void checkThresholds(Worker worker, List<String> ymlAttrPathRtt) {
List<CommunicationLink> workerLinks = worker.getCommunicationLinksForApplication();
// We need to get the rtt threshold from file, depending on infoNature. So we need infoNature
String infoNature = worker.getApplication().getInfoNature();
float rttmax = Float.valueOf(this.fileUtils.getYmlNodeScalar(Constants.APP_ATTRIB_PATH, Arrays.asList(infoNature, "rttmax")));
// We need to get the RTT for each Link in workerLinks from dataClay
//int thresViolation = 0;
for (int ll = 0; ll < workerLinks.size(); ll++) {
//float monitoredRTT = workerLinks.get(ll).getDelayRtt();
if (workerLinks.get(ll).getDelayRtt() > rttmax) {
worker.setActive(false); // Is inactive true or false?
return;
}
}
}
private int checkThreshold(JSONObject telemetry, List<String> ymlAttrPathRtt, List<String> ymlAttrPathPll) {
float devRttMax = Float.valueOf(this.fileUtils.getYmlNodeScalar(Constants.APP_ATTRIB_PATH, ymlAttrPathRtt));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment