Skip to content

Commit

Permalink
updating few lines as per the latest branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiv committed Mar 15, 2023
1 parent 86a96f9 commit b7f6e24
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
19 changes: 11 additions & 8 deletions remote_monitoring_demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,11 @@ def main(argv):
json_data = json.load(open(create_exp_json_file))

find.append(json_data[0]['experiment_name'])
find.append(json_data[0]['deployment_name'])
find.append(json_data[0]['namespace'])
find.append(json_data[0]['kubernetes_objects'][0]['name'])
find.append(json_data[0]['kubernetes_objects'][0]['namespace'])

print(find)


try:
opts, _ = getopt.getopt(argv,"h:c:")
Expand Down Expand Up @@ -71,11 +74,11 @@ def main(argv):
create_experiment(tmp_create_exp_json_file)

if i == 0:
json_data = json.load(open(create_exp_json_file))
json_data = json.load(open(tmp_create_exp_json_file))

experiment_name = json_data[0]['experiment_name']
deployment_name = json_data[0]['deployment_name']
namespace = json_data[0]['namespace']
deployment_name = json_data[0]['kubernetes_objects'][0]['name']
namespace = json_data[0]['kubernetes_objects'][0]['namespace']

print("Experiment name = ", experiment_name)
print("Deployment name = ", deployment_name)
Expand All @@ -96,16 +99,16 @@ def main(argv):
# Sleep
time.sleep(5)

reco = list_recommendations(experiment_name, deployment_name, namespace)
reco = list_recommendations(experiment_name)
recommendations_json_arr.append(reco)

# Dump the results & recommendations into json files
with open('recommendations_data.json', 'w') as f:
json.dump(recommendations_json_arr, f)
json.dump(recommendations_json_arr, f, indent=4)

list_exp_json = list_experiments()
with open('usage_data.json', 'w') as f:
json.dump(list_exp_json, f)
json.dump(list_exp_json, f, indent=4)


if __name__ == '__main__':
Expand Down
4 changes: 2 additions & 2 deletions remote_monitoring_demo/kruize/kruize.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def update_results(result_json_file):
print(response.text)
return response

def list_recommendations(experiment_name, deployment_name, namespace):
def list_recommendations(experiment_name):
"""
Description: This function obtains the recommendations
from Kruize using listRecommendations API
Expand All @@ -108,7 +108,7 @@ def list_recommendations(experiment_name, deployment_name, namespace):
url = URL + "/listRecommendations"
print(f"URL = {url}")

PARAMS = {'experiment_name': experiment_name, 'deployment_name': deployment_name, 'namespace': namespace}
PARAMS = {'experiment_name': experiment_name}
response = requests.get(url = url, params = PARAMS)
print(f"Response status code = {response.status_code}")

Expand Down

0 comments on commit b7f6e24

Please sign in to comment.