Commit 76220e26 authored by Daniel Seybold's avatar Daniel Seybold

added TimescaleDB and Cassandra connections generation, to test

parent d9ab7cda
Pipeline #80507 passed with stage
in 23 minutes and 59 seconds
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* DBEndpoint
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class DBEndpoint {
@JsonProperty("ipAddress")
private String ipAddress = null;
......
......@@ -22,7 +22,7 @@ import javax.validation.constraints.*;
* a list of the database endpoints to issue the workload
*/
@ApiModel(description = "a list of the database endpoints to issue the workload")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class DBEndpoints extends java.util.ArrayList<DBEndpoint> {
@Override
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
/**
* DatabaseConfig
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class DatabaseConfig {
/**
* Gets or Sets databaseBinding
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* DatabaseConfigProperty
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class DatabaseConfigProperty {
@JsonProperty("name")
private String name = null;
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* Error
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class Error {
@JsonProperty("code")
private Integer code = null;
......
......@@ -24,7 +24,7 @@ import javax.validation.constraints.*;
/**
* MeasurementConfig
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class MeasurementConfig {
@JsonProperty("interval")
private Integer interval = null;
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
/**
* TPCCWorkload
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TPCCWorkload {
@JsonProperty("dbEndpoints")
private DBEndpoints dbEndpoints = null;
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* TPCCWorkloadConfig
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TPCCWorkloadConfig {
@JsonProperty("activeWarehouses")
private Integer activeWarehouses = null;
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
* parameters for the data generation phase
*/
@ApiModel(description = "parameters for the data generation phase")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSBSDataGeneration {
@JsonProperty("usecase")
private String usecase = null;
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
/**
* TSBSLoadExecution
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSBSLoadExecution {
@JsonProperty("workers")
private BigDecimal workers = null;
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
/**
* TSBSQueryExecution
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSBSQueryExecution {
@JsonProperty("workers")
private BigDecimal workers = null;
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
* parameters for the query generation phase
*/
@ApiModel(description = "parameters for the query generation phase")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSBSQueryGeneration {
@JsonProperty("usecase")
private String usecase = null;
......
......@@ -29,7 +29,7 @@ import javax.validation.constraints.*;
/**
* TSBSWorkload
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSBSWorkload {
@JsonProperty("dbEndpoints")
private DBEndpoints dbEndpoints = null;
......@@ -40,7 +40,7 @@ public class TSBSWorkload {
public enum DbmsEnum {
INFLUX("INFLUX"),
TIMESALEDB("TIMESALEDB"),
TIMESCALEDB("TIMESCALEDB"),
MONGODB("MONGODB"),
......@@ -113,7 +113,7 @@ public class TSBSWorkload {
* @return dbms
**/
@JsonProperty("dbms")
@ApiModelProperty(example = "influx", value = "specifies the data format for the selected DBMS")
@ApiModelProperty(value = "specifies the data format for the selected DBMS")
public DbmsEnum getDbms() {
return dbms;
}
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* TSDBMSDBMSProperties
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class TSDBMSDBMSProperties {
@JsonProperty("name")
private String name = null;
......
......@@ -24,7 +24,7 @@ import javax.validation.constraints.*;
/**
* WorkloadConfig
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class WorkloadConfig {
/**
* Gets or Sets workloadType
......
......@@ -25,7 +25,7 @@ import javax.validation.constraints.*;
/**
* WorkloadProcessInstance
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class WorkloadProcessInstance {
@JsonProperty("processId")
private String processId = null;
......
......@@ -23,7 +23,7 @@ import javax.validation.constraints.*;
/**
* WorkloadProcessSubmissionError
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class WorkloadProcessSubmissionError {
@JsonProperty("message")
private String message = null;
......
......@@ -27,7 +27,7 @@ import javax.validation.constraints.*;
/**
* YCSBWorkload
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class YCSBWorkload {
@JsonProperty("dbEndpoints")
private DBEndpoints dbEndpoints = null;
......
package de.uulm.omi.dbms.workload.api;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {
......
......@@ -5,7 +5,7 @@ import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class ApiOriginFilter implements javax.servlet.Filter {
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
......
......@@ -3,7 +3,7 @@ package de.uulm.omi.dbms.workload.api;
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class ApiResponseMessage {
public static final int ERROR = 1;
public static final int WARNING = 2;
......
package de.uulm.omi.dbms.workload.api;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {
......
package de.uulm.omi.dbms.workload.api;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class StringUtil {
/**
* Check if the given array contains the given value (with case-insensitive comparison).
......
......@@ -35,7 +35,7 @@ import javax.validation.constraints.*;
@Produces({ "application/json" })
@io.swagger.annotations.Api(description = "the workload API")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class WorkloadApi {
private final WorkloadApiService delegate;
......
......@@ -21,7 +21,7 @@ import java.io.InputStream;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.SecurityContext;
import javax.validation.constraints.*;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
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;
......
......@@ -3,7 +3,7 @@ package de.uulm.omi.dbms.workload.api.factories;
import de.uulm.omi.dbms.workload.api.WorkloadApiService;
import de.uulm.omi.dbms.workload.api.impl.WorkloadApiServiceImpl;
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T12:41:32.345+02:00")
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaJerseyServerCodegen", date = "2020-05-08T15:27:14.409+02:00")
public class WorkloadApiServiceFactory {
private final static WorkloadApiService service = new WorkloadApiServiceImpl();
......
......@@ -2,6 +2,7 @@ package de.uulm.omi.workload.tsbs;
import static com.google.common.base.Preconditions.checkNotNull;
import de.uulm.omi.cloudiator.dbms.evaluator.model.DBEndpoint;
import de.uulm.omi.cloudiator.dbms.evaluator.model.DBEndpoints;
import de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSDataGeneration;
import de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSLoadExecution;
......@@ -12,6 +13,7 @@ import de.uulm.omi.cloudiator.dbms.evaluator.model.TSBSWorkload.DbmsEnum;
import de.uulm.omi.cloudiator.dbms.evaluator.model.TSDBMSDBMSProperties;
import java.util.List;
import java.util.Optional;
import java.util.StringJoiner;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -172,14 +174,8 @@ public class TSBSCommandBuilder {
else throw new IllegalArgumentException("Missing or incorrect --batch-size parameter!");
//DBMS specific parameters
if(dbms.equals(DbmsEnum.INFLUX)){
generateLoadCommand += influxCommand(tsbsLoadExecution.getDbmsPorperties(), dbEndpoints);
}else {
throw new IllegalArgumentException("Currently only influx is supported!");
}
return generateLoadCommand;
return getDBMSConnection(dbms, dbEndpoints, generateLoadCommand,
tsbsLoadExecution.getDbmsPorperties());
}
......@@ -197,19 +193,29 @@ public class TSBSCommandBuilder {
//DBMS specific parameters
return getDBMSConnection(dbms, dbEndpoints, queriesCommand,
tsbsQueryExecution.getDbmsPorperties());
}
private static String getDBMSConnection(DbmsEnum dbms, DBEndpoints dbEndpoints,
String queriesCommand, List<TSDBMSDBMSProperties> dbmsPorperties) {
if(dbms.equals(DbmsEnum.INFLUX)){
queriesCommand += influxCommand(tsbsQueryExecution.getDbmsPorperties(), dbEndpoints);
}else {
throw new IllegalArgumentException("Currently only influx is supported!");
queriesCommand += influxCommand(dbmsPorperties, dbEndpoints);
}else if (dbms.equals(DbmsEnum.TIMESCALEDB)){
queriesCommand += timescaledbCommand(dbmsPorperties, dbEndpoints);
}else if(dbms.equals(DbmsEnum.CASSANDRA)){
queriesCommand += cassandraCommand(dbmsPorperties,dbEndpoints);
}
return queriesCommand;
else {
throw new IllegalArgumentException("Currently only Influx, TimescaleDb and Cassandra are supported!");
}
return queriesCommand;
}
private static String influxCommand(
List<TSDBMSDBMSProperties> dbmsProperties,
DBEndpoints dbEndpoints){
......@@ -256,6 +262,112 @@ public class TSBSCommandBuilder {
}
private static String timescaledbCommand(List<TSDBMSDBMSProperties> dbmsProperties,
DBEndpoints dbEndpoints){
String timescaledbCommand = "";
//TODO: add support for multiple TimescaleDB endpoints as soon as Timescale relases cluster support
LOGGER.warn("Multiple TimescaleDB endpoints are currently not supported!");
String timescaledbEndpoints = dbEndpoints.get(0).getIpAddress() + ":5432 ";
timescaledbCommand += "--host " + timescaledbEndpoints;
//user
boolean userCheck = dbmsProperties.stream().anyMatch(o -> o.getName().equals("user"));
if(userCheck){
Optional<TSDBMSDBMSProperties> item = dbmsProperties.stream()
.filter(c -> c.getName().equals("user")).findAny();
timescaledbCommand += "--user " + item.get().getValue() + " ";
}else {
throw new IllegalArgumentException("No user parameter provided for TimescaleDB connection!");
}
//password
boolean passCheck = dbmsProperties.stream().anyMatch(o -> o.getName().equals("pass"));
if(passCheck){
Optional<TSDBMSDBMSProperties> item = dbmsProperties.stream()
.filter(c -> c.getName().equals("pass")).findAny();
timescaledbCommand += "--pass " + item.get().getValue() + " ";
}else {
throw new IllegalArgumentException("No pass parameter provided for TimescaleDB connection!");
}
//postgres params
boolean postgresCheck = dbmsProperties.stream().anyMatch(o -> o.getName().equals("postgres"));
if(postgresCheck){
Optional<TSDBMSDBMSProperties> item = dbmsProperties.stream()
.filter(c -> c.getName().equals("postgres")).findAny();
timescaledbCommand += "--postgres " + item.get().getValue() + " ";
}else {
//no SSL connections per default
LOGGER.warn("No postgres parameters provided, falling back to default and disabling sslmode!");
timescaledbCommand += "--postgres sslmode=disable";
}
//TODO add all additional parameters supported by:
// https://github.com/timescale/tsbs/blob/master/cmd/tsbs_load_timescaledb/main.go
// https://github.com/timescale/tsbs/blob/master/cmd/tsbs_run_queries_timescaledb/main.go
return timescaledbCommand;
}
private static String cassandraCommand(List<TSDBMSDBMSProperties> dbmsProperties,
DBEndpoints dbEndpoints) {
String cassandraCommand = "";
StringJoiner cassandraHosts = new StringJoiner(",");
for (DBEndpoint dbEndpoint: dbEndpoints) {
cassandraHosts.add(dbEndpoint.getIpAddress()+ ":9042");
}
cassandraCommand += "--hosts " + cassandraHosts + " ";
//replication-factor
boolean replicationFactorCheck = dbmsProperties.stream().anyMatch(o -> o.getName().equals("replication-factor"));
if(replicationFactorCheck){
Optional<TSDBMSDBMSProperties> item = dbmsProperties.stream()
.filter(c -> c.getName().equals("replication-factor")).findAny();
cassandraCommand += "--replication-factor " + item.get().getValue() + " ";
}else {
//falling back to default replication factor 1
LOGGER.warn("No replication-factor parameter provided, falling back to default 1!");
cassandraCommand += "--replication-factor 1 ";
}
//write-consistency
boolean writeConsistencyFactorCheck = dbmsProperties.stream().anyMatch(o -> o.getName().equals("consistency"));
if(writeConsistencyFactorCheck){
Optional<TSDBMSDBMSProperties> item = dbmsProperties.stream()
.filter(c -> c.getName().equals("consistency")).findAny();
cassandraCommand += "--consistency " + item.get().getValue() + " ";
}else {
//falling back to default replication factor 1
LOGGER.warn("No consistency parameter provided, falling back to default ONE!");
cassandraCommand += "--consistency ONE ";
}
return cassandraCommand;
}
public static String clearDB(DbmsEnum dbms, String databaseName, DBEndpoints dbEndpoints){
String clearCommand = "";
......
......@@ -525,11 +525,10 @@ definitions:
type: string
enum:
- INFLUX
- TIMESALEDB
- TIMESCALEDB
- MONGODB
- CASSANDRA
description: 'specifies the data format for the selected DBMS'
example: INFLUX
tsbsDataGeneration:
$ref: '#/definitions/TSBSDataGeneration'
tsbsLoadExecution:
......
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