gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r23004 - gnunet-planetlab/gplmt


From: gnunet
Subject: [GNUnet-SVN] r23004 - gnunet-planetlab/gplmt
Date: Tue, 31 Jul 2012 09:07:50 +0200

Author: wachs
Date: 2012-07-31 09:07:50 +0200 (Tue, 31 Jul 2012)
New Revision: 23004

Modified:
   gnunet-planetlab/gplmt/gplmt.py
Log:
cmd line option to run on a single host


Modified: gnunet-planetlab/gplmt/gplmt.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt.py     2012-07-31 07:03:54 UTC (rev 23003)
+++ gnunet-planetlab/gplmt/gplmt.py     2012-07-31 07:07:50 UTC (rev 23004)
@@ -70,7 +70,7 @@
 # Parse command line arguments
     
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "hvc:n:t:ap:s:", ["help", 
"config=", "nodes=", "tasks=", "all", "password", "startid"])
+        opts, args = getopt.getopt(sys.argv[1:], "hvc:n:t:ap:s:H:", ["help", 
"config=", "nodes=", "tasks=", "all", "password", "startid", "host"])
     except getopt.GetoptError, err:
         # print help information and exit:
         print str(err) # will print something like "option -a not recognized"
@@ -83,7 +83,9 @@
             usage()
             sys.exit()
         elif o in ("-c", "--config"):
-            main.config_file = a      
+            main.config_file = a
+        elif o in ("-H", "--host"):
+            main.single_host = a                     
         elif o in ("-n", "--nodes"):
             main.nodes_file = a      
         elif o in ("-t", "--tasks"):
@@ -113,13 +115,14 @@
         sys.exit(2)
     
     # command line beats configuration
-    if (main.nodes_file == ""):
+    if ((main.nodes_file == "") and (main.pl_use_nodes == False) and 
(main.single_host == None)):
         if (configuration.nodesfile != ""):
             main.nodes_file = configuration.nodesfile
         else: 
             print "No nodes file given!\n"
             usage()
             sys.exit(2)
+    
     if (main.tasks_file == ""):
         if (configuration.taskfile != ""):
             main.tasks_file = configuration.taskfile
@@ -131,14 +134,21 @@
         configuration.pl_password = main.pl_password
 
 # Load hosts files
-    if ((main.pl_use_nodes == True) or (configuration.pl_use_nodes == True)):
+    if (main.single_host != None):
+        nodes = Nodes.StringNodes (main.single_host, main.logger)
+        if (nodes.load() == False):
+            sys.exit(2)         
+    elif ((main.pl_use_nodes == True) or (configuration.pl_use_nodes == True)):
         nodes = Nodes.PlanetLabNodes (configuration, main.logger)
         if (nodes.load() == False):
             sys.exit(2)        
-    else:
+    elif (main.nodes_file != ""):
         nodes = Nodes.Nodes (main.nodes_file, main.logger);
         if (nodes.load() == False):
             sys.exit(2)
+    else:
+        print "No nodes file given!\n" 
+        sys.exit(2)        
 
 # Load actions file
     tasks = Tasks.Tasks (main.tasks_file, main.logger, main.startid);
@@ -171,6 +181,7 @@
   -t, --tasks=FILENAME       use tasks file FILENAME\n\
   -a, --all                  use all nodes assigned to PlanetLab slice instead 
of nodes file\n\
   -p, --password             password to acces PlanetLab API\n\
+  -H, --host                 run tasklist on given host\n\
   -s, --startid              start with this task id \n\
   -h, --help                 print this help\n\
   -V, --verbose              be verbose \n\
@@ -187,6 +198,7 @@
     pl_use_nodes = False;
     logger = None;
     startid = -1;
+    single_host = None;
     def __init__(self):
         self.verbose = False;
         




reply via email to

[Prev in Thread] Current Thread [Next in Thread]