diff --git a/src/main/java/de/uulm/omi/workload/tsbs/Runner.java b/src/main/java/de/uulm/omi/workload/tsbs/Runner.java index ece027954b58f91041f62030b1af51e7a30f3397..da0a2df9d56d3273323254be5bedcc0d9f952c0b 100644 --- a/src/main/java/de/uulm/omi/workload/tsbs/Runner.java +++ b/src/main/java/de/uulm/omi/workload/tsbs/Runner.java @@ -23,7 +23,7 @@ public class Runner implements Runnable { private static final String TSBS_BINARY = "/opt/workloads/tsbs/bin/"; //checking interval for TSBS commands - private final int CHECKING_INTERVAL = 5000; + private final int CHECKING_INTERVAL = 500; private TSBSWorkload workload; private String taskId; @@ -94,6 +94,7 @@ public class Runner implements Runnable { } LOGGER.debug("Phase 2: query generation finished with exit code: " + workloadProcess.getExitCode()); if(workloadProcess.getExitCode() != 0){ + LOGGER.error("Phase 3 finished with error exit code " + workloadProcess.getExitCode()); Thread.currentThread().interrupt(); return; } @@ -151,11 +152,13 @@ public class Runner implements Runnable { LOGGER.debug("Load phase in process..."); Thread.sleep(CHECKING_INTERVAL); } catch (InterruptedException e) { + LOGGER.error(e.getMessage()); e.printStackTrace(); } } LOGGER.debug("Phase 3: load phase finished with exit code: " + workloadProcess.getExitCode()); if(workloadProcess.getExitCode() != 0){ + LOGGER.error("Phase 3 finished with error exit code " + workloadProcess.getExitCode()); Thread.currentThread().interrupt(); return; } @@ -166,7 +169,7 @@ public class Runner implements Runnable { //Execute Queries String executeQueriesCommand = TSBSCommandBuilder.executeQueriesCommand(TSBS_BINARY, properties.getProperty(WorkloadApiProperties.WORKLOAD_DATA_FOLDER), workload.getDbms(), workload.getTsbsQueryExecution(), workload.getDbEndpoints() ); executeQueriesCommand += " &> " + properties.getProperty(WorkloadApiProperties.WORKLOAD_RESULTS_FOLDER) + TSBS_RESULT_FOLDER + taskId.trim() + ".txt"; - LOGGER.debug(loadCommand); + LOGGER.debug(executeQueriesCommand); /* commandToLog = executeQueriesCommand + System.getProperty("line.separator"); try { @@ -177,12 +180,28 @@ public class Runner implements Runnable { return; } */ - - workloadProcess = WorkloadProcess.getInstance(); + workloadProcess .startWorkload(TSBS_BINARY, UNIX_SHELL, UNIX_COMMAND_PARAM, executeQueriesCommand, taskId, workloadTimestamp); + while (workloadProcess.isRunning()) { + try { + LOGGER.debug("Query phase in process..."); + Thread.sleep(CHECKING_INTERVAL); + } catch (InterruptedException e) { + LOGGER.error(e.getMessage()); + e.printStackTrace(); + } + } + + if(workloadProcess.getExitCode() != 0){ + LOGGER.error("Phase 4 finished with error exit code " + workloadProcess.getExitCode()); + Thread.currentThread().interrupt(); + return; + } + + LOGGER.debug("Phase 4: query execution finished"); } }