Skip to content

Commit

Permalink
Bug fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Andreas Tsagkaropoulos committed May 14, 2024
1 parent 59968e9 commit c9109ba
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 11 additions & 5 deletions exponential-smoothing-predictor/src/runtime/Predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def update_monitoring_data(self):
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
Expand Down

0 comments on commit c9109ba

Please sign in to comment.