Commit 08bcbcf3 authored by dgasull's avatar dgasull

Merge branch 'new-attribute' into 'master'

Added deactivationReasons attribute and its respective methods in Worker.

See merge request !1
parents 32ad7cdc fa24fa88
...@@ -13,34 +13,35 @@ Registered model has the following representation: ...@@ -13,34 +13,35 @@ Registered model has the following representation:
| Master | | Master |
| | | |
+-------------------------+ +---------------------+ +-------------------------+ +---------------------+
| |1 1| | +--------------------------+ | |1 1| | +--------------------------+
| COMPSsApplication +<------>+ - int PID | | | | COMPSsApplication +<------>+ - int PID | | |
| | | - String IP |* 1| Node | | | | - String IP |* 1| Node |
+-------------------------+ | +<------------->+ | +-------------------------+ | +<------------------>+ |
| | +---------------------+ +--------------------------+ +---------------------+ | | +---------------------+ +--------------------------+ +---------------------+
| - String name | | | | | | - String name | | | | |
| - String uuid |1 *+---------------------------+ | - String ipWifi | | CommunicationLink | | - String uuid | +-------------------------------------+ | - String ipWifi | | CommunicationLink |
| - boolean isSecure +<------>+ |* 1| - String ipEth |* *| | | - boolean isSecure |1 *| |* 1| - String ipEth |* *| |
| - String infoNature | | Worker +---------+ - String ipLte +<----------->+---------------------+ | - String infoNature +<--->+ Worker +-------+ - String ipLte +<----------->+---------------------+
| - int monitoringPeriod | | | | - float signalWifi | | | | - int monitoringPeriod | | | | - float signalWifi | | |
| | +---------------------------+ | - float energyThreshold | | - String IPNode1 | | | +-------------------------------------+ | - float energyThreshold | | - String IPNode1 |
+-------------------------+ | | | - float cpuThreshold | | - String IPNode2 | +-------------------------+ | | | - float cpuThreshold | | - String IPNode2 |
^* | - int PID | | - int numCores | | - float delayRTT | ^* | - int PID | | - int numCores | | - float delayRTT |
| | - boolean active | | | | - float PLR | | | - boolean active | | | | - float PLR |
| | - float cpuUsage | +--------------------------+ | | | | - float cpuUsage | +--------------------------+ | |
| | - float energyUsage | ^* +---------------------+ | | - float energyUsage | ^* +---------------------+
| | - int computingUnits | | | | - int computingUnits | |
| | - String ip | | | | - String ip | |
| | - float communicationCost| | | | - float communicationCost | |
| | | | | | - List<String> deactivationReasons | |
|1 +---------------------------+ | | | | |
+---------+---------+ | |1 +-------------------------------------+ |
| | | +---------+---------+ |
| ElasticSystem | | | | |
| | | | ElasticSystem | |
+-------------------+ | | | |
| |1 | +-------------------+ |
| +<----------------------------------------------------------------+ | |1 |
| +<---------------------------------------------------------------------+
+---------+---------+ +---------+---------+
``` ```
......
...@@ -38,6 +38,8 @@ public class Worker extends DataClayObject { ...@@ -38,6 +38,8 @@ public class Worker extends DataClayObject {
/** COMPSsApplication this worker is executing. */ /** COMPSsApplication this worker is executing. */
private COMPSsApplication app; private COMPSsApplication app;
/** Data that represents the reason/s (dimensions) for the deactivation of this worker */
private List<String> deactivationReasons;
/** /**
* Constructor. * Constructor.
...@@ -50,10 +52,11 @@ public class Worker extends DataClayObject { ...@@ -50,10 +52,11 @@ public class Worker extends DataClayObject {
* @param computingUnits Number of computing units used in the worker * @param computingUnits Number of computing units used in the worker
* @param ip IP of the Worker * @param ip IP of the Worker
* @param communicationCost Float representing the communication cost * @param communicationCost Float representing the communication cost
* @param deactivationReasons Reason/s for the deactivation of this worker
*/ */
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 float energyUsage, final int computingUnits, final String ip, final float cpuUsage, final float energyUsage, final int computingUnits, final String ip,
final float communicationCost) { final float communicationCost, final List<String> deactivationReasons) {
this.node = node; this.node = node;
this.pid = pid; this.pid = pid;
this.active = active; this.active = active;
...@@ -64,6 +67,7 @@ public class Worker extends DataClayObject { ...@@ -64,6 +67,7 @@ public class Worker extends DataClayObject {
this.computingUnits = computingUnits; this.computingUnits = computingUnits;
this.ip = ip; this.ip = ip;
this.communicationCost = communicationCost; this.communicationCost = communicationCost;
this.deactivationReasons = deactivationReasons;
} }
/** /**
...@@ -226,6 +230,22 @@ public class Worker extends DataClayObject { ...@@ -226,6 +230,22 @@ public class Worker extends DataClayObject {
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
/**
* Get the reason/s for the deactivation of this worker
* @return dimensions (time, energy, communication or security)
*/
public List<String> getDeactivationReasons() {
return deactivationReasons;
}
/**
* Set the reason/s for the deactivation of this worker
* @param deactivationReason new reason/s for the deactivation of this worker
*/
public void setDeactivationReasons(final List<String> deactivationReasons) {
this.deactivationReasons = deactivationReasons;
}
@Override @Override
public String toString() { public String toString() {
return " worker { pid = " + pid + " , address = " + getIp() + ", node = " + node.toString() + ", application = " return " worker { pid = " + pid + " , address = " + getIp() + ", node = " + node.toString() + ", application = "
......
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