Commit 609e977f authored by esabate's avatar esabate

Method in worker that returns all the communication link that particular...

Method in worker that returns all the communication link that particular worker is present as node 1
parent e4d0e267
version: '3.4'
services:
logicmodule:
image: "bscdataclay/logicmodule:2.1"
image: "bscdataclay/logicmodule:2.4.dev"
ports:
- "11034:11034"
environment:
......@@ -19,7 +19,7 @@ services:
test: ["CMD-SHELL", "/home/dataclayusr/dataclay/health/health_check.sh"]
dsjava:
image: "bscdataclay/dsjava:2.1"
image: "bscdataclay/dsjava:2.4.dev"
ports:
- "2127:2127"
depends_on:
......
......@@ -28,8 +28,12 @@ public class CommunicationLink extends DataClayObject {
/**
* Constructor.
* @param node Node containing the process
* @param pid Worker process PID
* @param node1 Node 1
* @param node2 Node 2
* @param ipNode1 IP for Node 1
* @param ipNode2 IP for Node 2
* @param delayRtt Delay RTT obtained in the communication link
* @param plr Packet loss rate metric obtained in the link
*/
public CommunicationLink(final Node node1, final Node node2, final String ipNode1, final String ipNode2,
final float delayRtt, final float plr) {
......@@ -89,9 +93,6 @@ public class CommunicationLink extends DataClayObject {
*/
public void setPlr(final float plr) { this.plr = plr; }
/** Remove node Node from*/
@Override
public String toString() {
......
......@@ -42,7 +42,9 @@ public class Node extends DataClayObject {
/**
* Constructor.
* @param name Node name, which can be either the IP or the hostname
* @param ipWifi Node name, which can be either the IP or the hostname
* @param ipEth Node name, which can be either the IP or the hostname
* @param ipLte Node name, which can be either the IP or the hostname
* @param cpuThreshold Threshold of the CPU
* @param energyThreshold Energy threshold of the node
*/
......@@ -148,7 +150,7 @@ public class Node extends DataClayObject {
/**
* Set node Wifi signal.
* @param wifiSignal Node wifiSignal to set.
* @param signalWifi Node wifiSignal to set.
*/
public void setSignalWifi(float signalWifi) {
this.signalWifi = signalWifi;
......
......@@ -2,6 +2,10 @@ package es.bsc.compss.nfr.model;
import es.bsc.dataclay.DataClayObject;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* This class represents a worker process.
*/
......@@ -36,6 +40,12 @@ public class Worker extends DataClayObject {
* Constructor.
* @param node Node containing the process
* @param pid Worker process PID
* @param active Boolean representing if worker is used
* @param app COMPSs application
* @param cpuUsage Float representing the CPU percentage used
* @param computingUnits Number of computing units used in the worker
* @param ip IP of the Worker
* @param communicationCost Float representing the communication cost
*/
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) {
......@@ -178,6 +188,22 @@ public class Worker extends DataClayObject {
public void setApplication(final COMPSsApplication app) {
this.app = app;
}
/**
* Get communications links that worker has in a specific application
* @return list of all communications links between this worker and others in a given application
*/
public List<CommunicationLink> getCommunicationLinksForApplication() {
return node.getCommunicationLinks()
.stream()
.filter(c ->
c.getIpNode1().equals(this.ip) &&
app.getWorkers()
.stream()
.filter(w -> !w.getIp().equals(this.ip)).anyMatch(w -> w.getIp().equals(c.getIpNode2()))
)
.collect(Collectors.toList());
}
@Override
public String toString() {
......
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