Commit 527b97b0 authored by Julia Abramenko's avatar Julia Abramenko

- updated command generation

parent 4011284d
Pipeline #58491 failed with stage
in 9 minutes and 29 seconds
......@@ -167,12 +167,6 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
</dependencies>
<repositories>
<repository>
......
......@@ -102,7 +102,7 @@ public class WorkloadApi {
public Response workloadTsbsLoadPost(@ApiParam(value = "the id of the workload execution task, used as prefix for result files",required=true) @QueryParam("taskId") String taskId
,@ApiParam(value = "the TSBS workload configuration" ,required=true) TSBSLoadWorkload workload
,@Context SecurityContext securityContext)
throws NotFoundException, IOException {
throws NotFoundException, IOException, InterruptedException {
return delegate.workloadTsbsLoadPost(taskId,workload,securityContext);
}
@POST
......
......@@ -27,6 +27,6 @@ public abstract class WorkloadApiService {
public abstract Response workloadResultGet( @NotNull String taskId, @NotNull String workloadType,SecurityContext securityContext) throws NotFoundException;
public abstract Response workloadStatusGet( String applicationInstanceId,SecurityContext securityContext) throws NotFoundException;
public abstract Response workloadTpccPost( @NotNull String taskId,TPCCWorkload workload,SecurityContext securityContext) throws NotFoundException;
public abstract Response workloadTsbsLoadPost( @NotNull String taskId,TSBSLoadWorkload workload,SecurityContext securityContext) throws NotFoundException, IOException;
public abstract Response workloadTsbsLoadPost( @NotNull String taskId,TSBSLoadWorkload workload,SecurityContext securityContext) throws NotFoundException, IOException, InterruptedException;
public abstract Response workloadYcsbPost( @NotNull String taskId,YCSBWorkload workload,SecurityContext securityContext) throws NotFoundException;
}
package de.uulm.omi.dbms.workload.api.impl;
import de.uulm.omi.cloudiator.dbms.evaluator.model.ProcessStatus;
import de.uulm.omi.cloudiator.dbms.evaluator.model.TPCCWorkload;
import de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSLoadWorkload;
import de.uulm.omi.cloudiator.dbms.evaluator.model.WorkloadProcessInstance;
import de.uulm.omi.cloudiator.dbms.evaluator.model.WorkloadProcessSubmissionError;
import de.uulm.omi.cloudiator.dbms.evaluator.model.YCSBWorkload;
import de.uulm.omi.cloudiator.dbms.evaluator.model.*;
import de.uulm.omi.dbms.workload.api.ApiResponseMessage;
import de.uulm.omi.dbms.workload.api.NotFoundException;
import de.uulm.omi.dbms.workload.api.WorkloadApiService;
......@@ -15,17 +10,18 @@ import de.uulm.omi.workload.WorkloadProcess;
import de.uulm.omi.workload.tpcc.TPCCCommandBuilder;
import de.uulm.omi.workload.tsbs.TSBSCommandBuilder;
import de.uulm.omi.workload.ycsb.YCSBCommandBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.validation.constraints.NotNull;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.SecurityContext;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Properties;
import javax.validation.constraints.NotNull;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.SecurityContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2018-01-16T09:59:22.348Z")
public class WorkloadApiServiceImpl extends WorkloadApiService {
......@@ -154,7 +150,7 @@ public class WorkloadApiServiceImpl extends WorkloadApiService {
@Override
public Response workloadTsbsLoadPost(String taskId, TSBSLoadWorkload workload,
SecurityContext securityContext) throws NotFoundException, IOException {
SecurityContext securityContext) throws NotFoundException, IOException, InterruptedException {
//check if already a workloadProcess running
......@@ -178,49 +174,42 @@ public class WorkloadApiServiceImpl extends WorkloadApiService {
TSBS_RESULT_FOLDER
+ taskId + "-" + workload.getTsbsDataConfig().getFormat() + "-data.gz";
generateDataCommand += "| gzip > " + resultFileName;
ProcessBuilder processBuilder = new ProcessBuilder();
processBuilder.command(UNIX_SHELL, UNIX_COMMAND_PARAM, generateDataCommand);
Process processData = processBuilder.start();
ProcessBuilder genDataProcess= new ProcessBuilder();
genDataProcess.command(UNIX_SHELL, UNIX_COMMAND_PARAM, generateDataCommand);
Process processData = genDataProcess.start();
while (processData.isAlive()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
System.out.println("finished data generating");
//Generate Queries
String generateQueriesCommand = "";
String generateQueriesCommand = "";
generateQueriesCommand = TSBSCommandBuilder.generateQueries(workload.getTsbsQueryConfig());
String resultQueriesName =
TSBS_RESULT_FOLDER
+ taskId + "-" + workload.getTsbsQueryConfig().getQueryType() + ".gz";
generateQueriesCommand += " gzip > " + resultQueriesName;
/*processBuilder.command(UNIX_SHELL, UNIX_COMMAND_PARAM, generateQueriesCommand);
Process processGenQueries = processBuilder.start();
generateQueriesCommand += "| gzip > " + resultQueriesName;
ProcessBuilder genQueryProcess = new ProcessBuilder();
genQueryProcess.command(UNIX_SHELL, UNIX_COMMAND_PARAM, generateQueriesCommand);
Process processGenQueries = genQueryProcess.start();
while (processGenQueries.isAlive()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}*/
}
System.out.println("finished query generation");
// Benchmarking insert/write performance
/*String loadCommand = "";
String loadCommand = "";
loadCommand = TSBSCommandBuilder.loadCommand(workload.getTsbsDataConfig(), workload.getTsbsLoadConfig(), TSBS_BINARY);
processBuilder.command(UNIX_SHELL, UNIX_COMMAND_PARAM, loadCommand);
Process processLoad = processBuilder.start();
ProcessBuilder loadProcess = new ProcessBuilder();
loadProcess.command(UNIX_SHELL, UNIX_COMMAND_PARAM, loadCommand);
Process processLoad = loadProcess.start();
while (processLoad.isAlive()) {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}*/
System.out.println("finished loading");
workloadProcess
.startWorkload(TSBS_BINARY, UNIX_SHELL, UNIX_COMMAND_PARAM, generateQueriesCommand, taskId,
.startWorkload(TSBS_BINARY, UNIX_SHELL, UNIX_COMMAND_PARAM, "ping www.google.com", taskId,
workloadTimestamp);
WorkloadProcessInstance workloadProcessInstance = new WorkloadProcessInstance();
workloadProcessInstance.setTimestamp(BigDecimal.valueOf(workloadProcess.getStartTimestamp()));
......
......@@ -41,10 +41,12 @@ public class TSBSCommandBuilder {
}
else fail=true;
if (dataConfig.getFormat() != null) {
generateDataCommand += "-format=\"" + dataConfig.getFormat()+ "\" ";
generateDataCommand += "-format=\"" + dataConfig.getFormat()+ "\"";
}
else fail=true;
System.out.println(generateDataCommand);
// save resulting output in a gzip file
//assert dataConfig.getFormat() != null;
//generateDataCommand += "| gzip > " + tsbsResultFolder + dataConfig.getFormat() + "-data.gz";
......@@ -93,7 +95,8 @@ public class TSBSCommandBuilder {
} else fail=true;
if(queryConfig.getFormat() != null) {
generateQueryCommand += "-format=" + "\"" + queryConfig.getFormat() + "\" ";
}
} else fail = true;
System.out.println(generateQueryCommand);
if (fail) {
LOGGER.error("Required arguments are missing\n" + "One of the following:");
LOGGER.info("Arguments needed: \n" +
......
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