Commit e4d0e267 authored by esabate's avatar esabate

Model updated according to changes decided during the meetings. Also README updated accordingly.

parent 13dfb62a
......@@ -8,32 +8,38 @@ This model is used to communicate the NFR tool with the COMPSs orchestrator. The
Registered model has the following representation:
```
+---------------------+
| |
| Master |
| |
+----------------------+ +---------------------+
| |1 1| | +--------------------------+
| COMPSsApplication +<------>+ - int PID |* 1| |
| | | +<------->+ Node |
+----------------------+ +---------------------+ | |
| | +--------------------------+
| - String name |1 *----------------------+ | |
| - String uuid +<------>+ |* 1| - String name |
| - bool isSecure | | Worker | | - int cpuCapacity |
| - String infoNature | | +---------+ - int energyCapacity |
| | +---------------------+ | - int communicationCost |
+---------+------------+ | | | |
^* | - int PID | +--------------------------+
| | - boolean active | ^*
|1 | | |
+---------+---------+ +---------------------+ |
| | |
| ElasticSystem | |
| | |
+-------------------+ |
| |1 |
| +<-------------------------------------------------------+
+---------------------+
| |
| Master |
| |
+-------------------------+ +---------------------+
| |1 1| | +--------------------------+
| COMPSsApplication +<------>+ - int PID | | |
| | | - String IP |* 1| Node |
+-------------------------+ | +<------------->+ |
| | +---------------------+ +--------------------------+ +---------------------+
| - String name | | | | |
| - String uuid |1 *+---------------------------+ | - String ipWifi | | CommunicationLink |
| - boolean isSecure +<------>+ |* 1| - String ipEth |* *| |
| - String infoNature | | Worker +---------+ - String ipLte +<----------->+---------------------+
| - int monitoringPeriod | | | | - float signalWifi | | |
| | +---------------------------+ | - float energyThreshold | | - String IPNode1 |
+-------------------------+ | | | - float cpuThreshold | | - String IPNode2 |
^* | - int PID | | - int numCores | | - float delayRTT |
| | - boolean active | | | | - float PLR |
| | - float cpuUsage | +--------------------------+ | |
| | - int computingUnits | ^* +---------------------+
| | - String ip | |
| | - float communicationCost| |
| | | |
|1 +---------------------------+ |
+---------+---------+ |
| | |
| ElasticSystem | |
| | |
+-------------------+ |
| |1 |
| +<----------------------------------------------------------------+
+---------+---------+
```
......
......@@ -19,6 +19,9 @@ public class COMPSsApplication {
/** Application's information nature (E.x: Video stream, location data). */
private String infoNature;
/** Application monitoring period attribute. */
private final int monitoringPeriod;
/** COMPSsApplication master process. */
private Master master;
......@@ -30,9 +33,10 @@ public class COMPSsApplication {
* COMPSsApplication constructor.
* @param appName Name of the application
*/
public COMPSsApplication(final String appName, final String uuid) {
public COMPSsApplication(final String appName, final String uuid, final int monitoringPeriod) {
this.name = appName;
this.uuid = uuid;
this.monitoringPeriod = monitoringPeriod;
}
/**
......@@ -115,6 +119,12 @@ public class COMPSsApplication {
return this.uuid;
}
/**
* Get application monitoring period attribute
* @return monitoringPeriod
*/
public int getMonitoringPeriod() { return this.monitoringPeriod; }
@Override
public String toString() {
return "COMPSsApplication: " + name + " \n" +
......
package es.bsc.compss.nfr.model;
import es.bsc.dataclay.DataClayObject;
import java.util.ArrayList;
import java.util.List;
/**
* This class represents a worker process.
*/
public class CommunicationLink extends DataClayObject {
/** Ip of node 1 present in the communication link. */
private String ipNode1;
/** Ip of node 2 present in the communication link. */
private String ipNode2;
/** Delay in a particular communication link. */
private float delayRtt;
/** Packet Loss Rate. */
private float plr;
/** List of all nodes present in a given communication list. */
private List<Node> nodes = new ArrayList<>();
/**
* Constructor.
* @param node Node containing the process
* @param pid Worker process PID
*/
public CommunicationLink(final Node node1, final Node node2, final String ipNode1, final String ipNode2,
final float delayRtt, final float plr) {
this.ipNode1 = ipNode1;
this.ipNode2 = ipNode2;
this.delayRtt = delayRtt;
this.plr = plr;
this.nodes.add(node1);
this.nodes.add(node2);
}
/**
* Get the address of the first node present in the communication link
* @return string IP of node 1
*/
public String getIpNode1() { return this.ipNode1; }
/**
* Set the address of the first node present in the communication link
* @param ipNode1 string IP of node 1
*/
public void setIpNode1(final String ipNode1) { this.ipNode1 = ipNode1; }
/**
* Get the address of the second node present in the communication link
* @return string IP of node 2
*/
public String getIpNode2() { return this.ipNode2; }
/**
* Set the address of the second node present in the communication link
* @param ipNode2 string IP of node 2
*/
public void setIpNode2(final String ipNode2) { this.ipNode2 = ipNode2; }
/**
* Get the delayRTT present in the communication link between node 1 and node 2
* @return float delayRtt
*/
public float getDelayRtt() { return this.delayRtt; }
/**
* Set the delayRTT present in the communication link between node 1 and node 2
* @param delayRtt float
*/
public void setDelayRtt(final float delayRtt) { this.delayRtt = delayRtt; }
/**
* Get the packet loss rate present in the communication link between node 1 and node 2
* @return float plr
*/
public float getPlr() { return this.plr; }
/**
* Set the PLR present in the communication link between node 1 and node 2
* @param plr float
*/
public void setPlr(final float plr) { this.plr = plr; }
/** Remove node Node from*/
@Override
public String toString() {
return " communication link { IP Node 1 = " + getIpNode1() + " , IP Node 2 = " + getIpNode2()
+ ", Delay RTT = " + getDelayRtt() + ", PLR = " + getPlr() + "}";
}
}
......@@ -77,7 +77,7 @@ public class ElasticSystem {
@Override
public String toString() {
String result = "Applications: " + apps.stream().map(COMPSsApplication::getName).collect(Collectors.toList()) + " \n";
result += " - nodes: " + nodes.stream().map(Node::getName).collect(Collectors.toList()) + "\n";
result += " - nodes: " + nodes.stream().map(Node::getIpWifi).collect(Collectors.toList()) + "\n";
return result;
}
}
......@@ -13,6 +13,9 @@ public class Master extends DataClayObject {
/** Master process PID. */
private int pid;
/** Master IP. */
private String ip;
/** Applications executed by this master. */
private COMPSsApplication app;
......@@ -21,10 +24,11 @@ public class Master extends DataClayObject {
* @param node Node containing the process.
* @param pid Master process PID
*/
public Master(final Node node, final int pid) {
public Master(final Node node, final int pid, final String ip) {
this.node = node;
this.pid = pid;
node.addMaster(this);
this.ip = ip;
}
/**
......@@ -35,6 +39,12 @@ public class Master extends DataClayObject {
return node;
}
/**
* Get Master's IP
* @return ip String with the IP of the master node
*/
public String getIp() { return this.ip; }
/**
* Set node containing Master process
* @param node node containing Master process to set
......
......@@ -10,17 +10,26 @@ import java.util.List;
*/
public class Node extends DataClayObject {
/** Node name. */
private String name;
/** Node IP for Wifi Interface. */
private String ipWifi;
/** Node CPU capacity. */
private int cpuCapacity;
/** Node IP for Ethernet Interface. */
private String ipEth;
/** Node Energy capacity. */
private int energyCapacity;
/** Node Communication cost. */
private int communicationCost;
/** Node IP for LTE Interface. */
private String ipLte;
/** Node CPU threshold. */
private float cpuThreshold;
/** Node Energy threshold. */
private float energyThreshold;
/** Wifi Signal. */
private float signalWifi;
/** Num cores. */
private int numCores;
/** List of all masters present in a given node. */
private List<Master> masters = new ArrayList<>();
......@@ -28,82 +37,137 @@ public class Node extends DataClayObject {
/** List of all workers present in a given node. */
private List<Worker> workers = new ArrayList<>();
/** List of all communication links a given node participates in. */
private List<CommunicationLink> communicationLinks = new ArrayList<>();
/**
* Constructor.
* @param name Node name, which can be either the IP or the hostname
* @param cpuCapacity Capacity of the CPU
* @param energyCapacity Energy capacity of the node
* @param cpuThreshold Threshold of the CPU
* @param energyThreshold Energy threshold of the node
*/
public Node(final String ipWifi, final String ipEth, final String ipLte, final float cpuThreshold,
final float energyThreshold, final float signalWifi, final int numCores) {
this.ipWifi = ipWifi;
this.ipEth = ipEth;
this.ipLte = ipLte;
this.cpuThreshold = cpuThreshold;
this.energyThreshold = energyThreshold;
this.signalWifi = signalWifi;
this.numCores = numCores;
}
/**
* Get CPU Threshold of the node
* @return node cpuThreshold
*/
public float getCPUThreshold() {
return cpuThreshold;
}
/**
* Get energy threshold of the node
* @return float energyThreshold
*/
public Node(final String name, final int cpuCapacity, final int energyCapacity, final int communicationCost) {
this.name = name;
this.cpuCapacity = cpuCapacity;
this.energyCapacity = energyCapacity;
this.communicationCost = communicationCost;
public float getEnergyThreshold() {
return energyThreshold;
}
/**
* Get CPU capacity of the node
* @return node cpuCapacity
* Set CPU Threshold of the node
* @param cpuThreshold node threshold to set
*/
public int getCPUCapacity() {
return cpuCapacity;
public void setCPUThreshold(float cpuThreshold) {
this.cpuThreshold = cpuThreshold;
}
/**
* Get energy capacity of the node
* @return node cpuCapacity
* Set energy Threshold of the node
* @param energyThreshold node threshold to set
*/
public int getEnergyCapacity() {
return energyCapacity;
public void setEnergyThreshold(float energyThreshold) {
this.energyThreshold = energyThreshold;
}
/**
* Set CPU capacity of the node
* @param cpuCapacity node capacity to set
* Get node IP for Wifi Interface.
* @return String ipWifi.
*/
public void setCPUCapacity(int cpuCapacity) {
this.cpuCapacity = cpuCapacity;
public String getIpWifi() {
return ipWifi;
}
/**
* Set energy capacity of the node
* @param energyCapacity node capacity to set
* Set node IP for Wifi interface.
* @param ipWifi Node Wifi IP to set.
*/
public void setEnergyCapacity(int energyCapacity) {
this.energyCapacity = energyCapacity;
public void setIpWifi(String ipWifi) {
this.ipWifi = ipWifi;
}
/**
* Get node IP for Ethernet Interface.
* @return String ipEth.
*/
public String getIpEth() {
return ipEth;
}
/**
* Set node IP for Ethernet interface.
* @param ipEth Node Ethernet IP to set.
*/
public void setIpEth(String ipEth) {
this.ipEth = ipEth;
}
/**
* Get node name.
* @return Node name.
* Get node IP for LTE Interface.
* @return String ipLte.
*/
public String getName() {
return name;
public String getIpLte() {
return ipLte;
}
/**
* Set node name.
* @param name Node name to set.
* Set node IP for LTE interface.
* @param ipLTE Node LTE IP to set.
*/
public void setName(String name) {
this.name = name;
public void setIpLte(String ipLTE) {
this.ipLte = ipLTE;
}
/**
* Get node communication cost.
* @return Node communication cost.
* Get node Wifi signal.
* @return Node wifi signal.
*/
public int getCommunicationCost() {
return communicationCost;
public float getSignalWifi() {
return signalWifi;
}
/**
* Set node communication cost.
* @param communicationCost Node communicationCost to set.
* Set node Wifi signal.
* @param wifiSignal Node wifiSignal to set.
*/
public void setCommunicationCost(int communicationCost) {
this.communicationCost = communicationCost;
public void setSignalWifi(float signalWifi) {
this.signalWifi = signalWifi;
}
/**
* Get node number of cores.
* @return Node number of cores.
*/
public int getNumCores() {
return numCores;
}
/**
* Set node number of cores.
* @param numCores Node numCores to set.
*/
public void setSignalWifi(int numCores) {
this.numCores = numCores;
}
/**
......@@ -124,7 +188,7 @@ public class Node extends DataClayObject {
/**
* Adds a new worker to the list of workers on a specific node in order to be able to traverse the classes the other way around.
* @param
* @param
*/
public void addWorker(final Worker worker) {
workers.add(worker);
......@@ -138,25 +202,55 @@ public class Node extends DataClayObject {
return workers;
}
/**
* Adds a new communication link to the list of communication links on a specific node.
* @param communicationLink object
*/
public void addCommunicationLink(final CommunicationLink communicationLink) {
communicationLinks.add(communicationLink);
}
/**
* Returns the list of communication links objects present in a specific node.
* @return List of communicationLinks
*/
public List<CommunicationLink> getCommunicationLinks() {
return communicationLinks;
}
/**
* Remove a communication link the node was participating in.
* @param communicationLink CommunicationLink object
*/
public void removeCommunicationLink(CommunicationLink communicationLink) {
communicationLinks.removeIf(c -> c.getIpNode1().equals(communicationLink.getIpNode1()) &&
c.getIpNode2().equals(communicationLink.getIpNode2()));
}
/**
* Remove master from list of registered masters in the node
* @param master Master object
*/
public void removeMaster(Master master) {
masters.removeIf(m -> m.getNode().getName().equals(master.getNode().getName()));
}
masters.removeIf(m -> m.getNode().getIpWifi().equals(master.getNode().getIpWifi()));
masters.removeIf(m -> m.getNode().getIpEth().equals(master.getNode().getIpEth()));
masters.removeIf(m -> m.getNode().getIpLte().equals(master.getNode().getIpLte()));
}
/**
* Remove worker from list of registered workers in the node
* @param worker Worker object
*/
public void removeWorker(Worker worker) {
workers.removeIf(w -> w.getNode().getName().equals(worker.getNode().getName()));
workers.removeIf(w -> w.getNode().getIpWifi().equals(worker.getNode().getIpWifi()));
workers.removeIf(w -> w.getNode().getIpEth().equals(worker.getNode().getIpEth()));
workers.removeIf(w -> w.getNode().getIpLte().equals(worker.getNode().getIpLte()));
}
@Override
public String toString() {
return " [ name = " + name + " , cpuCapacity = " + cpuCapacity + " , energyCapacity = " + energyCapacity + " ]";
return " [ Wifi IP = " + ipWifi + " , ETH IP = " + ipEth + " , LTE IP = " + ipLte
+ " , cpuThreshold = " + cpuThreshold + " , energyThreshold = " + energyThreshold + " ]";
}
}
......@@ -16,6 +16,18 @@ public class Worker extends DataClayObject {
/** Boolean showing if worker is running applications. */
private boolean active;
/** Float containing the current cpu usage of a Worker. */
private float cpuUsage;
/** Number of available computing units of a Worker. */
private int computingUnits;
/** Float representing the communication cost of a Worker. */
private float communicationCost;
/** Worker IP. */
private String ip;
/** COMPSsApplication this worker is executing. */
private COMPSsApplication app;
......@@ -25,20 +37,17 @@ public class Worker extends DataClayObject {
* @param node Node containing the process
* @param pid Worker process PID
*/
public Worker(final Node node, final int pid, final boolean active, final COMPSsApplication app) {
public Worker(final Node node, final int pid, final boolean active, final COMPSsApplication app,
final float cpuUsage, final int computingUnits, final String ip, final float communicationCost) {
this.node = node;
this.pid = pid;
this.active = active;
node.addWorker(this);
this.app = app;
}
/**
* Get the address of the worker
* @return worker address
*/
public String getAddress() {
return this.node.getName();
this.cpuUsage = cpuUsage;
this.computingUnits = computingUnits;
this.ip = ip;
this.communicationCost = communicationCost;
}
/**
......@@ -90,6 +99,70 @@ public class Worker extends DataClayObject {
this.active = active;
}
/**
* Get current cpu usage of worker
* @return float cpuUsage
*/
public float getCpuUsage() {
return cpuUsage;
}
/**
* Set current cpu usage of worker
* @param cpuUsage float
*/
public void setCpuUsage(final float cpuUsage) {
this.cpuUsage = cpuUsage;
}
/**
* Get current number of computing units of worker
* @return int computingUnits
*/
public float getComputingUnits() {
return computingUnits;
}
/**
* Set current number of computing units of worker
* @param computingUnits int
*/
public void setComputingUnits(final int computingUnits) {
this.computingUnits = computingUnits;
}
/**
* Get IP of worker
* @return String ip
*/
public String getIp() {
return ip;
}
/**
* Set IP of worker
* @param ip String
*/
public void setIp(final String ip) {
this.ip = ip;
}
/**
* Get communication cost of worker
* @return float communicationCost
*/
public float getCommunicationCost() {
return communicationCost;
}
/**
* Set communication cost of worker
* @param communicationCost float
*/
public void setCommunicationCost(final float communicationCost) {
this.communicationCost = communicationCost;
}
/**
* Get application that worker is executing
* @return list of all applications
......@@ -108,7 +181,7 @@ public class Worker extends DataClayObject {
@Override
public String toString() {
return " worker { pid = " + pid + " , address = " + getAddress() + ", node = " + node.toString() + ", application = "
return " worker { pid = " + pid + " , address = " + getIp() + ", node = " + node.toString() + ", application = "
+ app.getName() + "}";
}
......
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