Commit bd77ffdb authored by Unai's avatar Unai 🇵🇲

Some modifications to ease integration implementation

parent c9f304fa
......@@ -2,3 +2,6 @@ target
/bin/
/.classpath
/.project
.idea/
stubs.jar
stubs/
#!/bin/bash
USER=DemoUser
PASS=DemoPass
PATH=$PATH:/home/unai/WORK/dataclay/bin/entrypoints
export DATACLAYCLIENTCONFIG=/home/unai/WORK/dataclay/bin/cfgfiles/client.properties
export DATACLAYGLOBALCONFIG=/home/unai/WORK/dataclay/bin/cfgfiles/global.properties
export DATACLAYSESSIONCONFIG=/home/unai/WORK/dataclay/bin/cfgfiles/session.properties
export DATACLAY_JAR=/home/unai/WORK/dataclay/bin/dataclay.jar
docker-compose -f ../dataclay/docker-compose.yml down && docker-compose -f ../dataclay/docker-compose.yml up -d
rm -rf stubs*
mkdir stubs
mvn clean package
dataclaycmd WaitForDataClayToBeAlive 10 5
DATACLAY_ALIVE=$?
if [ "${DATACLAY_ALIVE}" != 0 ]; then
exit "${DATACLAY_ALIVE}"
fi
dataclaycmd NewAccount ${USER} ${PASS}
dataclaycmd NewDataContract ${USER} ${PASS} DemoDS ${USER}
dataclaycmd NewModel ${USER} ${PASS} DemoNS target/classes java
dataclaycmd GetStubs ${USER} ${PASS} DemoNS stubs
jar cvf stubs.jar -C stubs .
mvn install:install-file -Dfile=stubs.jar -DgroupId=es.bsc.compss -DartifactId=nfrtool-dataclay-stubs -Dversion=1.0 -Dpackaging=jar -DcreateChecksum=true
package model;
package es.bsc.compss.nfr.model;
import java.util.ArrayList;
/** This class simulates an ELASTIC application using COMPSs. Objects instantiated by this class can be
* distributed and synchronized among nodes. */
public class Application {
public class COMPSsApplication {
/** Application name. */
/** 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 master process. */
/** COMPSsApplication master process. */
private Master master;
/** Application workers. */
/** COMPSsApplication workers. */
private ArrayList<Worker> workers = new ArrayList<>();
/**
* Application constructor.
* COMPSsApplication constructor.
* @param appName Name of the application
*/
public Application(final String appName) {
public COMPSsApplication(final String appName, final String uuid) {
this.name = appName;
this.uuid = uuid;
}
/**
* Set application master.
* @param themaster Application's master node
* @param themaster COMPSsApplication's master node
*/
public void setMaster(final Master themaster) {
this.master = themaster;
......@@ -42,7 +46,7 @@ public class Application {
/**
* Get application master.
* @return Application master
* @return COMPSsApplication master
*/
public Master getMaster() {
return this.master;
......@@ -50,7 +54,7 @@ public class Application {
/**
* Get application workers.
* @return Application workers
* @return COMPSsApplication workers
*/
public ArrayList<Worker> getWorkers() {
return this.workers;
......@@ -58,7 +62,7 @@ public class Application {
/**
* Get active workers only.
* @return Application active workers
* @return COMPSsApplication active workers
*/
public ArrayList<Worker> getActiveWorkers() {
ArrayList<Worker> activeWorkers = new ArrayList<>();
......@@ -77,10 +81,18 @@ public class Application {
public String getName() {
return this.name;
}
@Override
/**
* Get application UUID
* @return uuid
*/
public String getUuid() {
return this.uuid;
}
@Override
public String toString() {
String result = "Application: " + name + " \n";
String result = "COMPSsApplication: " + name + " \n";
result += " - master: " + master.toString() + "\n";
result += " - workers: " + workers + "\n";
result += " - active workers: " + getActiveWorkers() + "\n";
......
package model;
package es.bsc.compss.nfr.model;
import java.util.ArrayList;
import java.util.stream.Collectors;
......@@ -6,12 +6,12 @@ import java.util.stream.Collectors;
/** This class simulates an ELASTIC system composed of many applications and nodes using COMPSs. Objects instantiated by this class can be
* distributed and synchronized among nodes. */
public class ElasticSystem {
/** List of nodes in the system. */
/** List of nodes in the system. */
private ArrayList<Node> nodes;
/** Applications in the system. */
private ArrayList<Application> apps;
private ArrayList<COMPSsApplication> apps;
/**
* System constructor empty.
......@@ -27,7 +27,7 @@ public class ElasticSystem {
* @param apps List of applications
* @param nodes List of nodes
*/
public ElasticSystem(final ArrayList<Application> apps, final ArrayList<Node> nodes) {
public ElasticSystem(final ArrayList<COMPSsApplication> apps, final ArrayList<Node> nodes) {
this.apps = new ArrayList<>(apps);
this.nodes = new ArrayList<>(nodes);
}
......@@ -43,11 +43,20 @@ public class ElasticSystem {
/**
* Add a new application to the system.
* @param app Application to be added
* @param app COMPSsApplication to be added
*/
public void addApplication(final Application app) {
public void addApplication(final COMPSsApplication app) {
apps.add(app);
}
/**
* Remove an existing application. This must be run when the app's execution finishes.
* @param app COMPSsApplication to be removed
* @return true if the list contained the specified application
*/
public boolean removeApplication(final COMPSsApplication app) {
return apps.remove(app);
}
/**
* Get system nodes.
......@@ -61,13 +70,13 @@ public class ElasticSystem {
* Get applications in the system
* @return apps
*/
public ArrayList<Application> getApplications() {
public ArrayList<COMPSsApplication> getApplications() {
return this.apps;
}
@Override
public String toString() {
String result = "Applications: " + apps.stream().map(Application::getName).collect(Collectors.toList()) + " \n";
String result = "Applications: " + apps.stream().map(COMPSsApplication::getName).collect(Collectors.toList()) + " \n";
result += " - nodes: " + nodes.stream().map(Node::getName).collect(Collectors.toList()) + "\n";
return result;
}
......
package model;
package es.bsc.compss.nfr.model;
import es.bsc.dataclay.DataClayObject;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.stream.Collectors;
/**
* This class represents a master process.
......@@ -17,7 +14,7 @@ public class Master extends DataClayObject {
private int pid;
/** Applications executed by this master. */
private Application app;
private COMPSsApplication app;
/**
* Constructor.
......@@ -66,7 +63,7 @@ public class Master extends DataClayObject {
* Get application executed by this master
* @return application executed by the master
*/
public Application getApplication() {
public COMPSsApplication getApplication() {
return app;
}
......@@ -74,7 +71,7 @@ public class Master extends DataClayObject {
* Set application executed by the master
* @param application launched by the master
*/
public void setApplication(final Application app) {
public void setApplication(final COMPSsApplication app) {
this.app = app;
}
......
package model;
package es.bsc.compss.nfr.model;
import es.bsc.dataclay.DataClayObject;
......@@ -12,9 +12,6 @@ public class Node extends DataClayObject {
/** Node name. */
private String name;
/** Node address. */
private String address;
/** Node capacity. */
private int capacity;
......@@ -26,33 +23,14 @@ public class Node extends DataClayObject {
/**
* Constructor.
* @param name Node name
* @param nodeAddress Node address.
* @param name Node name, which can be either the IP or the hostname
* @param nodeCapacity Node capacity.
*/
public Node(final String name, final String nodeAddress, final int nodeCapacity) {
public Node(final String name, final int nodeCapacity) {
this.name = name;
this.address = nodeAddress;
this.capacity = nodeCapacity;
}
/**
* Get the address of the node
* @return node address
*/
public String getAddress() {
return address;
}
/**
* Set node address
* @param address the address to set
*/
public void setAddress(String address) {
this.address = address;
}
/**
* Get capacity of the node
* @return node capacity
......@@ -120,7 +98,7 @@ public class Node extends DataClayObject {
@Override
public String toString() {
return " [ name = " + name + " , machine-address = " + address + " , capacity = " + capacity + " ]";
return " [ name = " + name + " , capacity = " + capacity + " ]";
}
}
package model;
package es.bsc.compss.nfr.model;
import es.bsc.dataclay.DataClayObject;
import java.util.ArrayList;
import java.util.stream.Collectors;
/**
* This class represents a worker process.
......@@ -12,28 +10,23 @@ public class Worker extends DataClayObject {
/** Node containing the process. */
private Node node;
/** Worker process address. */
private String address;
/** Worker process PID. */
private int pid;
/** Boolean showing if worker is running applications. */
private boolean active;
/** Application this worker is executing. */
private Application app;
/** COMPSsApplication this worker is executing. */
private COMPSsApplication app;
/**
* Constructor.
* @param node Node containing the process.
* @param address Worker process address.
* @param node Node containing the process
* @param pid Worker process PID
*/
public Worker(final Node node, final String address, final int pid, final boolean active) {
public Worker(final Node node, final int pid, final boolean active) {
this.node = node;
this.address = address;
this.pid = pid;
this.active = active;
}
......@@ -43,15 +36,7 @@ public class Worker extends DataClayObject {
* @return worker address
*/
public String getAddress() {
return address;
}
/**
* Set worker address
* @param address the worker address to set
*/
public void setAddress(String address) {
this.address = address;
return this.node.getName();
}
/**
......@@ -107,7 +92,7 @@ public class Worker extends DataClayObject {
* Get application that worker is executing
* @return list of all applications
*/
public Application getApplication() {
public COMPSsApplication getApplication() {
return app;
}
......@@ -115,13 +100,13 @@ public class Worker extends DataClayObject {
* Sets an application to the worker
* @param app new application that this worker is executing
*/
public void setApplication(final Application app) {
public void setApplication(final COMPSsApplication app) {
this.app = app;
}
@Override
public String toString() {
return " worker { pid = " + pid + " , address = " + address + ", node = " + node.toString() + ", application = "
return " worker { pid = " + pid + " , address = " + getAddress() + ", 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