-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding graph_csv.py script #5
base: master
Are you sure you want to change the base?
Conversation
Just added some more modifications, fixing the problem of no feedback about measuring while storing data on db. Fixing #4 . |
graph_csv.py
Outdated
|
||
INTERVAL = 10 | ||
|
||
#function used to build the ipmi and csv commands |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions comments are located between """comment""
def func()
"""my comment"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
@@ -18,10 +18,20 @@ python2.7 powergraph.py --host="server address" --port="server port" --user="all | |||
``` | |||
You can use the optional parameter ```--store``` in order to save | |||
the infos as json on tinydb. Without this parameter, the script will | |||
print on the terminal. | |||
print on the terminal. Besides, you can use ```--feedback``` with store | |||
in order to see the measures status. | |||
|
|||
Run ```csvcreator.py``` like this: | |||
|
|||
``` | |||
python2.7 csvcreator.py --jsonfile="generated_json_name" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can remove python 2.7 from the command specification. Given we added it at the top of file. In addition, ensure you chmod +x you Python script before pushing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
graph_csv.py
Outdated
|
||
return ipmi_command,csv_command | ||
|
||
#function to get the arguments from the user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions comments are located between """comment""
def func()
"""my comment"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
graph_csv.py
Outdated
def build_commands(args): | ||
year = time.strftime("%Y") | ||
month = int(time.strftime("%m")) | ||
# DO NOT FORGET TO CHANGE THIS AFTER TESTING |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
??? what should you have done here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed!
graph_csv.py
Outdated
day = int(time.strftime("%d")) + 1 | ||
date=str(year)+str(month)+str(day) | ||
|
||
csv_command = 'python2.7 csvcreator.py --name=last --date='+date+' --jsonfile=' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can also remove python2.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As some people use python as an alias for python3, I think that's not a good idea.
graph_csv.py
Outdated
help='jsonfile to be converted as csv') | ||
return parser.parse_args() | ||
|
||
#function to run the collection of data |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions comments are located between """comment""
def func()
"""my comment"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
graph_csv.py
Outdated
def run_collector(command): | ||
os.system(command) | ||
|
||
#function to run the csv generator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
functions comments are located between """comment""
def func()
"""my comment"""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
graph_csv.py
Outdated
#function to run the csv generator | ||
def run_csv(command): | ||
while 1: | ||
time.sleep(300) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this value be defined by user?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea. Just did it!
graph_csv.py
Outdated
while 1: | ||
time.sleep(300) | ||
os.system(command) | ||
os.system("tail -n 300 last.csv > aux.csv") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't we verify for the file availability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it's necessary? Line 85 is in charge of creating it.
@@ -25,7 +25,7 @@ | |||
NREAD = 10 | |||
INFINITY = False | |||
STORE = False | |||
|
|||
FEEDBACK = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest to split the patch in two: one for the run-all-patch and another for this one. Also, ensure you run pylint on all files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry. but I didn't undestand waht you mean.
It is failing when you set empty input. We must identify any missing argument and raise a notification. 09:38:15 | Thu May 25 |
This is very simple script that runs both powergraph.py and csv_creator.py at the same time, making csv files with the latest measures.