gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r23262 - gnunet-planetlab/gplmt/gplmt
Date: Thu, 16 Aug 2012 16:54:32 +0200

Author: wachs
Date: 2012-08-16 16:54:32 +0200 (Thu, 16 Aug 2012)
New Revision: 23262

Modified:
   gnunet-planetlab/gplmt/gplmt/Tasks.py
   gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
object instance fun


Modified: gnunet-planetlab/gplmt/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Tasks.py       2012-08-16 14:44:30 UTC (rev 
23261)
+++ gnunet-planetlab/gplmt/gplmt/Tasks.py       2012-08-16 14:54:32 UTC (rev 
23262)
@@ -70,6 +70,24 @@
         self.dest = None
         self.command_file = None
         self.output_prefix = None
+        
+    def copy (self):
+        t = Task ()
+        t.id = self.id 
+        t.name = self.name
+        t.type = self.type
+        t.command = self.command
+        t.arguments = self.arguments
+        t.timeout = self.timeout
+        t.expected_return_code = self.expected_return_code
+        t.expected_output = self.expected_output
+        t.stop_on_fail = self.stop_on_fail
+        t.set = self.set
+        t.src = self.src
+        t.dest = self.dest
+        t.command_file = self.command_file
+        t.output_prefix = self.output_prefix
+        return t
     def log (self):
         glogger.log ("Task " + str(self.id) + ": " + self.name)
     def check (self):

Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py      2012-08-16 14:44:30 UTC (rev 
23261)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py      2012-08-16 14:54:32 UTC (rev 
23262)
@@ -69,37 +69,39 @@
                     continue;
                 sline = line.split (';',2)
                 if (sline[0] == self.node):
-                    cmd = sline[1]
+                    cmd = sline[1].strip()
                     found = True
                 if (sline[0] == ''):
-                    default = sline[1]
+                    default = sline[1].strip()
             f.close()
         except IOError as e:
             print str(e)
         
+        t = task.copy()
         if (found == True):
             g_logger.log (self.node + " : Found specific command '"+ cmd + "'")
-            task.command = cmd
-            task.arguments = ""
+            t.command = cmd
+            t.arguments = ""
         elif ((found == False) and (default != None)):
             g_logger.log (self.node + " : Using default command '"+ default + 
"'")
-            task.command = default
-            task.arguments = ""
+            t.command = default
+            t.arguments = ""
         else:
             g_logger.log (self.node + " : Task '"+ task.name + "' failed: no 
command to execute")
             return Tasks.Taskresult.fail
-        return self.exec_run(task, transport)
         
+        return self.exec_run(t, transport)
+        
     def exec_run (self, task, transport):
         if ((task.command == None) and (task.arguments == None)):
             g_logger.log (self.node + " : Task '"+ task.name + "' failed: no 
command to execute")
             return Tasks.Taskresult.fail
-            
+    
         try:
             channel = transport.open_session()
             channel.settimeout(1.0)
             channel.get_pty ()
-            #print "CMD: " + task.command + " " + task.arguments
+            #print self.node + " CMD: " + task.command + " " + task.arguments
             channel.exec_command(task.command + " " + task.arguments)
             
         except SSHException as e:




reply via email to

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