Commit 50a06882 authored by vgonzale's avatar vgonzale
Browse files

Merge branch 'ppc/new-discovery' of https://gitlab.bsc.es/ppc/software/compss...

Merge branch 'ppc/new-discovery' of https://gitlab.bsc.es/ppc/software/compss into ppc/new-discovery
parents 24ca943d 7a687e4f
......@@ -76,6 +76,8 @@ public class RTHeuristicsScheduler extends TaskScheduler {
private static Gauge respUB =
Gauge.build().name("Rub").help("Response time upper bound (Rub) for each iteration").register();
private static Gauge actualExecTime;
private static Map<String, Gauge> workerMetrics = new HashMap<>();
// startTimes array contains the start time of each task received in order to compute the end time
......@@ -122,6 +124,8 @@ public class RTHeuristicsScheduler extends TaskScheduler {
// used to count if the number of workers that are up and running matches numWorkers
private int count;
private long startTime;
/**
* Constructs a new Paper Scheduler instance.
......@@ -145,6 +149,8 @@ public class RTHeuristicsScheduler extends TaskScheduler {
pg = new PushGateway(RTHeuristicsConfiguration.PROMETHEUS_ENDPOINT);
registry = new CollectorRegistry();
registry.register(deadlines);
registry.register(actualExecTime);
// registry.register(respUB);
String job = "compss";
pg.pushAdd(registry, job);
}
......@@ -215,7 +221,7 @@ public class RTHeuristicsScheduler extends TaskScheduler {
@Override
public <T extends WorkerResourceDescription> RTHeuristicsResourceScheduler<T>
generateSchedulerForResource(Worker<T> w, JSONObject resJSON, JSONObject implJSON) {
LOGGER.debug("[PaperScheduler] Generate scheduler for resource " + w.getName());
LOGGER.debug("[RTHeuristicScheduler] Generate scheduler for resource " + w.getName());
if (RTHeuristicsConfiguration.PROMETHEUS_ACTIVE) {
if (((MethodWorker) w).getId() != null) {
......@@ -367,6 +373,8 @@ public class RTHeuristicsScheduler extends TaskScheduler {
System.out.println("Initializing metrics with name deadlines_missed_" + id);
this.deadlines =
Gauge.build().name("deadlines_missed_" + id).help("Total deadlines missed per workflow").register();
this.actualExecTime =
Gauge.build().name("execution_time_" + id).help("Actual execution time for the workflow").register();
try {
setUpPrometheusConnection();
} catch (Exception e) {
......@@ -380,6 +388,7 @@ public class RTHeuristicsScheduler extends TaskScheduler {
* Increments the task counter.
*/
public void incrementTaskCounter() {
LOGGER.debug("[RTHeuristicsScheduler] Incrementing the deadline missed number.");
deadlines.inc();
updateRegistry();
}
......@@ -392,6 +401,17 @@ public class RTHeuristicsScheduler extends TaskScheduler {
updateRegistry();
}
/**
*
*/
public void setActualExecTime(long execTime) {
actualExecTime.set(execTime - startTime);
updateRegistry();
}
/**
* Pushes the contents of the Gauges registered in the registry to PushGateway.
*/
public void updateRegistry() {
String job = "compss";
try {
......@@ -404,6 +424,9 @@ public class RTHeuristicsScheduler extends TaskScheduler {
@Override
protected void scheduleAction(AllocatableAction action, Score actionScore) throws BlockedActionException {
LOGGER.debug("[RTHeuristicScheduler] Scheduling action " + action);
if (((ExecutionAction) action).getTask().getId() == 1) { // TODO: Added for Rotterdam
startTime = System.currentTimeMillis();
}
if (!noWorkers) {
int id = ((ExecutionAction) action).getTask().getId();
// if (id == 1 || (numTasks != 0 && (((id - 1) % numTasks) + 1) == 1 || notInit)) {
......@@ -574,7 +597,7 @@ public class RTHeuristicsScheduler extends TaskScheduler {
+ predecessor + " " + dp);
}
break; // for a specific parameter only one predecessor,
// so once it has been found stop
// so once it has been found stop -> TODO: check without break
}
}
}
......@@ -660,4 +683,12 @@ public class RTHeuristicsScheduler extends TaskScheduler {
*/
}
@Override
public void shutdown() {
LOGGER.debug("[RTResourceScheduler] Finishing workflow execution, pushing exec time to PushGateway");
long endTime = System.currentTimeMillis();
setActualExecTime(endTime);
super.shutdown();
}
}
Supports Markdown
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