Commit 6e35e66b authored by Daniel Seybold's avatar Daniel Seybold

refactored tsbs worklaod task

parent e1e80b23
Pipeline #81241 passed with stage
in 19 minutes and 9 seconds
......@@ -22,6 +22,7 @@ import de.uulm.omi.evaluation.task.InitRun;
import de.uulm.omi.evaluation.task.Plotting;
import de.uulm.omi.evaluation.task.Plotting.PlottingTask;
import de.uulm.omi.evaluation.task.TSBSWorkload;
import de.uulm.omi.evaluation.task.TSBSWorkload.TSBS_PHASE;
import org.jeasy.flows.engine.WorkFlowEngine;
import org.jeasy.flows.work.WorkReport;
import org.jeasy.flows.workflow.SequentialFlow;
......@@ -60,10 +61,22 @@ public class PerformanceTSBSScenario extends EvaluationScenario {
CheckDeployment checkDeployment = new CheckDeployment(this.evaluationContext, this.dbmsClusterContext);
//TODO: check for refactoring into load and query phase
TSBSWorkload tsbsWorkload = new TSBSWorkload(this.evaluationContext, this.dbmsClusterContext,
TSBSWorkload generateTSBSData = new TSBSWorkload(this.evaluationContext, this.dbmsClusterContext,
this.performanceTSBS.getWorkload(), this.performanceTSBS.getWorkloadNetwork(), this.workloadPhaseContext,
performanceTSBS.getWorkloadInstances());
performanceTSBS.getWorkloadInstances(), TSBS_PHASE.GENERATE_DATA);
TSBSWorkload loadTSBSData = new TSBSWorkload(this.evaluationContext, this.dbmsClusterContext,
this.performanceTSBS.getWorkload(), this.performanceTSBS.getWorkloadNetwork(), this.workloadPhaseContext,
performanceTSBS.getWorkloadInstances(), TSBS_PHASE.LOAD_DATA);
TSBSWorkload generateTSBSQueires = new TSBSWorkload(this.evaluationContext, this.dbmsClusterContext,
this.performanceTSBS.getWorkload(), this.performanceTSBS.getWorkloadNetwork(), this.workloadPhaseContext,
performanceTSBS.getWorkloadInstances(), TSBS_PHASE.GENERATE_QUERIES);
TSBSWorkload executeTSBSQueires = new TSBSWorkload(this.evaluationContext, this.dbmsClusterContext,
this.performanceTSBS.getWorkload(), this.performanceTSBS.getWorkloadNetwork(), this.workloadPhaseContext,
performanceTSBS.getWorkloadInstances(), TSBS_PHASE.EXECUTE_QUERIES);
CheckWorkload checkWorkload = new CheckWorkload(this.evaluationContext, this.workloadPhaseContext,
......@@ -100,7 +113,13 @@ public class PerformanceTSBSScenario extends EvaluationScenario {
.execute(initRun)
.execute(deployDB)
.execute(checkDeployment)
.execute(tsbsWorkload)
.execute(generateTSBSData)
.execute(checkWorkload)
.execute(loadTSBSData)
.execute(checkWorkload)
.execute(generateTSBSQueires)
.execute(checkWorkload)
.execute(executeTSBSQueires)
.execute(checkWorkload)
.execute(fetchTSBSResultLoad)
.execute(fetchTSBSResultQuery)
......
......@@ -24,23 +24,32 @@ import org.jeasy.flows.work.WorkStatus;
*/
public class TSBSWorkload extends EvaluationTask {
public enum TSBS_PHASE{
GENERATE_DATA,
LOAD_DATA,
GENERATE_QUERIES,
EXECUTE_QUERIES
}
private final de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSWorkload tsbsWorkload;
private final EvaluationNetwork network;
private final ClusterContext clusterContext;
private final WorkloadPhaseContext workloadPhaseContext;
private final List<String> workloadInstances;
private final TSBS_PHASE tsbs_phase;
private String loggerPrefix = "";
public TSBSWorkload(EvaluationContext evaluationContext, ClusterContext clusterContext,
de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSWorkload tsbsWorkload, EvaluationNetwork network,
WorkloadPhaseContext workloadPhaseContext, List<String> workloadInstances) {
WorkloadPhaseContext workloadPhaseContext, List<String> workloadInstances, TSBS_PHASE tsbs_phase) {
super(TaskType.YCSB_LOAD, evaluationContext);
this.tsbsWorkload = tsbsWorkload;
this.network = network;
this.clusterContext = clusterContext;
this.workloadPhaseContext = workloadPhaseContext;
this.workloadInstances = workloadInstances;
this.tsbs_phase = tsbs_phase;
}
......@@ -77,16 +86,41 @@ public class TSBSWorkload extends EvaluationTask {
int instanceCounter = 0;
if(workloadClients.size()>1){
LOGGER.warn("Using more than 1 workload-api instance for TSBS is currently not supported!");
return new DefaultWorkReport(WorkStatus.FAILED);
}
for (DefaultApi workloadClient: workloadClients) {
writeWorkloadSpec(instanceCounter, TRANSACTION_SPEC);
WorkloadProcessInstance result = workloadClient.workloadTsbsPost(workloadTask ,tsbsWorkload);
WorkloadProcessInstance result;
for (DefaultApi workloadClient: workloadClients) {
switch (this.tsbs_phase){
case GENERATE_DATA:
writeWorkloadSpec(instanceCounter, TRANSACTION_SPEC);
result = workloadClient.workloadTsbsGenerateDataPost(workloadTask ,tsbsWorkload);
LOGGER.debug(loggerPrefix + this.tsbs_phase.toString() + " Phase status: " + result.getProcessStatus().getValue());
this.workloadPhaseContext.setProcessState(result.getProcessStatus().getValue());
break;
case LOAD_DATA:
result = workloadClient.workloadTsbsLoadDataPost(workloadTask ,tsbsWorkload);
LOGGER.debug(loggerPrefix + this.tsbs_phase.toString() + " Phase status: " + result.getProcessStatus().getValue());
this.workloadPhaseContext.setProcessState(result.getProcessStatus().getValue());
break;
case GENERATE_QUERIES:
result = workloadClient.workloadTsbsGenerateQueriesPost(workloadTask ,tsbsWorkload);
LOGGER.debug(loggerPrefix + this.tsbs_phase.toString() + " Phase status: " + result.getProcessStatus().getValue());
this.workloadPhaseContext.setProcessState(result.getProcessStatus().getValue());
break;
case EXECUTE_QUERIES:
result = workloadClient.workloadTsbsExecuteQueriesPost(workloadTask ,tsbsWorkload);
LOGGER.debug(loggerPrefix + this.tsbs_phase.toString() + " Phase status: " + result.getProcessStatus().getValue());
this.workloadPhaseContext.setProcessState(result.getProcessStatus().getValue());
break;
}
//TODO: refactor to a list of workloadPhase states
LOGGER.debug(loggerPrefix + "Status: " + result.getProcessStatus().getValue());
this.workloadPhaseContext.setProcessState(result.getProcessStatus().getValue());
instanceCounter++;
......
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