Skip to content

Commit

Permalink
using default file permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
Shiv committed Mar 14, 2023
1 parent 43f747d commit 86a96f9
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions remote_monitoring_demo/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
from kruize.kruize import *
import sys, getopt
import json
import os
import time

def generate_json(find_arr, json_file, filename, i):

with open(json_file, 'r') as file:
with open(json_file) as file:
data = file.read()

for find in find_arr:
Expand All @@ -40,13 +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]['kubernetes_objects'][0]['name'])
find.append(json_data[0]['kubernetes_objects'][0]['namespace'])

print(find)
find.append(json_data[0]['deployment_name'])
find.append(json_data[0]['namespace'])

try:
opts, args = getopt.getopt(argv,"h:c:")
opts, _ = getopt.getopt(argv,"h:c:")
except getopt.GetoptError:
print("demo.py -c <cluster type>")
sys.exit(2)
Expand Down Expand Up @@ -74,11 +71,11 @@ def main(argv):
create_experiment(tmp_create_exp_json_file)

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

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

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

reco = list_recommendations(experiment_name)
reco = list_recommendations(experiment_name, deployment_name, namespace)
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, indent=4)
json.dump(recommendations_json_arr, f)

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


if __name__ == '__main__':
Expand Down

0 comments on commit 86a96f9

Please sign in to comment.