gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r28140 - in gnunet-planetlab/gplmt: . gplmt


From: gnunet
Subject: [GNUnet-SVN] r28140 - in gnunet-planetlab/gplmt: . gplmt
Date: Thu, 18 Jul 2013 11:47:40 +0200

Author: wachs
Date: 2013-07-18 11:47:40 +0200 (Thu, 18 Jul 2013)
New Revision: 28140

Added:
   gnunet-planetlab/gplmt/gplmt/Targets.py
Modified:
   gnunet-planetlab/gplmt/gplmt.py
   gnunet-planetlab/gplmt/gplmt/Configuration.py
   gnunet-planetlab/gplmt/gplmt/Notifications.py
   gnunet-planetlab/gplmt/gplmt/Tasks.py
   gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
implementing generic testbed support


Modified: gnunet-planetlab/gplmt/gplmt/Configuration.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Configuration.py       2013-07-18 09:07:36 UTC 
(rev 28139)
+++ gnunet-planetlab/gplmt/gplmt/Configuration.py       2013-07-18 09:47:40 UTC 
(rev 28140)
@@ -44,9 +44,8 @@
         self.notifications = ""
         self.pl_slicename = ""
         self.pl_api_url = ""
-        self.pl_username = ""
-        self.pl_password = ""
-        self.pl_use_nodes = False     
+        self.pl_username = None
+        self.pl_password = None
         self.taskfile = ""
         self.nodesfile = ""
         self.ssh_username = ""
@@ -93,12 +92,6 @@
                 pass
             # optional values
             try:
-                self.pl_use_nodes = config.getboolean ("planetlab", 
"use_pl_nodes")
-            except ConfigParser.NoOptionError as e:
-                pass    
-            if (True == self.pl_use_nodes):
-                self.ssh_username = self.pl_slicename
-            try:
                 self.pl_api_url = config.get("planetlab", "api_url")
             except ConfigParser.NoOptionError as e:
                 pass

Modified: gnunet-planetlab/gplmt/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Notifications.py       2013-07-18 09:07:36 UTC 
(rev 28139)
+++ gnunet-planetlab/gplmt/gplmt/Notifications.py       2013-07-18 09:47:40 UTC 
(rev 28140)
@@ -23,7 +23,7 @@
 # Notifications     
 
 try:
-    import gplmt.Tasks as Tasks
+    import gplmt.Tasks as Tasklist
     import time
     import sys
 except ImportError as e: 
@@ -64,6 +64,7 @@
         self.msg = ""
         self.output = ""
     def finished (self, result, fail, msg, output):
+        print self.task.name + " done with " + str (fail)
         self.result = result
         self.fail = fail
         self.msg = msg
@@ -149,7 +150,7 @@
                 sys.stdout.write(' ' * diff + ' | ')
                 print 'success' if tl.success else 'failed in: '
             for t in n.tasks:
-                if (t.result != Tasks.Taskresult.success):
+                if (t.result != Tasklist.Taskresult.success):
                     print "\tFAIL: " + t.task.name + " with '" +t.msg+ "' and 
'" +t.output+ "'"
                 else:
                     print "\tSUC " + t.task.name + " with '" +t.msg+ "' and '" 
+t.output+ "'"                     
@@ -209,13 +210,15 @@
         if (None == nodeObj):
             print "Node not found!"
             return 
+        print "Task completed" + task.name
         nodeObj.tasks.append (Task (task))
         return
     def task_completed (self, node, task, result, message, output):       
         nodeObj = self.nodes.get(node)
         for t in nodeObj.tasks:
             if t.task is task:
-                if (result != Tasks.Taskresult.success):
+                print "Task completed" + task.name
+                if (result != Tasklist.Taskresult.success):
                     t.finished (result, True, message, output)
                 else:
                     t.finished (result, False, message, output)
@@ -259,9 +262,9 @@
     def task_started (self, node, task, message):
         print node + " : Task '" +  task.name + "' started"
     def task_completed (self, node, task, result, message, output):
-        if (result == Tasks.Taskresult.success):
+        if (result == Tasklist.Taskresult.success):
             print node + " : Task '" +  task.name + "' completed successfully"
-        elif (result == Tasks.Taskresult.src_file_not_found):
+        elif (result == Tasklist.Taskresult.src_file_not_found):
             print node + " : Task '" +  task.name + "' failed : source file 
not found"
         else:
             print node + " : Task '" +  task.name + "' completed with failure" 
            

Added: gnunet-planetlab/gplmt/gplmt/Targets.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Targets.py                             (rev 0)
+++ gnunet-planetlab/gplmt/gplmt/Targets.py     2013-07-18 09:47:40 UTC (rev 
28140)
@@ -0,0 +1,53 @@
+#!/usr/bin/python
+#
+#    This file is part of GNUnet.
+#    (C) 2010 Christian Grothoff (and other contributing authors)
+#
+#    GNUnet is free software; you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published
+#    by the Free Software Foundation; either version 2, or (at your
+#    option) any later version.
+#
+#    GNUnet is distributed in the hope that it will be useful, but
+#    WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#    General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with GNUnet; see the file COPYING.  If not, write to the
+#    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+#    Boston, MA 02111-1307, USA.
+#
+# GNUnet Planetlab deployment and automation toolset 
+#
+# Target
+
+
+class Target ():
+    undefined = 0
+    local = 1
+    remote_ssh = 2
+    planetlab = 3
+    def __init__(self, Type = undefined):
+        self.value = Type
+    def __str__(self):
+        if self.value == Target.local:
+            return 'local'
+        if self.value == Target.remote_ssh:
+            return 'remote_ssh'
+        if self.value == Target.planetlab:
+            return 'planetlab'
+        else:
+            return "undefined"
+    def __eq__(self,y):
+        return self.value==y.value
+    @staticmethod
+    def create (source_str):
+        if (str.lower(source_str) == str (Target (Target.local))):
+            return Target (Target.local)
+        elif (str.lower(source_str) == str (Target (Target.remote_ssh))):
+            return Target (Target.remote_ssh)
+        elif (str.lower(source_str) == str (Target (Target.planetlab))):
+            return Target (Target.planetlab)
+        else:
+            return Target (Target.undefined)     
\ No newline at end of file

Modified: gnunet-planetlab/gplmt/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Tasks.py       2013-07-18 09:07:36 UTC (rev 
28139)
+++ gnunet-planetlab/gplmt/gplmt/Tasks.py       2013-07-18 09:47:40 UTC (rev 
28140)
@@ -25,13 +25,16 @@
     import Util
     import sys
     import os
+    import gplmt
     from xml.parsers import expat  
     from minixsv import pyxsval as xsv 
     from elementtree import ElementTree
     elementtree_loaded = True 
     from genxmlif import GenXmlIfError
+    # gplmt imports
+    import Targets as Targets
 except ImportError as e: 
-    print "That's a bug! please check README: " + str(e)
+    print "That's a bug! please check README: " +  __file__+ " " + str (e)
     sys.exit(1)
     
 
@@ -243,7 +246,7 @@
     for child in root:
         if (child.tag == "target"):
             if (child.text != None):
-                tasks.target = child.text
+                tasks.target = Targets.Target.create(child.text)
                 glogger.log ("Tasklist specified target: '" + 
str(tasks.target) + "'")
         elif (child.tag == "log_dir"):
             if (child.text != None):
@@ -264,8 +267,9 @@
 
     
 
-class Tasks:
-    def __init__(self, filename, logger, startid, name="<Undefined>", 
log_dir="", target=None):
+class Tasklist:
+    def __init__(self, filename, logger, startid, 
+                 name="<Undefined>", log_dir=""):
         assert (None != logger)
         global glogger
         glogger = logger
@@ -275,11 +279,10 @@
         self.startid = startid
         self.startid_found = False
         self.log_dir = log_dir
-        self.target = target
+        self.target = Targets.Target (Targets.Target.undefined)
     def load_singletask (self, cmd, logger):
         t = Task()
         self.name = "Execute single command"
-        
         t.id = 0
         t.name = "Executing single command: '" +str(cmd)+"'" 
         t.type = Operation.run
@@ -292,8 +295,7 @@
         t.src = None
         t.dest = None
         t.command_file = None
-        t.output_prefix = None
-        
+        t.output_prefix = None        
         self.l.append(t)
     def load (self):        
         self.logger.log ("Loading tasks file '" + self.filename + "'")
@@ -334,11 +336,9 @@
         #print_sequence (self.l)
         self.logger.log("Loaded %s tasks" % len(self.l))
         
-        return True
-
-        
+        return True        
     def copy (self):
-        t = Tasks (self.filename, self.logger, -1)
+        t = Tasklist (self.filename, self.logger, -1)
         # Create a copy of the task list as described in 
         # http://docs.python.org/library/copy.html
         t.filename = self.filename

Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-18 09:07:36 UTC (rev 
28139)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-18 09:47:40 UTC (rev 
28140)
@@ -36,7 +36,7 @@
 try:
     import gplmt.Configuration as Configuration
     import gplmt.Util as Util
-    import gplmt.Tasks as Tasks
+    import gplmt.Tasks as Tasklist
     from gplmt.SCP import SCPClient
     from gplmt.SCP import SCPException
 except ImportError as e: 
@@ -125,7 +125,7 @@
             t.arguments = ""
         else:
             g_logger.log (self.node.hostname + " : Task '"+ task.name + "' 
failed: no command to execute")
-            return Tasks.Taskresult.fail
+            return Tasklist.Taskresult.fail
         
         return self.exec_run(t, transport)
         
@@ -136,11 +136,11 @@
         if(interrupt):
             message = "'"+ task.name +  "' interrupted by user"
             g_logger.log (self.node.hostname + " : Task '"+ message)
-            return TaskExecutionResult(Tasks.Taskresult.user_interrupt, 
"interrupted by user", "")
+            return TaskExecutionResult(Tasklist.Taskresult.user_interrupt, 
"interrupted by user", "")
         if ((task.command == None) and (task.arguments == None)):
             message = "'"+ task.name +  "' no command to execute"
             g_logger.log (self.node.hostname + " : Task " + message)
-            return TaskExecutionResult(Tasks.Taskresult.fail, "no command to 
execute", "")
+            return TaskExecutionResult(Tasklist.Taskresult.fail, "no command 
to execute", "")
         try:
             channel = transport.open_session()
             channel.settimeout(1.0)
@@ -155,7 +155,7 @@
             timeout = task.timeout
         else:
             timeout = -1
-        result = Tasks.Taskresult.success
+        result = Tasklist.Taskresult.success
         exit_status = -1
         start_time = time.time ()
         
@@ -164,13 +164,13 @@
         
         while 1:
             if(interrupt):
-                result = Tasks.Taskresult.user_interrupt
+                result = Tasklist.Taskresult.user_interrupt
                 break
             if (timeout != -1):
                 delta = time.time() - start_time
                 if (delta > timeout):
                     g_logger.log (self.node.hostname + " : Timeout after " 
+str(delta) +" seconds")                    
-                    result = Tasks.Taskresult.timeout
+                    result = Tasklist.Taskresult.timeout
                     break
             (r, w, e) = select.select([channel], [], [], 1)
             if r:
@@ -192,16 +192,16 @@
                 if not got_data:
                     break
         
-        if (result == Tasks.Taskresult.success):
+        if (result == Tasklist.Taskresult.success):
             exit_status = channel.recv_exit_status ()  
         
-        if (result == Tasks.Taskresult.success):
+        if (result == Tasklist.Taskresult.success):
             if (task.expected_return_code != -1):                    
                 if (exit_status != task.expected_return_code):
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' completed after "+ str(time.time() - start_time) +" sec, but exit code " 
+str(exit_status)+ " was not as expected " + str(task.expected_return_code))
                     g_logger.log (stdout_data)
                     g_logger.log (stderr_data)
-                    result = Tasks.Taskresult.return_value_did_not_match
+                    result = Tasklist.Taskresult.return_value_did_not_match
                 else:
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' completed after "+ str(time.time() - start_time) +" sec, exit code " 
+str(exit_status)+ " was as expected " + str(task.expected_return_code))
             
@@ -215,15 +215,15 @@
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' expected output '"+task.expected_output+"' was found")
                 else:
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' expected output '"+task.expected_output+"' was not found")
-                    result = Tasks.Taskresult.output_did_not_match
+                    result = Tasklist.Taskresult.output_did_not_match
                     
-        if (result == Tasks.Taskresult.success):
+        if (result == Tasklist.Taskresult.success):
             message = "'"+ task.name +  "' successful"
             g_logger.log (self.node.hostname + " : Task " + message)
-        elif (result == Tasks.Taskresult.timeout):
+        elif (result == Tasklist.Taskresult.timeout):
             message = "'"+ task.name +  "' with timeout"
             g_logger.log (self.node.hostname + " : Task "+ message)
-        elif (result == Tasks.Taskresult.user_interrupt):
+        elif (result == Tasklist.Taskresult.user_interrupt):
             message = "'"+ task.name +  "' interrupted by user"
             g_logger.log (self.node.hostname + " : Task "+ message)
         else: 
@@ -232,9 +232,9 @@
         return TaskExecutionResult(result, message, output)
     def exec_put (self, task, transport):
         if (False == os.path.exists (task.src)):
-            return Tasks.Taskresult.src_file_not_found
+            return Tasklist.Taskresult.src_file_not_found
             
-        result = Tasks.Taskresult.success
+        result = Tasklist.Taskresult.success
         try:
             if (g_configuration.ssh_transfer == 
Configuration.TransferMode.scp):
                 try:
@@ -242,7 +242,7 @@
                     scp.put (task.src, task.dest)
                 except SCPException as e:
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' :" + str(e))
-                    result = Tasks.Taskresult.fail
+                    result = Tasklist.Taskresult.fail
                     pass
             if (g_configuration.ssh_transfer == 
Configuration.TransferMode.sftp):                
                 sftp = paramiko.SFTPClient.from_transport (transport)
@@ -250,16 +250,16 @@
                 sftp.close()
         except paramiko.SSHException as e:
             g_logger.log (self.node.hostname + " : Task '"+ task.name + "' :" 
+ str(e))
-            result = Tasks.Taskresult.fail
+            result = Tasklist.Taskresult.fail
             pass
         except (OSError, IOError) as e:
             g_logger.log (self.node + " : Task '"+ task.name + "' : " + str(e))
-            result = Tasks.Taskresult.src_file_not_found 
+            result = Tasklist.Taskresult.src_file_not_found 
             pass           
         return result
             
     def exec_get (self, task, transport):
-        result = Tasks.Taskresult.success
+        result = Tasklist.Taskresult.success
         try:
             if (g_configuration.ssh_transfer == 
Configuration.TransferMode.scp): 
                 try:
@@ -267,7 +267,7 @@
                     scp.get (task.src, task.dest)
                 except SCPException as e:
                     g_logger.log (self.node.hostname + " : Task '"+ task.name 
+ "' :" + str(e))
-                    result = Tasks.Taskresult.fail
+                    result = Tasklist.Taskresult.fail
                     pass                
             if (g_configuration.ssh_transfer == 
Configuration.TransferMode.sftp):
                 sftp = paramiko.SFTPClient.from_transport (transport)
@@ -275,11 +275,11 @@
                 sftp.close()
         except paramiko.SSHException as e:
             g_logger.log (self.node.hostname + " : Task '"+ task.name + "' :" 
+ str(e))
-            result = Tasks.Taskresult.fail
+            result = Tasklist.Taskresult.fail
             pass
         except (OSError, IOError) as e:
             g_logger.log (self.node.hostname + " : Task '"+ task.name + "' : " 
+ str(e))
-            result = Tasks.Taskresult.src_file_not_found 
+            result = Tasklist.Taskresult.src_file_not_found 
             pass           
         return result    
           
@@ -288,7 +288,7 @@
         g_logger.log (self.node.hostname + " : Starting tasklist " + 
self.tasks.name)
         task = self.tasks.get()
         if(interrupt):
-            return Tasks.Taskresult.user_interrupt
+            return Tasklist.Taskresult.user_interrupt
         try: 
             ssh = paramiko.SSHClient()
             if (g_configuration.ssh_use_known_hosts):
@@ -354,35 +354,35 @@
         g_notifications.node_connected (self.node.hostname, True, "")
         transport = ssh.get_transport()        
         success = True
-        task_result = Tasks.Taskresult.success
+        task_result = Tasklist.Taskresult.success
         while (None != task and not interrupt):
             g_logger.log (self.node.hostname + " : Running task id " 
+str(task.id)+" '" + task.name + "'")
             g_notifications.task_started (self.node.hostname, task, "")
             if (task.__class__.__name__ == "Task"):
-                if (task.type == Tasks.Operation.run):
+                if (task.type == Tasklist.Operation.run):
                     task_result = self.exec_run (task, transport)
                     g_notifications.task_completed (self.node.hostname, task, 
task_result.result, task_result.message, task_result.output)
-                elif (task.type == Tasks.Operation.put):
+                elif (task.type == Tasklist.Operation.put):
                     task_result = self.exec_put (task, transport)
                     g_notifications.task_completed (self.node.hostname, task, 
task_result, "")
-                elif (task.type == Tasks.Operation.get):
+                elif (task.type == Tasklist.Operation.get):
                     task_result = self.exec_get (task, transport)
                     g_notifications.task_completed (self.node.hostname, task, 
task_result, "")
-                elif (task.type == Tasks.Operation.run_per_host):
+                elif (task.type == Tasklist.Operation.run_per_host):
                     task_result = self.exec_run_per_host (task, transport)
                     g_notifications.task_completed (self.node.hostname, task, 
task_result, "")                    
                 else:
                     print "UNSUPPORTED OPERATION!"                    
             elif (task.__class__.__name__ == "Taskset"):
                 g_logger.log (self.node.hostname + " : Running task set")
-            if ((task.stop_on_fail == True) and (task_result.result != 
Tasks.Taskresult.success)):
+            if ((task.stop_on_fail == True) and (task_result.result != 
Tasklist.Taskresult.success)):
                 g_logger.log (self.node.hostname + " : Task failed and 
therefore execution is stopped")
                 g_notifications.task_completed (self.node.hostname, task, 
task_result.result, task_result.message, task_result.output)         
                 transport.close()
                 success = False
                 break
             # If received user interrupt, close channel and break execution
-            elif (task_result == Tasks.Taskresult.user_interrupt):
+            elif (task_result == Tasklist.Taskresult.user_interrupt):
                 transport.close()
                 success = False
                 break

Modified: gnunet-planetlab/gplmt/gplmt.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt.py     2013-07-18 09:07:36 UTC (rev 28139)
+++ gnunet-planetlab/gplmt/gplmt.py     2013-07-18 09:47:40 UTC (rev 28140)
@@ -40,38 +40,37 @@
     minixsv_loaded = True 
 except ImportError: 
     minixsv_loaded = False 
-
-
 try:
+    import gplmt.Targets as Targets
     import gplmt.Util as Util
     import gplmt.Configuration as Configuration
     import gplmt.Nodes as Nodes
-    import gplmt.Tasks as Tasks
+    import gplmt.Tasks as Tasklist
     import gplmt.Worker as Worker
     import gplmt.Notifications as Notifications
     import getopt, getpass
-
 except ImportError as e: 
-    print "That's a bug! please check README: " + str (e)
+    print "That's a bug! please check README: " +  __file__+ " " + str (e)
     imports = False
+    
 
+
 def main():
     global main
     tasks_file = None
-    single_host = None
+    single_host = False
     nodes_file = None
     pl_password = None
     config_file = None    
-    pl_use_nodes = False
     verbose = False
     command = None
     startid = -1
-
+    target = Targets.Target (Targets.Target.undefined)
+    undefined_target = Targets.Target(Targets.Target.undefined)
     try:
         main = Main ()
         
     # Init
-        
     # Check dependencies 
         if (False == elementtree_loaded):
             print "ElementTree XML parsing module is required for execution, 
please check README"
@@ -84,9 +83,8 @@
             sys.exit(2)       
         
     # Parse command line arguments
-        
         try:
-            opts, args = getopt.getopt(sys.argv[1:], "C:hvVc:n:t:ap:s:H:", 
["help", "verbose", "config=", "nodes=", "tasks=", "command=", "all", 
"password", "startid", "host"])
+            opts, args = getopt.getopt(sys.argv[1:], "C:hvVc:n:t:ap:s:H:", 
["help", "verbose", "config=", "nodes=", "tasklist=", "command=", "all", 
"password", "startid", "host"])
         except getopt.GetoptError, err:
             # print help information and exit:
             print str(err) # will print something like "option -a not 
recognized"
@@ -104,10 +102,10 @@
                 single_host = a                     
             elif o in ("-n", "--nodes"):
                 nodes_file = Util.handle_filename(a)
-            elif o in ("-t", "--tasks"):
+            elif o in ("-t", "--target"):
+                target = Targets.Target.create(a)
+            elif o in ("-l", "--tasklist"):
                 tasks_file = Util.handle_filename(a)
-            elif o in ("-a", "--all"):
-                pl_use_nodes = True
             elif o in ("-p", "--password"):
                 pl_password = a
             elif o in ("-C", "--command"):
@@ -135,9 +133,7 @@
                 print "Failed to load default configuration..."
                 sys.exit(2)
                 
-        # Update configuration
-        if (True == pl_use_nodes):
-            configuration.pl_use_nodes = True        
+        # Update configuration      
         if (None != pl_password):
             configuration.pl_password = pl_password
         if (None != tasks_file):
@@ -145,48 +141,61 @@
         if (None != nodes_file):
             configuration.nodesfile = nodes_file                        
         
-        if ((True == configuration.pl_use_nodes) and 
(configuration.pl_password == None)):
-            while ((configuration.pl_password == None) or 
(configuration.pl_password == "")):
-                print "Please enter PlanetLab password:"            
-                configuration.pl_password = getpass.getpass()
-                configuration.pl_password = configuration.pl_password.strip()  
     
-       # Load hosts files: single host, nodes files, planetlab
-                # command line beats configuration
-        if ((None == single_host) and 
-            ("" == configuration.nodesfile) and
-            (False == configuration.pl_use_nodes)):
+        # Load taskfile file
+        if (None == command):
+            tasklist = Tasklist.Tasklist (configuration.taskfile, main.logger, 
startid);
+            if (tasklist.load() == False):
+                sys.exit(2)  
+        else:      
+            print "Running single command : " + str (command)
+            tasklist = Tasklist.Tasklist (configuration.taskfile, main.logger, 
startid);
+            tasklist.load_singletask(command, main.logger)
+             
+        # Check target
+        if ((target == undefined_target) and (tasklist.target == 
undefined_target)):  
+            print "No target to run on defined!"
+            return
+        if (target != undefined_target):
+            tasklist.target = target
+        print "Using target " +  str (tasklist.target)       
+        
+        if (target == Targets.Target (Targets.Target.planetlab)):            
+            if (configuration.pl_password == None):
+                while ((configuration.pl_password == None) or 
(configuration.pl_password == "")):
+                    print "Please enter PlanetLab password:"            
+                    configuration.pl_password = getpass.getpass()
+                    configuration.pl_password = 
configuration.pl_password.strip()              
+        
+    
+        # Load hosts files: single host, nodes files, planetlab
+        # command line beats configuration
+        if ((None == single_host) and  ("" == configuration.nodesfile) and
+            (target == Targets.Target (Targets.Target.planetlab))):
             print "No nodes to use given!\n"
             usage()
             sys.exit(4)
-        
+                
+        # Use a single host
         if (single_host != None):
             nodes = Nodes.StringNodes (single_host, main.logger)
             if (nodes.load() == False):
-                sys.exit(5)        
+                sys.exit(5) 
+        # Use a nodes file
         elif (configuration.nodesfile != ""):
             nodes = Nodes.Nodes (configuration.nodesfile, main.logger);
             if (nodes.load() == False):
-                sys.exit(7)                 
-        elif (configuration.pl_use_nodes == True):
+                sys.exit(7)      
+        elif (target == Targets.Target (Targets.Target.planetlab)):
+            # Load PlanetLab nodes                
             nodes = Nodes.PlanetLabNodes (configuration, main.logger)
             if (nodes.load() == False):
                 sys.exit(6)        
         else:
             print "No nodes file given!\n" 
-            sys.exit(8)        
+            sys.exit(8)      
     
-       # Load actions file
-        if (None == command):
-            tasks = Tasks.Tasks (configuration.taskfile, main.logger, startid);
-            if (tasks.load() == False):
-                sys.exit(2)  
-        else:      
-            print "Running single command : " + str (command)
-            tasks = Tasks.Tasks (configuration.taskfile, main.logger, startid);
-            tasks.load_singletask(command, main.logger) 
-    
-       # Set up notification
+        # Set up notification
         if (configuration.notifications == "simple"):
             notifications = Notifications.SimpleNotification (main.logger)
         elif (configuration.notifications == "result"):
@@ -198,7 +207,7 @@
 
 # Start execution
     try:
-        worker = Worker.Worker (main.logger, configuration, nodes, tasks, 
notifications)
+        worker = Worker.Worker (main.logger, configuration, nodes, tasklist, 
notifications)
         worker.start()
     except KeyboardInterrupt:
         print "Interrupt during execution, FIXME!"
@@ -214,7 +223,8 @@
 Arguments mandatory for long options are also mandatory for short options.\n\
   -c, --config=FILENAME      use configuration file FILENAME\n\
   -n, --nodes=FILENAME       use node file FILENAME\n\
-  -t, --tasks=FILENAME       use tasks file FILENAME\n\
+  -l, --tasks=FILENAME       use tasks file FILENAME\n\
+  -t, --target=TARGET        TARGET={local|remote_ssh|planetlab}\n\
   -C, --command=             run single command instead of taskfile, print 
output using -v\n\
   -a, --all                  use all nodes assigned to PlanetLab slice instead 
of nodes file\n\
   -p, --password             password to access PlanetLab API\n\




reply via email to

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