Commit fe21b6ec authored by Rita Sousa's avatar Rita Sousa

Removed dataClay model copy, updated the retrievement of Process IDs using Java 8 and README

parent 3244ba97
Go to /dataclay directory and initialize dataclay
(Start dataClay)
```
./start_dataclay.sh
```
(Register model located in `model` folder into started dataClay instance)
```
./register_model.sh
```
(Get stubs of your registered model)
```
./get_stubs.sh
```
Go to /app directory
(To be able to compile the app outside a container, install the stubs in the local maven repository)
```
./install_mvn_stubs.sh
```
# Pre-requisites
Finnaly, run the demo which includes Time and Energy requirements
- The metrics are measured through perf_event_open so the appropriate package must be installed depending on the environment. You should try to use perf from the command line and see what packages are required and then install them.
More information about perf in:
https://perf.wiki.kernel.org/index.php/Tutorial
http://www.brendangregg.com/perf.html
- Before run NFRTool, check the value in /proc/sys/kernel/perf_event_paranoid and change to -1.
```
./run_nfrtool.sh
cat /proc/sys/kernel/perf_event_paranoid
sudo sysctl -w kernel.perf_event_paranoid=-1
```
OR
Simply run located on /app directory:
# Demo usage
Assuming that the dataClay model has already been started and registered, the stubs have already been obtained and that the stubs have already been installed in the local maven repository, just run the demo, which includes Time and Energy requirements:
```
cd ../dataclay/ ; ./stop_dataclay.sh ; ./clean.sh ; ./start_dataclay.sh ; ./register_model.sh ; ./get_stubs.sh ; cd ../app/ ; ./install_mvn_stubs.sh
./run_nfrtool.sh
```
Warnings:
The Java version has to be greater than 8
See https://docs.oracle.com/javase/9/docs/api/java/lang/Process.html#pid--
The metrics are measured through perf_event_open so the appropriate package must be installed depending on the environment. You should try to use perf from the command line and see what packages are required and then install them.
Before run NFRTool, check the value in /proc/sys/kernel/perf_event_paranoid and change to -1
```
cat /proc/sys/kernel/perf_event_paranoid
sudo sysctl -w kernel.perf_event_paranoid=-1
```
......@@ -18,6 +18,7 @@
package app;
import java.io.IOException;
import java.lang.reflect.Field;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.NetworkInterface;
......@@ -140,20 +141,35 @@ public class NFRTool {
return system;
}
public static synchronized long getPidOfProcess(Process p) {
long pid = -1;
try {
if (p.getClass().getName().equals("java.lang.UNIXProcess")) {
Field f = p.getClass().getDeclaredField("pid");
f.setAccessible(true);
pid = f.getLong(p);
f.setAccessible(false);
}
} catch (Exception e) {
pid = -1;
}
return pid;
}
public static void addWorkersToSystem(ElasticSystem system, String localIP) {
int pid1 = 0, pid2 = 0, pid3 = 0;// , pid4 = 0;
// Execute fake workers to monitor
try {
Process p1 = Runtime.getRuntime().exec("fake_worker/fakeworker1");
pid1 = (int) p1.pid();
pid1 = (int) getPidOfProcess(p1);
Process p2 = Runtime.getRuntime().exec("fake_worker/fakeworker2");
pid2 = (int) p2.pid();
pid2 = (int) getPidOfProcess(p2);
Process p3 = Runtime.getRuntime().exec("fake_worker/fakeworker3");
pid3 = (int) p3.pid();
pid3 = (int) getPidOfProcess(p3);
// Process p4 = Runtime.getRuntime().exec("fake_worker/fakeworker4");
// pid4 = (int) p4.pid();
......
......@@ -70,8 +70,8 @@ public class TimeMonitor implements Runnable {
command[1] = String.valueOf(activeWorkers.getWorkersAddress());
command[2] = String.valueOf(SERVER_TIME_PORT);
// FIXME: Find best way for measure threads with syscall instead of using the script
command[3] = "script"; //To use the script
//command[3] = "syscall"; //To use the system call
//command[3] = "script"; //To use the script
command[3] = "syscall"; //To use the system call
// Start execution of Energy Monitor Probe
Runtime.getRuntime().exec(command);
......
/.project
**/stubs/
**/stubs.jar
FROM bscdataclay/client:2.1
LABEL maintainer dataClay team <support-dataclay@bsc.es>
# Prepare environment
ENV ELASTIC_MODEL_HOME=/elastic
WORKDIR ${ELASTIC_MODEL_HOME}
ENV DATACLAYCLIENTCONFIG=${ELASTIC_MODEL_HOME}/cfgfiles/client.properties
ENV DATACLAYGLOBALCONFIG=${ELASTIC_MODEL_HOME}/cfgfiles/global.properties
ENV DATACLAYSESSIONCONFIG=${ELASTIC_MODEL_HOME}/cfgfiles/session.properties
ENV NAMESPACE=ElasticNS
ENV USER=ElasticUser
ENV PASS=ElasticPass
ENV DATASET=ElasticDS
ENV STUBSPATH=${ELASTIC_MODEL_HOME}/stubs
ENV STUBS_JAR=${ELASTIC_MODEL_HOME}/stubs.jar
ENV MODELBINPATH=${ELASTIC_MODEL_HOME}/model/target/classes
# If we want to run demo again, argument must be modified
ARG CACHEBUST=1
# Copy files
COPY ./model ${ELASTIC_MODEL_HOME}/model
COPY ./cfgfiles ${ELASTIC_MODEL_HOME}/cfgfiles
RUN cp ${ELASTIC_MODEL_HOME}/cfgfiles/log4j2.xml ${DATACLAY_LOG_CONFIG}
# Wait for dataclay to be alive (max retries 10 and 5 seconds per retry)
RUN dataclaycmd WaitForDataClayToBeAlive 10 5
# Register account
RUN dataclaycmd NewAccount ${USER} ${PASS}
# Register datacontract
RUN dataclaycmd NewDataContract ${USER} ${PASS} ${DATASET} ${USER}
# Register model
RUN cd ${ELASTIC_MODEL_HOME}/model && mvn package
RUN dataclaycmd NewModel ${USER} ${PASS} ${NAMESPACE} ${MODELBINPATH} java
# Get stubs
RUN mkdir -p ${STUBSPATH}
RUN dataclaycmd GetStubs ${USER} ${PASS} ${NAMESPACE} ${STUBSPATH}
# Package stubs
RUN jar cvf ${STUBS_JAR} -C ${STUBSPATH} .
# Run
ENTRYPOINT ["Nothing to do here"]
# ELASTIC dataClay
This repository contains docker service definition to deploy dataClay and ELASTIC model to be registered
in dataClay.
You can find dataClay demos at:
https://github.com/bsc-dom/dataclay-demos
## Scripts
Some useful scripts can be found here.
##### START DATACLAY (`start_dataclay.sh`)
Start dataClay before running our demo docker application.
##### REGISTER MODEL (`register_model.sh`)
Register model located in `model` folder into started dataClay instance at host and ports specified in `cfgfiles/client.properties`. This script uses `Dockerfile` to register the model.
##### GET STUBS (`get_stubs.sh`)
Get stubs of your registered model. Make sure you registered your model first.
##### STOP DATACLAY (`stop_dataclay.sh`)
Do a graceful stop of dataClay.
##### OPTIONAL: CLEAN UP (`clean.sh`)
Make sure no dataClay docker services are running and clean volumes.
## Questions?
If you have any questions, please feel free to ask to support-dataclay@bsc.es
![dataClay logo](https://www.bsc.es/sites/default/files/public/styles/bscw2_-_simple_crop_style/public/bscw2/content/software-app/logo/logo_dataclay_web_bsc.jpg)
HOST=logicmodule
TCPPORT=11034
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60" status="off">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_OUT">
<PatternLayout pattern="%d{ISO8601} %p [%c] [%t] [%C{1}:%L] %m%n"></PatternLayout>
</Console>
</Appenders>
<Loggers>
<Logger name="DataClay.api" level="off" />
<!-- Runtime -->
<Logger name="ClientRuntime" level="off" />
<Logger name="ClientManagementLib" level="off"/>
<Logger name="DataClayRuntime" level="off"/>
<Logger name="DataServiceRuntime" level="off"/>
<Logger name="DataClayObjectLoader" level="off"/>
<Logger name="DataClayObject" level="off" /> <!-- This is very verbose! -->
<!-- Data service -->
<Logger name="DataService" level="off"/>
<Logger name="ExecutionEnvironmentSrv" level="off"/>
<!-- Lockers -->
<Logger name="dataclay.util.classloaders.SyncClass" level="off"/>
<Logger name="dataclay.heap.LockerPool" level="off"/>
<Logger name="LockerPool" level="off"/>
<Logger name="dataclay.util.classloaders.ClassLockers" level="off"/>
<!-- Garbage collection -->
<Logger name="GlobalGC" level="off"/>
<Logger name="heap.HeapManager" level="off"/>
<Logger name="ReferenceCounting" level="off"/>
<Logger name="StorageLocation" level="off"/>
<!-- Logic module -->
<Logger name="LogicModule" level="off"/>
<Logger name="LMDB" level="off"/>
<Logger name="managers" level="off" />
<Logger name="MetaDataService.db" level="off" />
<Logger name="MetaDataService" level="off" />
<!-- Communication -->
<Logger name="io.grpc" level="off"/>
<Logger name="io.netty" level="off"/>
<Logger name="NettyClientHandler" level="off"/>
<Logger name="grpc.client" level="off"/>
<Logger name="communication.LogicModule.service" level="off"/>
<Logger name="grpc.client.logicmodule" level="off"/>
<Logger name="grpc.client.dataservice.DS1" level="off"/>
<!-- Databases -->
<Logger name="dataclay.dbhandler" level="off"/>
<Logger name="dbhandler.PostgresConnection" level="off" />
<Logger name="org.apache.commons.dbcp2" level="off"/>
<Logger name="PostgresHandler" level="off"/>
<Logger name="SQLHandler" level="off"/>
<!-- Misc -->
<Logger name="util" level="off" />
<Logger name="exceptions" level="off"/>
<Logger name="Paraver" level="off"/>
<Logger name="DataClaySerializationLib" level="off"/>
<Logger name="DataClayDeserializationLib" level="off"/>
<!-- ROOT LOGGER -->
<Root level="off">
<AppenderRef ref="ConsoleAppender" />
</Root>
</Loggers>
</Configuration>
Account=ElasticUser
Password=ElasticPass
DataSets=ElasticDS
DataSetForStore=ElasticDS
StubsClasspath=./stubs
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
grn=$'\e[1;32m'
blu=$'\e[1;34m'
end=$'\e[0m'
function printError {
echo "${red}======== $1 ========${end}"
}
function printMsg {
echo "${blu}======== $1 ========${end}"
}
printMsg "Removing and cleaning dataClay dockers"
pushd $SCRIPTDIR/dataclay
docker-compose kill
docker-compose down -v #sanity check
popd
printMsg "Cleaned!"
\ No newline at end of file
version: '3.4'
services:
logicmodule:
image: "bscdataclay/logicmodule:2.4.dev"
ports:
- "11034:11034"
environment:
- LOGICMODULE_PORT_TCP=11034
- LOGICMODULE_HOST=logicmodule
- DATACLAY_ADMIN_USER=admin
- DATACLAY_ADMIN_PASSWORD=admin
volumes:
- ./prop/global.properties:/home/dataclayusr/dataclay/cfgfiles/global.properties:ro
- ./prop/log4j2.xml:/home/dataclayusr/dataclay/logging/log4j2.xml:ro
stop_grace_period: 5m
healthcheck:
interval: 5s
retries: 10
test: ["CMD-SHELL", "/home/dataclayusr/dataclay/health/health_check.sh"]
dsjava:
image: "bscdataclay/dsjava:2.4.dev"
ports:
- "2127:2127"
depends_on:
- logicmodule
environment:
- DATASERVICE_NAME=DS1
- DATASERVICE_JAVA_PORT_TCP=2127
- LOGICMODULE_PORT_TCP=11034
- LOGICMODULE_HOST=logicmodule
volumes:
- ./prop/global.properties:/home/dataclayusr/dataclay/cfgfiles/global.properties:ro
- ./prop/log4j2.xml:/home/dataclayusr/dataclay/logging/log4j2.xml:ro
stop_grace_period: 5m
healthcheck:
interval: 5s
retries: 10
test: ["CMD-SHELL", "/home/dataclayusr/dataclay/health/health_check.sh"]
CHECK_LOG4J_ENABLED=false
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<Configuration monitorInterval="60" status="off">
<Appenders>
<Console name="ConsoleAppender" target="SYSTEM_ERR">
<PatternLayout pattern="%d{ISO8601} %p [%c] [%t] [%C{1}:%L] %m%n"></PatternLayout>
</Console>
</Appenders>
<Loggers>
<!-- Runtime -->
<Logger name="ClientRuntime" level="off" />
<Logger name="ClientManagementLib" level="off"/>
<Logger name="DataClayRuntime" level="off"/>
<Logger name="DataServiceRuntime" level="off"/>
<Logger name="DataClayObjectLoader" level="off"/>
<Logger name="DataClayObject" level="off" /> <!-- This is very verbose! -->
<!-- Data service -->
<Logger name="DataService" level="off"/>
<Logger name="DataService.srv" level="off"/>
<Logger name="ExecutionEnvironmentSrv" level="off"/>
<!-- Lockers -->
<Logger name="dataclay.util.classloaders.SyncClass" level="off"/>
<Logger name="dataclay.heap.LockerPool" level="off"/>
<Logger name="LockerPool" level="off"/>
<Logger name="dataclay.util.classloaders.ClassLockers" level="off"/>
<!-- Garbage collection -->
<Logger name="GlobalGC" level="off"/>
<Logger name="heap.HeapManager" level="off"/>
<Logger name="ReferenceCounting" level="off"/>
<Logger name="StorageLocation" level="off"/>
<!-- Logic module -->
<Logger name="LogicModule" level="off"/>
<Logger name="LogicModule.srv" level="off"/>
<Logger name="LMDB" level="off"/>
<Logger name="managers" level="off" />
<Logger name="MetaDataService.db" level="off" />
<Logger name="MetaDataService" level="off" />
<!-- Communication -->
<Logger name="io.grpc" level="off"/>
<Logger name="io.netty" level="off"/>
<Logger name="NettyClientHandler" level="off"/>
<Logger name="grpc.client" level="off"/>
<Logger name="grpc.client.logicmodule" level="off"/>
<Logger name="communication.LogicModule.service" level="off"/>
<!-- Databases -->
<Logger name="dataclay.dbhandler" level="off"/>
<Logger name="dbhandler.PostgresConnection" level="off" />
<Logger name="org.apache.commons.dbcp2" level="off"/>
<Logger name="PostgresHandler" level="off"/>
<Logger name="SQLHandler" level="off"/>
<!-- Misc -->
<Logger name="util" level="off" />
<Logger name="exceptions" level="off"/>
<Logger name="Paraver" level="info"/>
<Logger name="DataClaySerializationLib" level="off"/>
<Logger name="DataClayDeserializationLib" level="off"/>
<!-- ROOT LOGGER -->
<Root level="off">
<AppenderRef ref="ConsoleAppender" />
</Root>
</Loggers>
</Configuration>
#!/bin/bash
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
grn=$'\e[1;32m'
blu=$'\e[1;34m'
red=$'\e[1;91m'
end=$'\e[0m'
function printError {
echo "${red}======== $1 ========${end}"
}
function printMsg {
echo "${blu}======== $1 ========${end}"
}
printMsg "Get stubs"
rm -rf $PWD/stubs
mkdir -p $PWD/stubs/
ID=$(docker create dataclay-elastic-model)
docker cp $ID:/elastic/stubs $PWD
docker rm $ID
echo "$blu
Stubs stored at $PWD/stubs/ directory
Congratulations! Now you can use stubs folder in your application CLASSPATH or create a jar. Also
use $PWD/cfgfiles/session.properties in your application.
Remember to modify StubsClasspath variable in session.properties file. $end
"
\ No newline at end of file
<factorypath>
<factorypathentry kind="VARJAR" id="M2_REPO/es/bsc/dataclay/dataclay/2.1/dataclay-2.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/javax/annotation/javax.annotation-api/1.3.2/javax.annotation-api-1.3.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-netty-shaded/1.25.0/grpc-netty-shaded-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-core/1.25.0/grpc-core-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/android/annotations/4.1.1.4/annotations-4.1.1.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/perfmark/perfmark-api/0.19.0/perfmark-api-0.19.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/opencensus/opencensus-api/0.21.0/opencensus-api-0.21.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/opencensus/opencensus-contrib-grpc-metrics/0.21.0/opencensus-contrib-grpc-metrics-0.21.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-protobuf/1.25.0/grpc-protobuf-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-api/1.25.0/grpc-api-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-context/1.25.0/grpc-context-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/errorprone/error_prone_annotations/2.3.3/error_prone_annotations-2.3.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/codehaus/mojo/animal-sniffer-annotations/1.17/animal-sniffer-annotations-1.17.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/protobuf/protobuf-java/3.10.0/protobuf-java-3.10.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/guava/28.1-android/guava-28.1-android.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/checkerframework/checker-compat-qual/2.5.5/checker-compat-qual-2.5.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/j2objc/j2objc-annotations/1.3/j2objc-annotations-1.3.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/google/api/grpc/proto-google-common-protos/1.12.0/proto-google-common-protos-1.12.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-protobuf-lite/1.25.0/grpc-protobuf-lite-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/io/grpc/grpc-stub/1.25.0/grpc-stub-1.25.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/postgresql/postgresql/9.4.1212/postgresql-9.4.1212.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm/7.2/asm-7.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm-commons/7.2/asm-commons-7.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm-analysis/7.2/asm-analysis-7.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm-tree/7.2/asm-tree-7.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/ow2/asm/asm-util/7.2/asm-util-7.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-api/2.11.0/log4j-api-2.11.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/logging/log4j/log4j-core/2.11.0/log4j-core-2.11.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/json/json/20170516/json-20170516.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-databind/2.10.0/jackson-databind-2.10.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-annotations/2.10.0/jackson-annotations-2.10.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/fasterxml/jackson/core/jackson-core/2.10.0/jackson-core-2.10.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-io/commons-io/2.5/commons-io-2.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/yaml/snakeyaml/1.25/snakeyaml-1.25.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-dbcp2/2.1.1/commons-dbcp2-2.1.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/commons/commons-pool2/2.4.2/commons-pool2-2.4.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/commons-logging/commons-logging/1.2/commons-logging-1.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/xerial/sqlite-jdbc/3.21.0.1/sqlite-jdbc-3.21.0.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/javax/persistence/javax.persistence-api/2.2/javax.persistence-api-2.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjrt/1.9.4/aspectjrt-1.9.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/aspectj/aspectjtools/1.9.4/aspectjtools-1.9.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/es/bsc/dataclay/extrae/3.6.1/extrae-3.6.1.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/reflections/reflections/0.9.11/reflections-0.9.11.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/javassist/javassist/3.21.0-GA/javassist-3.21.0-GA.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.shrike/1.5.0/com.ibm.wala.shrike-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.core/1.5.0/com.ibm.wala.core-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.cast/1.5.0/com.ibm.wala.cast-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.cast.java/1.5.0/com.ibm.wala.cast.java-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.util/1.5.0/com.ibm.wala.util-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/ibm/wala/com.ibm.wala.cast.java.ecj/1.5.0/com.ibm.wala.cast.java.ecj-1.5.0.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/eclipse/jdt/org.eclipse.jdt.core/3.10.0/org.eclipse.jdt.core-3.10.0.jar" enabled="true" runInBatchMode="false"/>
</factorypath>
target
/bin/
/.classpath
/.project
.idea/
stubs.jar
stubs/
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=target/generated-sources/annotations
org.eclipse.jdt.apt.genTestSrcDir=target/generated-test-sources/test-annotations
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
# Introduction
This model is used to communicate the NFR tool with the COMPSs orchestrator. The model defines the Elastic system with its applications and nodes (master and workers). A more detailed view of the model is provided in the next section.
## Model
Registered model has the following representation:
```
+---------------------+
| |
| 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 |
| +<----------------------------------------------------------------+
+---------+---------+
```
## Questions?
If you have any questions, please feel free to ask to support-dataclay@bsc.es
![dataClay logo](https://www.bsc.es/sites/default/files/public/styles/bscw2_-_simple_crop_style/public/bscw2/content/software-app/logo/logo_dataclay_web_bsc.jpg)
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>es.bsc.dataclay</groupId>
<artifactId>nfrtool-dataclay-model</artifactId>
<version>2.0</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.target>8</maven.compiler.target>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.release>8</maven.compiler.release>
</properties>
<dependencies>
<dependency>
<groupId>es.bsc.dataclay</groupId>
<artifactId>dataclay</artifactId>
<version>2.1</version>
</dependency>
</dependencies>
</project>
package es.bsc.compss.nfr.model;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/** This class simulates an ELASTIC application using COMPSs. Objects instantiated by this class can be
* distributed and synchronized among nodes. */
public class COMPSsApplication {
/** COMPSsApplication name. */
private String name;
/** COMPSsApplication UUID (to be able to tell it apart of other workflows with the same name) */
private String uuid;
/** Application security attribute. */
private boolean isSecure = true;
/** 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;
/** COMPSsApplication workers. */
private List<Worker> workers = new ArrayList<>();
/**
* COMPSsApplication constructor.
* @param appName Name of the application
*/
public COMPSsApplication(final String appName, final String uuid, final int monitoringPeriod) {
this.name = appName;
this.uuid = uuid;
this.monitoringPeriod = monitoringPeriod;
}
/**
* Set application master.
* @param themaster COMPSsApplication's master node
*/
public void setMaster(final Master themaster) {
this.master = themaster;
}
/**
* Add a new woker to the application.
* @param worker Worker to be added
*/
public void addWorker(final Worker worker) {
workers.add(worker);
}
/**
* Get application master.
* @return COMPSsApplication master
*/
public Master getMaster() {
return this.master;
}
/**
* Get application workers.
* @return COMPSsApplication workers
*/
public List<Worker> getWorkers() {
return this.workers;
}
// NOTE: This is temporary so I don't need to be constantly cleaning the dataclay.
public void removeWorkers(){
this.workers.removeAll(this.workers);
}
/**
* Get active workers only.
* @return COMPSsApplication active workers
*/
public List<Worker> getActiveWorkers() {
return workers.stream().filter(Worker::isActive).collect(Collectors.toList());
}
/**