Index: api.py |
diff --git a/api.py b/api.py |
index a46210d57e011213b090972cd6661a6bef29e73a..80ad26f0fa6efb5a3219f06d3d6678fd5f1cc452 100644 |
--- a/api.py |
+++ b/api.py |
@@ -8,8 +8,9 @@ import systems.cassandra.setup as cas |
from systems.cassandra.launch_cassandra import launch_cassandras |
import systems.ycsb.ycsb_wrapper as ycsb |
from systems.ycsb.setup import setup_ycsb |
-from pytools.experiments.exp_common import mkdir_unique_results_folder, setup_experiment_folder |
-from pytools.common.common import wait_with_message |
+from pytools.experiments.exp_common import setup_experiment_folder |
+from ml.tools import train_model |
+ |
def experiment_cleanup(FLAGS, conf): |
logging.info("CLEANUP START") |
@@ -53,6 +54,22 @@ def experiment_prepare(FLAGS, conf): |
logging.info("PREPARE END") |
+def prepare_ml_model(FLAGS, conf): |
+ """ |
+ This function will train the model for estimating |
+ speculative method and save the model to the file. |
+ """ |
+ logging.info("MODEL TRAINING START") |
+ |
+ upperbound = conf["env"]["upperbound"] |
+ data_path = conf["env"]["data_path"] |
+ # NB! This path should be the same as in predict.py |
+ model_save_path = conf["env"]["model_path"] |
+ train_model(model_save_path, data_path, upperbound) |
+ |
+ logging.info("MODEL TRAINING END") |
+ |
+ |
def experiment_launch_systems(FLAGS, conf, net): |
logging.info("LAUNCHING SYSTEMS START") |
@@ -62,10 +79,8 @@ def experiment_launch_systems(FLAGS, conf, net): |
logging.info("LAUNCHING SYSTEMS END") |
- |
def experiment_run(FLAGS, conf, net, exp_name="sample"): |
# Run experiment only if it configured to be run! |
- |
if not conf["cassandra"]["setup"]["cas_run_experiment"]: |
return |