Skip to content
Snippets Groups Projects
Commit 35435c4d authored by Nikolaus Huber's avatar Nikolaus Huber
Browse files

increasing prediction servers in BY resource landscape works

git-svn-id: https://se1.informatik.uni-wuerzburg.de/usvn/svn/code/code/DMM/trunk@11135 9e42b895-fcda-4063-8a3b-11be15eb1bbd
parent 1529c445
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,19 @@ ...@@ -2,10 +2,19 @@
#adaptationProcessModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/StaRepository.xmi #adaptationProcessModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/StaRepository.xmi
#performanceDataRepositoryModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/PerformanceDataRepositoryDummy.xmi #performanceDataRepositoryModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/PerformanceDataRepositoryDummy.xmi
#maxIterations=2 #maxIterations=2
## The list of triggering events can be found in AdaptationControl.java
#event=
processName=SEAMS_PushPull-v1 #processName=SEAMS_PushPull-v1
adaptationProcessModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/SEAMS_Case_Study/PushPullAdaptationProcess.xmi #adaptationProcessModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/SEAMS_Case_Study/PushPullAdaptationProcess.xmi
performanceDataRepositoryModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/SEAMS_Case_Study/PerformanceDataRepositoryDummy.xmi #performanceDataRepositoryModel=/Users/nhuber/Documents/workspace/descartes/metamodel/edu.kit.ipd.descartes.adaptation.test/test_models/SEAMS_Case_Study/PerformanceDataRepositoryDummy.xmi
#maxIterations=2
## The list of triggering events can be found in AdaptationControl.java
#event=SlaViolatedEvent
processName=BlueYonderTestAdaptationProcess
adaptationProcessModel=/Users/nhuber/Documents/workspace/descartes/runtime-EclipseApplication/by_dmm-model/testprocess.adaptation
performanceDataRepositoryModel=../edu.kit.ipd.descartes.adaptation.test/test_models/SEAMS_Case_Study/PerformanceDataRepositoryDummy.xmi
maxIterations=1 maxIterations=1
# The triggering event can either be SlaViolation or scheduledMaintenance ## The list of triggering events can be found in AdaptationControl.java
event=SlaViolation event=BottleneckFoundEvent
\ No newline at end of file \ No newline at end of file
...@@ -30,7 +30,8 @@ public class AdaptationControl { ...@@ -30,7 +30,8 @@ public class AdaptationControl {
public enum EventType { public enum EventType {
SLA_VIOLATION ("SlaViolatedEvent", "12345"), SLA_VIOLATION ("SlaViolatedEvent", "12345"),
SCHEDULED_MAINTENANCE ("scheduledMaintenanceEvent", "_H_MTgIAnEeKW2vVcg5ekRw"); SCHEDULED_MAINTENANCE ("ScheduledMaintenanceEvent", "_H_MTgIAnEeKW2vVcg5ekRw"),
BOTTLENECK_FOUND ("BottleneckFoundEvent", "_VvZEwKEoEeKDl52Xojo4CQ");
private final String name; private final String name;
private final String id; private final String id;
...@@ -39,6 +40,13 @@ public class AdaptationControl { ...@@ -39,6 +40,13 @@ public class AdaptationControl {
this.name = name; this.name = name;
this.id = id; this.id = id;
} }
public static EventType getEventType(String eventTypeName) {
if (eventTypeName.equals(SLA_VIOLATION.name)) return SLA_VIOLATION;
if (eventTypeName.equals(SCHEDULED_MAINTENANCE.name)) return SCHEDULED_MAINTENANCE;
if (eventTypeName.equals(BOTTLENECK_FOUND.name)) return BOTTLENECK_FOUND;
return null;
}
} }
private static final String DEFAULT_PROP_FILE_PATH = "./default.properties"; private static final String DEFAULT_PROP_FILE_PATH = "./default.properties";
...@@ -73,7 +81,7 @@ public class AdaptationControl { ...@@ -73,7 +81,7 @@ public class AdaptationControl {
*/ */
public static void main(String[] args) throws IOException { public static void main(String[] args) throws IOException {
BasicConfigurator.configure(); BasicConfigurator.configure();
Logger.getRootLogger().setLevel(Level.INFO); Logger.getRootLogger().setLevel(Level.DEBUG);
AdaptationControl adaptationController = new AdaptationControl(); AdaptationControl adaptationController = new AdaptationControl();
// Initialize controller (load models, create Action handler, etc.) // Initialize controller (load models, create Action handler, etc.)
...@@ -100,9 +108,9 @@ public class AdaptationControl { ...@@ -100,9 +108,9 @@ public class AdaptationControl {
} }
} }
// Creates an "artifical event". Will be replaced later when integrated in the system
private Event createTriggeringEvent() { private Event createTriggeringEvent() {
// Create an "artifical event" EventType type = EventType.getEventType(eventType);
EventType type = eventType.equals("SlaViolation") ? EventType.SLA_VIOLATION : EventType.SCHEDULED_MAINTENANCE;
Event triggeringEvent = AdaptationFactory.eINSTANCE.createEvent(); Event triggeringEvent = AdaptationFactory.eINSTANCE.createEvent();
triggeringEvent.setName(type.name); triggeringEvent.setName(type.name);
...@@ -156,6 +164,14 @@ public class AdaptationControl { ...@@ -156,6 +164,14 @@ public class AdaptationControl {
// Caluclate the new weight of the tactic // Caluclate the new weight of the tactic
wFunction = new WeightedSumCalculator(function); wFunction = new WeightedSumCalculator(function);
wFunction.updateWeight(tactic); wFunction.updateWeight(tactic);
//save results
try {
logger.debug("Saving tactics evaluation results...");
adaptationProcessModelManager.saveAll();
} catch (IOException e) {
logger.error("Error while persisting evaluation results.", e);
}
} }
private void processResults(WeightedTactic tactic) { private void processResults(WeightedTactic tactic) {
...@@ -189,6 +205,8 @@ public class AdaptationControl { ...@@ -189,6 +205,8 @@ public class AdaptationControl {
String eventName = triggeringEvent.getName(); String eventName = triggeringEvent.getName();
String eventId = triggeringEvent.getId(); String eventId = triggeringEvent.getId();
logger.debug("Caught event: " + eventName + " (ID: " + eventId + ")");
for (Strategy strategy : staRepo.getStrategies()) { for (Strategy strategy : staRepo.getStrategies()) {
if (strategy.getTriggeringEvents().getId().equals(eventId) if (strategy.getTriggeringEvents().getId().equals(eventId)
......
...@@ -6,6 +6,7 @@ import org.apache.log4j.Logger; ...@@ -6,6 +6,7 @@ import org.apache.log4j.Logger;
import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EObject;
import edu.kit.ipd.descartes.adaptation.exceptions.InvalidAdaptationPlan;
import edu.kit.ipd.descartes.adaptation.exceptions.OperationNotPerformedException; import edu.kit.ipd.descartes.adaptation.exceptions.OperationNotPerformedException;
import edu.kit.ipd.descartes.adaptation.model.dmm.util.OclEvaluationHelper; import edu.kit.ipd.descartes.adaptation.model.dmm.util.OclEvaluationHelper;
import edu.kit.ipd.descartes.mm.adaptation.AbstractControlFlowElement; import edu.kit.ipd.descartes.mm.adaptation.AbstractControlFlowElement;
...@@ -43,13 +44,16 @@ public class TacticExecutor { ...@@ -43,13 +44,16 @@ public class TacticExecutor {
*/ */
private void executeAdaptationPlan(AdaptationPlan plan) throws OperationNotPerformedException { private void executeAdaptationPlan(AdaptationPlan plan) throws OperationNotPerformedException {
StartAction start = null; StartAction start = findStartAction(plan);
start = findStartAction(plan);
if (start == null) if (start == null)
throw new OperationNotPerformedException("No start action for adaptation plan " + plan.getName() + " found."); throw new OperationNotPerformedException("No start action for adaptation plan " + plan.getName() + " found.");
logger.info("Executing the adaptation plan <<" + plan.getName() + ">>."); logger.info("Executing the adaptation plan <<" + plan.getName() + ">>.");
executeNextStep(start.getSuccessor()); try {
executeNextStep(start.getSuccessor());
} catch (InvalidAdaptationPlan e) {
logger.error("Invalid adaptation plan <<" + plan.getName() + ">> when executing action with ID <<" + start.getId() + ">>.", e);
}
logger.info("Adaptation plan of adaptation plan <<" + plan.getName() + ">> terminated."); logger.info("Adaptation plan of adaptation plan <<" + plan.getName() + ">> terminated.");
} }
...@@ -64,25 +68,20 @@ public class TacticExecutor { ...@@ -64,25 +68,20 @@ public class TacticExecutor {
} }
private void executeNextStep(AbstractControlFlowElement step) private void executeNextStep(AbstractControlFlowElement step)
throws OperationNotPerformedException { throws OperationNotPerformedException, InvalidAdaptationPlan {
if (step == null)
throw new InvalidAdaptationPlan("Current AbstractControlFlowElement is null!");
if (step instanceof StopAction) { if (step instanceof StopAction) {
return; return;
} else } else if (step instanceof BranchAction) {
if (step instanceof BranchAction) {
executeBranchAction(step); executeBranchAction(step);
} else } else if (step instanceof LoopAction) {
if (step instanceof LoopAction) {
execLoopAction(step); execLoopAction(step);
} else } else if (step instanceof ActionReference) {
if (step instanceof ActionReference) {
executeReferredAction(step); executeReferredAction(step);
} } else // Handle invalid actions and control flow elements
// Handle invalid actions and control flow elements
else
throw new OperationNotPerformedException( throw new OperationNotPerformedException(
"No valid control flow element " + step.toString()); "No valid control flow element " + step.toString());
......
package edu.kit.ipd.descartes.adaptation.exceptions;
public class InvalidAdaptationPlan extends Exception {
public InvalidAdaptationPlan(String message) {
super(message);
}
/**
*
*/
private static final long serialVersionUID = 963013704332157870L;
}
...@@ -31,17 +31,17 @@ import edu.kit.ipd.descartes.mm.resourcelandscape.RuntimeEnvironment; ...@@ -31,17 +31,17 @@ import edu.kit.ipd.descartes.mm.resourcelandscape.RuntimeEnvironment;
public class DmmModelActionHandler implements IActionHandler { public class DmmModelActionHandler implements IActionHandler {
static Logger logger = Logger.getLogger(DmmModelActionHandler.class); static Logger logger = Logger.getLogger(DmmModelActionHandler.class);
private AdaptationProcessModelManager dmmModelResourceLoader; private AdaptationProcessModelManager adaptProcessModelMgr;
public DmmModelActionHandler() { public DmmModelActionHandler() {
dmmModelResourceLoader = AdaptationProcessModelManager.getInstance(); adaptProcessModelMgr = AdaptationProcessModelManager.getInstance();
logger.info("DMM Models loaded."); logger.info("DMM Models loaded.");
} }
private void saveModels() { private void saveModels() {
try { try {
dmmModelResourceLoader.saveAll(); adaptProcessModelMgr.saveAll();
} catch (IOException e) { } catch (IOException e) {
logger.error("Error while saving models", e); logger.error("Error while saving models", e);
} }
...@@ -191,6 +191,10 @@ public class DmmModelActionHandler implements IActionHandler { ...@@ -191,6 +191,10 @@ public class DmmModelActionHandler implements IActionHandler {
targetContainer.getContains().add(migratedEntity); targetContainer.getContains().add(migratedEntity);
parent.getContains().remove(migratedEntity); parent.getContains().remove(migratedEntity);
break; break;
case ContainerrepositoryPackage.CONTAINER_TEMPLATE:
logger.debug("Migration a container referring to container template " + adaptableEntity);
//TODO: Implement ContainerTemplate Migration
break;
default: default:
throw new IllegalArgumentException("No implemented migrate operation for " + adaptableEntity); throw new IllegalArgumentException("No implemented migrate operation for " + adaptableEntity);
} }
......
...@@ -40,7 +40,7 @@ public class WeightedSumCalculator implements IWeightingFunctionCalculator { ...@@ -40,7 +40,7 @@ public class WeightedSumCalculator implements IWeightingFunctionCalculator {
afterMetricValue.getMetricType()); afterMetricValue.getMetricType());
if (Double.isNaN(weightOfMetric)) if (Double.isNaN(weightOfMetric))
logger.error("No weight found for metric type: " + afterMetricValue.getMetricType().getName()); logger.info("No weight found for metric type: " + afterMetricValue.getMetricType().getName() + ", skipping...");
else { else {
// add it // add it
newWeight += weightOfMetric * delta; newWeight += weightOfMetric * delta;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment