print 'graph_info This the average time for the last 5 schedulings/launchings'
print 'schedule.label schedule time'
print 'schedule.draw LINE2'
print 'schedule.info average time for last 5 instance to be scheduled'
print 'launch.label launch time'
print 'launch.draw LINE2'
print 'launch.info average time for last 5 instance to be launched after scheduling'
def get_status():
connection = get_session().connection()
row = connection.execute("select AVG(TIME_TO_SEC(TIMEDIFF(scheduled_at, created_at))) from instances where scheduled_at is not null order by scheduled_at desc limit 5;").fetchall()[0]
schedule = row[0]
row = connection.execute("select AVG(TIME_TO_SEC(TIMEDIFF(launched_at, scheduled_at))) from instances where launched_at is not null order by launched_at desc limit 5;").fetchall()[0]