Convert data_table
Change-Id: Ie7df9bfb5950f8b1f4a8623cdb272faaa63d8c82
This commit is contained in:
parent
0d0baabe04
commit
15056f056a
9
cfsb-backend/.env
Normal file
9
cfsb-backend/.env
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
NEBULOUS_BROKER_URL=localhost
|
||||||
|
NEBULOUS_BROKER_PORT=5672
|
||||||
|
NEBULOUS_BROKER_USERNAME=admin
|
||||||
|
NEBULOUS_BROKER_PASSWORD=admin
|
||||||
|
POSTGRES_DB_HOST=127.0.0.1
|
||||||
|
POSTGRES_DB_NAME=fog_broker
|
||||||
|
POSTGRES_DB_PORT=5432
|
||||||
|
POSTGRES_DB_USER=dbuser
|
||||||
|
POSTGRES_DB_PASS=pass123
|
@ -1,5 +1,5 @@
|
|||||||
NEBULOUS_BROKER_URL=158.37.63.86
|
NEBULOUS_BROKER_URL=158.37.63.86
|
||||||
NEBULOUS_BROKER_PORT=31609
|
NEBULOUS_BROKER_PORT=32754
|
||||||
NEBULOUS_BROKER_USERNAME=admin
|
NEBULOUS_BROKER_USERNAME=admin
|
||||||
NEBULOUS_BROKER_PASSWORD=admin
|
NEBULOUS_BROKER_PASSWORD=admin
|
||||||
POSTGRES_DB_HOST=db
|
POSTGRES_DB_HOST=db
|
||||||
|
@ -34,7 +34,7 @@ def perform_evaluation(data_table, relative_wr_data, immediate_wr_data, node_nam
|
|||||||
sorted_categories = sorted(fog_node_categories, reverse=True)
|
sorted_categories = sorted(fog_node_categories, reverse=True)
|
||||||
# Create constraint matrices
|
# Create constraint matrices
|
||||||
A_boolean = [] # This is the inequality constraint matrix
|
A_boolean = [] # This is the inequality constraint matrix
|
||||||
b_boolean = [] # This is be the inequality constraint vector
|
b_boolean = [] # This is the inequality constraint vector
|
||||||
|
|
||||||
# Create constraints for each category having higher scores than the next lower category
|
# Create constraints for each category having higher scores than the next lower category
|
||||||
for higher_cat in range(len(sorted_categories) - 1):
|
for higher_cat in range(len(sorted_categories) - 1):
|
||||||
|
@ -287,6 +287,20 @@ def create_data_table(selected_criteria, extracted_data, field_mapping):
|
|||||||
|
|
||||||
return data_table
|
return data_table
|
||||||
|
|
||||||
|
|
||||||
|
# Used to convert RAM and # of Cores
|
||||||
|
def convert_data_table(created_data_table):
|
||||||
|
# Check if 'Number of CPU Cores' exists in the dictionary and convert its values
|
||||||
|
if 'Number of CPU Cores' in created_data_table:
|
||||||
|
created_data_table['Number of CPU Cores'] = [1/x for x in created_data_table['Number of CPU Cores']]
|
||||||
|
|
||||||
|
# Check if 'Memory Size' exists in the dictionary and convert its values
|
||||||
|
if 'Memory Size' in created_data_table:
|
||||||
|
created_data_table['Memory Size'] = [1/x for x in created_data_table['Memory Size']]
|
||||||
|
|
||||||
|
return created_data_table
|
||||||
|
|
||||||
|
|
||||||
# Used to Append "Score" and "Rank" for each node in SAL's response JSON
|
# Used to Append "Score" and "Rank" for each node in SAL's response JSON
|
||||||
def append_evaluation_results(sal_reply_body, scores_and_ranks):
|
def append_evaluation_results(sal_reply_body, scores_and_ranks):
|
||||||
# Check if sal_reply_body is a string and convert it to a Python object
|
# Check if sal_reply_body is a string and convert it to a Python object
|
||||||
|
@ -160,6 +160,10 @@ class SyncedHandler(Handler):
|
|||||||
# Check the number of nodes before Evaluation
|
# Check the number of nodes before Evaluation
|
||||||
print("There are " + str(len(node_ids)) + " nodes for Evaluation")
|
print("There are " + str(len(node_ids)) + " nodes for Evaluation")
|
||||||
|
|
||||||
|
print("Original created_data_table:", data_table)
|
||||||
|
# Convert RAM and Cores
|
||||||
|
data_table = convert_data_table(data_table)
|
||||||
|
print("Converted created_data_table:", data_table)
|
||||||
## Run evaluation
|
## Run evaluation
|
||||||
evaluation_results = perform_evaluation(data_table, relative_wr_data, immediate_wr_data, node_names, node_ids)
|
evaluation_results = perform_evaluation(data_table, relative_wr_data, immediate_wr_data, node_names, node_ids)
|
||||||
# print("Evaluation Results:", evaluation_results)
|
# print("Evaluation Results:", evaluation_results)
|
||||||
|
@ -323,6 +323,8 @@ def process_evaluation_data():
|
|||||||
# print("# node_names:", len(node_names))
|
# print("# node_names:", len(node_names))
|
||||||
# print("# node_ids:", len(node_ids))
|
# print("# node_ids:", len(node_ids))
|
||||||
|
|
||||||
|
# Convert RAM and Cores
|
||||||
|
data_table = convert_data_table(data_table)
|
||||||
# Run Optimization - Perform evaluation
|
# Run Optimization - Perform evaluation
|
||||||
results = perform_evaluation(data_table, relative_wr_data, immediate_wr_data, node_names, node_ids)
|
results = perform_evaluation(data_table, relative_wr_data, immediate_wr_data, node_names, node_ids)
|
||||||
# print(results)
|
# print(results)
|
||||||
|
Loading…
Reference in New Issue
Block a user