Bug fixes

Fixed a regression involving the erroneous storage of the created datasets for the forecasting
Improved a diagnostic message during dataset creation
Change-Id: Ic8aaa0728a4b936cd4c6e1ed5a0e01ba8f0fb003

Change-Id: Ic3c8d0eeeeb7d908d5c866e33806db138b6b557f
This commit is contained in:
Andreas Tsagkaropoulos 2024-05-14 18:45:11 +03:00
parent 59968e9fc4
commit c9109ba8ed
3 changed files with 13 additions and 7 deletions

View File

@ -1,4 +1,4 @@
#Tue May 14 12:59:33 UTC 2024
#Tue May 14 15:38:04 UTC 2024
APP_NAME=default_application
METHOD=exponential_smoothing
INFLUXDB_HOSTNAME=nebulous-influxdb

View File

@ -86,11 +86,9 @@ def predict_attribute(application_state, attribute, configuration_file_location,
# Windows
if platform == "win32":
os.chdir("exponential-smoothing-predictor/src/r_predictors")
command = ['Rscript', 'forecasting_real_workload.R', application_state.prediction_data_filename, attribute]
# linux
elif platform == "linux" or platform == "linux2":
os.chdir("/home/r_predictions")
command = ["Rscript forecasting_real_workload.R "+str(application_state.prediction_data_filename) + " "+ str(attribute)]
#Choosing the solution of linux
else:
@ -101,15 +99,12 @@ def predict_attribute(application_state, attribute, configuration_file_location,
# Windows
if platform == "win32":
os.chdir("exponential-smoothing-predictor/src/r_predictors")
command = ['Rscript', 'forecasting_real_workload.R', application_state.prediction_data_filename, attribute, next_prediction_time]
# Linux
elif platform == "linux" or platform == "linux2":
os.chdir("/home/r_predictions")
command = ["Rscript forecasting_real_workload.R "+str(application_state.prediction_data_filename) + " "+ str(attribute)+" "+str(next_prediction_time) + " 2>&1"]
#Choosing the solution of linux
else:
os.chdir("/home/r_predictions")
command = ["Rscript forecasting_real_workload.R "+str(application_state.prediction_data_filename) + " "+ str(attribute)+" "+str(next_prediction_time)]
process_output = run(command, shell=True, stdout=PIPE, stderr=PIPE, universal_newlines=True)
@ -456,6 +451,17 @@ def get_dataset_file(attribute):
pass
def main():
#Change to the appropriate directory in order i) To invoke the forecasting script appropriately and ii) To store the monitoring data necessary for predictions
from sys import platform
if platform == "win32":
os.chdir("exponential-smoothing-predictor/src/r_predictors")
# linux
elif platform == "linux" or platform == "linux2":
os.chdir("/home/r_predictions")
else:
os.chdir("/home/r_predictions")
EsPredictorState.configuration_file_location = sys.argv[1]
Utilities.load_configuration()
Utilities.update_influxdb_organization_id()

View File

@ -92,7 +92,7 @@ class ApplicationState:
print_data_from_db = True
query_string = 'from(bucket: "'+self.influxdb_bucket+'") |> range(start:-'+time_interval_to_get_data_for+') |> filter(fn: (r) => r["_measurement"] == "'+metric_name+'")'
influx_connector = InfluxDBConnector()
print("performing query")
print("performing query for application with bucket "+str(self.influxdb_bucket))
current_time = time.time()
result = influx_connector.client.query_api().query(query_string, EsPredictorState.influxdb_organization)
elapsed_time = time.time()-current_time