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0.7,1
0,0,0.4,1
1.9,1.3,0,1
name,type,values
x,double,0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1.0;1.1;1.2;1.3;1.4;1.5;1.6;1.7;1.8;1.9
y,double,0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1.0;1.1;1.2;1.3;1.4;1.5;1.6;1.7;1.8;1.9
z,double,0;0.1;0.2;0.3;0.4;0.5;0.6;0.7;0.8;0.9;1.0;1.1;1.2;1.3;1.4;1.5;1.6;1.7;1.8;1.9
name,type,prediction
m,double,hth
This diff is collapsed.
sec,nanosec,client_id,x,y,z,m,n
1543768546,462641948,'martinovic_14879',1.000000,1.000000,1.000000,-15.072766,15.622065
1543768546,512865089,'martinovic_14879',1.600000,0.800000,1.900000,-13.613519,5.056408
1543768546,563166653,'martinovic_14879',1.600000,0.800000,1.900000,-13.613519,5.056408
1543768546,613450523,'martinovic_14879',1.800000,0.500000,0.100000,-15.912782,0.781411
1543768546,663798238,'martinovic_14879',1.800000,0.500000,0.100000,-15.912782,0.781411
1543768546,714084191,'martinovic_14879',1.900000,1.700000,1.000000,-12.745973,6.230153
1543768546,764376161,'martinovic_14879',1.900000,1.700000,1.000000,-12.745973,6.230153
1543768546,814697346,'martinovic_14879',1.500000,1.300000,1.300000,-13.646696,10.796364
1543768546,865065930,'martinovic_14879',1.500000,1.300000,1.300000,-13.646696,10.796364
1543768546,915400648,'martinovic_14879',1.400000,0.500000,1.800000,-14.310362,3.862809
1543768546,965727766,'martinovic_14879',1.400000,0.500000,1.800000,-14.310362,3.862809
1543768547,16037002,'martinovic_14879',0.200000,1.600000,1.200000,-13.946630,3.787916
1543768547,66440189,'martinovic_14879',0.200000,1.600000,1.200000,-13.946630,3.787916
1543768547,116673772,'martinovic_14879',0.500000,0.300000,1.800000,-15.841446,1.134583
1543768547,167036601,'martinovic_14879',0.500000,0.300000,1.800000,-15.841446,1.134583
1543768547,217385256,'martinovic_14879',1.100000,0.700000,1.200000,-15.278708,14.464866
1543768547,267744766,'martinovic_14879',1.100000,0.700000,1.200000,-15.278708,14.464866
1543768547,318065281,'martinovic_14879',1.000000,0.300000,0.000000,-17.533171,5.724016
1543768547,368412643,'martinovic_14879',1.000000,0.300000,0.000000,-17.533171,5.724016
1543768547,418721783,'martinovic_14879',1.800000,1.800000,1.800000,-12.020522,-1.739405
1543768547,469095978,'martinovic_14879',1.800000,1.800000,1.800000,-12.020522,-1.739405
1543768547,519389935,'martinovic_14879',0.000000,0.800000,1.400000,-15.764868,6.531008
1543768547,569801505,'martinovic_14879',0.000000,0.800000,1.400000,-15.764868,6.531008
1543768547,620162976,'martinovic_14879',0.100000,0.500000,0.100000,-18.060946,1.524701
1543768547,670533425,'martinovic_14879',0.100000,0.500000,0.100000,-18.060946,1.524701
1543768547,720889523,'martinovic_14879',1.000000,1.400000,1.400000,-13.818832,11.697129
1543768547,771214950,'martinovic_14879',1.000000,1.400000,1.400000,-13.818832,11.697129
1543768547,821557502,'martinovic_14879',1.800000,1.100000,0.800000,-14.176311,8.642481
1543768547,871931360,'martinovic_14879',1.800000,1.100000,0.800000,-14.176311,8.642481
1543768547,922229632,'martinovic_14879',1.700000,0.400000,1.400000,-14.525551,0.674223
1543768547,972563774,'martinovic_14879',1.700000,0.400000,1.400000,-14.525551,0.674223
1543768548,22916844,'martinovic_14879',1.700000,0.600000,0.900000,-15.027561,2.615053
1543768548,73279000,'martinovic_14879',1.700000,0.600000,0.900000,-15.027561,2.615053
1543768548,123624191,'martinovic_14879',1.300000,1.400000,0.100000,-14.376719,8.693213
1543768548,173966748,'martinovic_14879',1.300000,1.400000,0.100000,-14.376719,8.693213
1543768548,224261050,'martinovic_14879',0.000000,0.600000,1.800000,-15.711421,1.156360
1543768548,274619600,'martinovic_14879',0.000000,0.600000,1.800000,-15.711421,1.156360
1543768548,324926492,'martinovic_14879',0.000000,0.200000,0.600000,-18.419714,2.052107
1543768548,375278220,'martinovic_14879',0.000000,0.200000,0.600000,-18.419714,2.052107
1543768548,425624710,'martinovic_14879',1.900000,1.500000,0.100000,-13.565466,4.783875
1543768548,475979398,'martinovic_14879',1.900000,1.500000,0.100000,-13.565466,4.783875
1543768548,526304930,'martinovic_14879',0.700000,1.100000,0.100000,-15.722507,8.532979
1543768548,576736724,'martinovic_14879',0.700000,1.100000,0.100000,-15.722507,8.532979
1543768548,627094296,'martinovic_14879',1.500000,1.800000,0.100000,-13.231576,-0.189619
1543768548,677530731,'martinovic_14879',1.500000,1.800000,0.100000,-13.231576,-0.189619
1543768548,727895329,'martinovic_14879',0.000000,1.800000,1.600000,-13.154310,-3.203207
1543768548,778248967,'martinovic_14879',0.000000,1.800000,1.600000,-13.154310,-3.203207
1543768548,828597391,'martinovic_14879',0.400000,0.900000,0.800000,-16.071831,8.336139
1543768548,879000490,'martinovic_14879',0.400000,0.900000,0.800000,-16.071831,8.336139
1543768548,929409728,'martinovic_14879',1.600000,1.800000,0.600000,-13.019764,-1.467045
1543768548,979778689,'martinovic_14879',1.600000,1.800000,0.600000,-13.019764,-1.467045
1543768549,30133627,'martinovic_14879',1.200000,1.800000,1.500000,-12.746455,5.742267
1543768549,80579229,'martinovic_14879',1.200000,1.800000,1.500000,-12.746455,5.742267
1543768549,130937851,'martinovic_14879',0.300000,0.200000,0.300000,-18.608551,1.349268
1543768549,181398865,'martinovic_14879',0.300000,0.200000,0.300000,-18.608551,1.349268
1543768549,231688165,'martinovic_14879',0.400000,1.400000,1.800000,-13.811322,3.465317
1543768549,282107279,'martinovic_14879',0.400000,1.400000,1.800000,-13.811322,3.465317
1543768549,332459324,'martinovic_14879',1.600000,1.500000,1.800000,-12.707851,-2.976514
1543768549,382829404,'martinovic_14879',1.600000,1.500000,1.800000,-12.707851,-2.976514
1543768549,433016485,'martinovic_14879',1.200000,0.100000,1.200000,-15.719475,12.354240
1543768549,483252794,'martinovic_14879',1.200000,0.100000,1.200000,-15.719475,12.354240
1543768549,533556461,'martinovic_14879',1.200000,1.200000,0.600000,-14.768463,13.926912
1543768549,583930150,'martinovic_14879',1.200000,1.200000,0.600000,-14.768463,13.926912
1543768549,634104080,'martinovic_14879',1.200000,1.700000,0.700000,-13.518941,5.157808
1543768549,684298725,'martinovic_14879',1.200000,1.700000,0.700000,-13.518941,5.157808
1543768549,734518453,'martinovic_14879',0.100000,1.500000,0.800000,-14.520954,3.676303
1543768549,784941536,'martinovic_14879',0.100000,1.500000,0.800000,-14.520954,3.676303
1543768549,835358618,'martinovic_14879',1.800000,0.000000,1.300000,-14.687279,4.705034
1543768549,885782870,'martinovic_14879',1.800000,0.000000,1.300000,-14.687279,4.705034
1543768549,936139721,'martinovic_14879',0.500000,0.400000,0.000000,-18.029148,1.997954
1543768549,986555323,'martinovic_14879',0.500000,0.400000,0.000000,-18.029148,1.997954
1543768550,36905924,'martinovic_14879',0.200000,1.800000,0.100000,-13.934216,-0.100367
1543768550,87313816,'martinovic_14879',0.200000,1.800000,0.100000,-13.934216,-0.100367
1543768550,137642214,'martinovic_14879',0.200000,0.800000,0.100000,-16.990414,3.765555
1543768550,188146619,'martinovic_14879',0.200000,0.800000,0.100000,-16.990414,3.765555
1543768550,238524809,'martinovic_14879',0.500000,1.800000,0.800000,-13.626158,3.904042
1543768550,288913831,'martinovic_14879',0.500000,1.800000,0.800000,-13.626158,3.904042
1543768550,339113418,'martinovic_14879',1.000000,0.600000,1.900000,-14.632932,11.337210
1543768550,389529017,'martinovic_14879',1.000000,0.600000,1.900000,-14.632932,11.337210
1543768550,439903948,'martinovic_14879',1.600000,1.700000,1.300000,-12.787391,-0.709465
1543768550,490322911,'martinovic_14879',1.600000,1.700000,1.300000,-12.787391,-0.709465
1543768550,540638233,'martinovic_14879',1.700000,1.200000,0.300000,-14.404051,3.241142
1543768550,591042995,'martinovic_14879',1.700000,1.200000,0.300000,-14.404051,3.241142
1543768550,641430023,'martinovic_14879',1.300000,0.600000,0.100000,-16.364485,7.184486
1543768550,691845294,'martinovic_14879',1.300000,0.600000,0.100000,-16.364485,7.184486
1543768550,742192869,'martinovic_14879',1.400000,0.000000,1.900000,-14.396452,7.638580
1543768550,792631414,'martinovic_14879',1.400000,0.000000,1.900000,-14.396452,7.638580
1543768550,843029466,'martinovic_14879',1.200000,0.300000,1.500000,-15.172689,6.838730
1543768550,893457029,'martinovic_14879',1.200000,0.300000,1.500000,-15.172689,6.838730
1543768550,943803825,'martinovic_14879',0.600000,0.700000,1.800000,-15.112017,3.589688
1543768550,994118271,'martinovic_14879',0.600000,0.700000,1.800000,-15.112017,3.589688
1543768551,44500154,'martinovic_14879',0.100000,0.400000,1.100000,-17.121338,6.899883
1543768551,94776485,'martinovic_14879',0.100000,0.400000,1.100000,-17.121338,6.899883
1543768551,145097419,'martinovic_14879',0.700000,0.800000,0.700000,-16.169542,8.152776
1543768551,195379127,'martinovic_14879',0.700000,0.800000,0.700000,-16.169542,8.152776
1543768551,245571058,'martinovic_14879',0.600000,1.400000,0.800000,-14.617384,8.267169
1543768551,295783603,'martinovic_14879',0.600000,1.400000,0.800000,-14.617384,8.267169
1543768551,346075698,'martinovic_14879',0.700000,0.900000,1.300000,-15.249897,11.967950
1543768551,396264423,'martinovic_14879',0.700000,0.900000,1.300000,-15.249897,11.967950
1543768551,446616379,'martinovic_14879',0.500000,0.300000,1.400000,-16.409191,4.959272
......@@ -11,10 +11,10 @@ Communication with Cassandra is done using JDBC driver for Cassandra.
## Dependency
In the current implementation requires the following packages
- the RJDBC, DiceDesign, DiceEval and DiceKriging package for R
- the RJDBC (only when CASSANDRA DB is used), DiceDesign, tidyverse and rlang package for R
```R
install.packages('RJDBC')
install.packages('DiceDesign')
install.packages('DiceEval')
install.packages('DiceKriging')
install.packages('tidyverse')
install.packages('rlang')
```
STORAGE_TYPE="CSV"
STORAGE_ADDRESS="../data/"
APPLICATION_NAME="kursawe/v1/test"
ITERATION_COUNTER="0"
DOE_NAME="dmax"
NUMBER_CONFIGURATIONS_PER_ITERATION="50"
NUMBER_OBSERVATIONS_PER_CONFIGURATION="1"
MAX_NUMBER_ITERATION="10"
MINIMUM_DISTANCE="0.2"
......@@ -17,6 +17,7 @@ create_doe <- function(knobs_config_list, doe_options, knobs_names, model_contai
discarded_designs <- discarded_designs %>% setdiff(full_design)
}
if(doe_options$nobs >= nrow(full_design))
# Write model table -------------------------------------------------------
......@@ -38,6 +39,10 @@ create_doe <- function(knobs_config_list, doe_options, knobs_names, model_contai
write.table(temp_df, file = model_container_name, col.names = TRUE, row.names = FALSE, sep = ",", dec = ".")
}
if(doe_options$nobs >= nrow(full_design)){
warning("configuration_per_iteration is greater than full factorial design. algorithm set to the full_factorial")
algorithm = "full_factorial"
}
# Generate points to explore ----------------------------------------------
......@@ -79,7 +84,7 @@ create_doe <- function(knobs_config_list, doe_options, knobs_names, model_contai
}
# Map points to the application DOE ---------------------------------------
if (length(knobs_config_list) > 1) {
# Create matrix of all the possible knob design points
design_space_grid <- as.matrix(full_design)
......
#!/bin/bash
ENVIRONMENTAL_FILE=$1
source $ENVIRONMENTAL_FILE
################################################################################
# THIS IS THE PLUGIN ENTRY POINT
#-------------------------------------------------------------------------------
#
# The environmental file provides to this script variables to handle the
# generation of the model model, in particular it exports:
# - STORAGE_TYPE -> with the type of the supported storage, in the current
# implementation it supports only the Cassandra database
# - STORAGE_ADDRESS -> with the address of the storage
# - STORAGE_USERNAME -> optionally, the username required to authenticate
# with the storage
# - STORAGE_PASSWORD -> optionally, the password required to authenticate
# with the storage
# - OBSERVATION_CONTAINER_NAME -> the name of the container of the observation
# of the application behavior. The columns of this container
# are the following (in oder):
# - "day": number of days since epoch
# - "time": number of nanoseconds since midnight of day
# - "client_id": the string if of the client
# - "<knob>": the name of each knob of the application
# - "<feature>": the name of each feature of the application
# - "<metric>": the name of each metric of the application
# - MODEL_CONTAINER_NAME -> the input/output container of all the required
# prediction of the model. The columns of this container are
# the following:
# - "<knob>": the name of each knob of the application
# - "<feature>": the name of each feature of the application
# - "<metric_avg>": the expected mean value of each metric
# - "<metric_std>": the expected standard deviation of each metric
# NOTE: the idea is that the model should updated the <metric_*>
# fields of each row of this table.
# - KNOBS_CONTAINER_NAME -> the container with the name and type of each knob.
# The name of the columns are the following:
# - "name": the name of the software knob
# - "type": the type of the software knob
# - FEATURES_CONTAINER_NAME -> the container with the name and type of each features.
# The name of the columns are the following:
# - "name": the name of the feature
# - "type": the type of the feature
# - METRIC_NAME -> the name of the metric to predict
# - METRIC_ROOT -> the path of this folder when called by agora
#
# Is up to the plugin writer to use this script to call the tools that perform
# the prediction. The remote application handler checks the return value of
# this script to make sure that everything is fine.
# once this script is completed, the remote handler assumes that the prediction
# is compeltely done.
################################################################################
# exit if fail
set -e
# this method is unable to interact directly with a database
# therefore we use a python script to dump and update the database
# STEP 2: load data, generate the actual model and write data to cassandra
Rscript $METRIC_ROOT/main.R $METRIC_ROOT >> $METRIC_ROOT/stdout.log 2>> $METRIC_ROOT/stderr.log
......@@ -17,7 +17,7 @@ if (length(args) < 1)
root_path <- args[1]
} else
{
root_path <- args[1]
root_path <- args[1]
print(paste("Warning: the following program option are ignored:", args[2:nrow(args)], collapse = ", "))
}
......@@ -49,30 +49,30 @@ application_name <- gsub("/", "_", application_name)
if (storage_type == "CASSANDRA"){
suppressMessages(suppressPackageStartupMessages(library("RJDBC"))) # connect to database using JDBC codecs
knobs_container_name <- paste("margot.", application_name, "_knobs", sep = "")
model_container_name <- paste("margot.", application_name, "_model", sep = "")
doe_container_name <- paste("margot.", application_name, "_doe", sep = "")
metrics_container_name <- paste("margot.", application_name, "_metrics", sep = "")
# CONNECT TO CASSANDRA
driver <- JDBC("com.github.adejanovski.cassandra.jdbc.CassandraDriver", "cassandra-jdbc-wrapper-3.1.0.jar", identifier.quote = "'")
full_address_string <- paste("jdbc:cassandra://", storage_address, ":9042", sep = "")
conn <- dbConnect(driver, full_address_string)
# READ CONFIGURATION FROM CASSANDRA
knobs_names <- dbGetQuery(conn, paste("SELECT name FROM ", knobs_container_name, sep = ""))
metric_names <- dbGetQuery(conn, paste("SELECT name FROM ", metrics_container_name, sep = ""))
} else if (storage_type == "CSV"){
knobs_container_name <- paste(storage_address, "/", application_name, "_knobs.csv", sep = "")
model_container_name <- paste(storage_address, "/", application_name, "_model.csv", sep = "")
doe_container_name <- paste(storage_address, "/", application_name, "_doe.csv", sep = "")
metrics_container_name <- paste(storage_address, "/", application_name, "_metrics.csv", sep = "")
knobs_names <- read_csv(knobs_container_name) %>% pull(name)
metric_names <- read_csv(metrics_container_name) %>% pull(name)
conn <- NULL
} else{
stop(paste("Error: uknown $STORAGE_TYPE ", storage_type, ". Please, select storage type CASSANDRA or CSV.", sep = ""), call. = FALSE)
......@@ -124,4 +124,3 @@ if (storage_type == "CASSANDRA")
print("Wrote new DOE configurations")
q(save = "no")
STORAGE_TYPE="CSV"
STORAGE_ADDRESS="../data"
APPLICATION_NAME="kursawe/v1/test"
METRIC_NAME="n"
ITERATION_COUNTER="1"
NUMBER_CONFIGURATIONS_PER_ITERATION="50"
MAX_NUMBER_ITERATION="10"
MAX_MAE="1.0"
MIN_R2="0.0005"
VALIDATION_SPLIT="0.2"
K_VALUE="10"
#!/bin/bash
ENVIRONMENTAL_FILE=$1
source $ENVIRONMENTAL_FILE
################################################################################
# THIS IS THE PLUGIN ENTRY POINT
#-------------------------------------------------------------------------------
#
# The environmental file provides to this script variables to handle the
# generation of the model model, in particular it exports:
# - STORAGE_TYPE -> with the type of the supported storage, in the current
# implementation it supports only the Cassandra database
# - STORAGE_ADDRESS -> with the address of the storage
# - STORAGE_USERNAME -> optionally, the username required to authenticate
# with the storage
# - STORAGE_PASSWORD -> optionally, the password required to authenticate
# with the storage
# - OBSERVATION_CONTAINER_NAME -> the name of the container of the observation
# of the application behavior. The columns of this container
# are the following (in oder):
# - "day": number of days since epoch
# - "time": number of nanoseconds since midnight of day
# - "client_id": the string if of the client
# - "<knob>": the name of each knob of the application
# - "<feature>": the name of each feature of the application
# - "<metric>": the name of each metric of the application
# - MODEL_CONTAINER_NAME -> the input/output container of all the required
# prediction of the model. The columns of this container are
# the following:
# - "<knob>": the name of each knob of the application
# - "<feature>": the name of each feature of the application
# - "<metric_avg>": the expected mean value of each metric
# - "<metric_std>": the expected standard deviation of each metric
# NOTE: the idea is that the model should updated the <metric_*>
# fields of each row of this table.
# - KNOBS_CONTAINER_NAME -> the container with the name and type of each knob.
# The name of the columns are the following:
# - "name": the name of the software knob
# - "type": the type of the software knob
# - FEATURES_CONTAINER_NAME -> the container with the name and type of each features.
# The name of the columns are the following:
# - "name": the name of the feature
# - "type": the type of the feature
# - METRIC_NAME -> the name of the metric to predict
# - METRIC_ROOT -> the path of this folder when called by agora
#
# Is up to the plugin writer to use this script to call the tools that perform
# the prediction. The remote application handler checks the return value of
# this script to make sure that everything is fine.
# once this script is completed, the remote handler assumes that the prediction
# is compeltely done.
################################################################################
# exit if fail
set -e
# this method is unable to interact directly with a database
# therefore we use a python script to dump and update the database
# STEP 2: load data, generate the actual model and write data to cassandra
Rscript $METRIC_ROOT/model.R $METRIC_ROOT >> $METRIC_ROOT/stdout.log 2>> $METRIC_ROOT/stderr.log
......@@ -122,7 +122,7 @@ if (storage_type == "CASSANDRA") {
# PREPARE DOE OPTIONS -----------------------------------------------------
writeLines(str_c("Number of KNOBS: ", nknobs, "\nNumber of FEATURES: ", length(features_names)[1], if(is.null(features_names)){"0"}))
writeLines(str_c("Number of KNOBS: ", nknobs, "\nNumber of FEATURES: ", length(features_names)[1]))
# MAKE NAMES LOWERCASE FOR CASSANDRA (JUST TO BE SURE)
knobs_names <- str_to_lower(knobs_names)
if(!is.null(features_names)){
......@@ -171,14 +171,14 @@ if (any(!ind_complete)) {
print(observation_df %>% filter(!ind_complete))
observation_df <- observation_df %>% filter(ind_complete)
}
nobserved_orig <- nrow(observation_df)
# nobserved_orig <- nrow(observation_df)
# DISCARD OBSERVATION OUTSIDE THE DESIGN SPACE GRID
observation_df <- inner_join(observation_df, design_space_grid, by = input_columns)
# observation_df <- inner_join(observation_df, design_space_grid, by = input_columns)
nobserved <- nrow(observation_df)
if (nobserved_orig > nobserved) {
warning("There were some observation outside of the design grid and were discarded.")
}
rm(ind_complete, nobserved_orig)
# if (nobserved_orig > nobserved) {
# warning("There were some observation outside of the design grid and were discarded.")
# }
# rm(ind_complete, nobserved_orig)
# GET MAE NORMALIZATION VALUES --------------------------------------------
......@@ -327,7 +327,7 @@ if (storage_type == "CASSANDRA"){
temp_df <- design_space_grid %>% mutate(!!metric_avg := as.numeric(Y_final$fit))
temp_df <- temp_df %>% mutate(!!metric_std := as.numeric(Y_final$sd))
model_csv <- model_csv %>% select(-!!str_c(metric_name, "_std"), -!!str_c(metric_name, "_avg"))
model_csv <- inner_join(temp_df, model_csv)
model_csv <- inner_join(model_csv, temp_df)
write.table(model_csv, file = model_container_name, col.names = TRUE, row.names = FALSE, sep = ",", dec = ".")
}
......
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