X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=node_ssh%2Fnst.py;h=90618e40deb50494f9b643752b9064b5b5c047ad;hb=eeba8e303edbfc5e926767ba22294beda642ecba;hp=2d535c88e7718d83d4b937f544410138536eb3eb;hpb=b5f1294c71e8aeb920d1e07216bece0f60a1f582;p=tests.git diff --git a/node_ssh/nst.py b/node_ssh/nst.py index 2d535c8..90618e4 100644 --- a/node_ssh/nst.py +++ b/node_ssh/nst.py @@ -14,7 +14,7 @@ parser.add_option("-n", "--nodes", action="store", dest="nodes", help = "File th parser.add_option("-k", "--key", action="store", dest="key", help = "Path to alternate public key") parser.add_option("-u", "--user", action="store", dest="user", help = "API user name") parser.add_option("-p", "--password", action="store", dest="password", help = "API password") -parser.add_option("-g", "--graph-only", action="store", dest="graph_only", help = "Only plot the current data, then exit") +parser.add_option("-g", "--graph-only", action="store_true", dest="graph_only", help = "Only plot the current data, then exit") parser.add_option("-l", "--plot-length", action="store", dest="plot_length", help = "Plot x-axis (time) length in seconds") parser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Be verbose (default: %default)") (options, args) = parser.parse_args() @@ -312,8 +312,8 @@ def init_slice(config, all_nodes): def plot_fill_empty(config): #ticstep = 3600 # 1 hour #plotlength = 36000 # 10 hours - ticstep = 1800 - plot_length = config.plot_length + ticstep = 3600 + plotlength = int(config.plot_length) plots_path = config.plots_path all_nodes_filename = config.all_nodes_filename @@ -390,14 +390,15 @@ def plot_fill_empty(config): # load configuration config = Config(options) -current_time = round(time.time()) -all_nodes = config.api.GetNodes(config.auth, {}, \ - ['node_id', 'boot_state', 'hostname', 'last_contact', 'slice_ids']) -if options.graph-only: +if options.graph_only: plot_fill_empty(config) sys.exit(0) +current_time = round(time.time()) +all_nodes = config.api.GetNodes(config.auth, {}, \ + ['node_id', 'boot_state', 'hostname', 'last_contact', 'slice_ids']) + # if root is specified we will ssh into root context, not a slice # so no need to add a slice to all nodes @@ -410,7 +411,7 @@ else: init_slice(config, all_nodes) if config.verbose: - print "Waiting %(sleep_time)d seconds for nodes to update" % locals() + print "Waiting %d seconds for nodes to update" % config.sleep_time # wait for nodes to get the data sleep(config.sleep_time)