gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28048 - gnunet-planetlab/gplmt/gplmt
Date: Mon, 15 Jul 2013 14:46:04 +0200

Author: wachs
Date: 2013-07-15 14:46:04 +0200 (Mon, 15 Jul 2013)
New Revision: 28048

Modified:
   gnunet-planetlab/gplmt/gplmt/Notifications.py
   gnunet-planetlab/gplmt/gplmt/Util.py
   gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
adding support for error messages to figure out ssh errors


Modified: gnunet-planetlab/gplmt/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Notifications.py       2013-07-15 12:26:57 UTC 
(rev 28047)
+++ gnunet-planetlab/gplmt/gplmt/Notifications.py       2013-07-15 12:46:04 UTC 
(rev 28048)
@@ -34,17 +34,17 @@
     def __init__(self, logger):
         assert (None != logger)
         self.logger = logger
-    def node_connected (self, node, success):
+    def node_connected (self, node, success, message):
         assert (0)
-    def node_disconnected (self, node, success):
+    def node_disconnected (self, node, success, message):
         assert (0) 
-    def tasklist_started (self, node, tasks):
+    def tasklist_started (self, node, tasks, message):
         assert (0)
-    def tasklist_completed (self, node, tasks, success):
+    def tasklist_completed (self, node, tasks, success, message):
         assert (0)
-    def task_started (self, node, tasks):
+    def task_started (self, node, tasks, message):
         assert (0)
-    def task_completed (self, node, tasks, success):
+    def task_completed (self, node, tasks, success, message):
         assert (0)
 
 class NodeCollection:
@@ -90,6 +90,7 @@
         self.tasks = list ()
         self.tasklists = TaskListCollection()
         self.connectSuccess = False
+        self.error_msg = ""
 
 
 class FileLoggerNotification (Notification):
@@ -97,21 +98,21 @@
         assert (None != logger)
         self.logger = logger
         self.nodes = NodeCollection ()
-    def node_connected (self, node, success):
+    def node_connected (self, node, success, message):
         return
-    def node_disconnected (self, node, success):
+    def node_disconnected (self, node, success, message):
         return 
-    def tasklist_started (self, node, tasks):
+    def tasklist_started (self, node, tasks, message):
         return
-    def tasklist_completed (self, node, tasks, success):
+    def tasklist_completed (self, node, tasks, success, message):
         self.nodes.add (Node(node))
         if (success == True):
             print node + " : Tasklist '" +  tasks.name + "' completed 
successfully"
         else:
             print node + " : Tasklist '" +  tasks.name + "' completed with 
failure"
-    def task_started (self, node, task):
+    def task_started (self, node, task, message):
         return
-    def task_completed (self, node, task, result):
+    def task_completed (self, node, task, result, message):
         return   
 
 
@@ -143,7 +144,7 @@
                 sys.stdout.write(tl.name)
                 diff = maxTasklistLen - len(tl.name)
                 sys.stdout.write(' ' * diff + ' | ')
-                print 'success' if tl.success else 'fail'
+                print 'success' if tl.success else n.error_msg
         #    tsk_str = ""
         #    for t in n.tasks:
         #        tsk_f = "[e]"
@@ -153,7 +154,7 @@
         #            tsk_f = "[s]"
         #        tsk_str += t.task.name + " " + tsk_f + " ->"
         #    print n.name
-    def node_connected (self, node, success):
+    def node_connected (self, node, success, message):
         # Get node object
         nodeObj = self.nodes.get(node)
         # Create it if it doesn't exist
@@ -163,13 +164,15 @@
         # Set node start time as of now
         nodeObj.start = time.time()
         nodeObj.connectSuccess = success
+        if (False == success):
+            nodeObj.error_msg = message
         return
-    def node_disconnected (self, node, success):
+    def node_disconnected (self, node, success, message):
         # Mainly need to set node end connection time
         nodeObj = self.nodes.get(node)
         nodeObj.end = time.time()
         return 
-    def tasklist_started (self, node, tasks):
+    def tasklist_started (self, node, tasks, message):
         # Get node object
         nodeObj = self.nodes.get(node)
         # Create it if it doesn't exist (shouldn't node_connected be called 
before this?)
@@ -181,7 +184,7 @@
         # Add it to the collection of node tasklists
         nodeObj.tasklists.add(tasklist)
         return
-    def tasklist_completed (self, node, tasks, success):
+    def tasklist_completed (self, node, tasks, success, message):
         # Mainly want to set tasklist end time and success status
         nodeObj = self.nodes.get(node)
         tasklist = nodeObj.tasklists.get(tasks.name)
@@ -191,9 +194,9 @@
         #    print node + " : Tasklist '" +  tasks.name + "' completed 
successfully"
         #else:
         #    print node + " : Tasklist '" +  tasks.name + "' completed with 
failure"
-    def task_started (self, node, task):
+    def task_started (self, node, task, message):
         return
-    def task_completed (self, node, task, result):
+    def task_completed (self, node, task, result, message):
         return         
 
 class SimpleNotification (Notification):
@@ -213,27 +216,27 @@
         #        tsk_str += t.task.name + " " + tsk_f + " ->"
         #    print n.name
         return
-    def node_connected (self, node, success):
+    def node_connected (self, node, success, message):
         if (success == True):
             print node + " : connected successfully"
         else:
-            print node + " : connection failed"
-    def node_disconnected (self, node, success):
+            print node + " : connection failed: " + message
+    def node_disconnected (self, node, success, message):
         if (success == True):
             print node + " : disconnected"
         else:
             print node + " : disconnected with failure"    
-    def tasklist_started (self, node, tasks):
+    def tasklist_started (self, node, tasks, message):
         print node + " : Tasklist '" +  tasks.name + "' started"
         #self.nodes.add (Node(node))
-    def tasklist_completed (self, node, tasks, success):
+    def tasklist_completed (self, node, tasks, success, message):
         if (success == True):
             print node + " : Tasklist '" +  tasks.name + "' completed 
successfully"
         else:
             print node + " : Tasklist '" +  tasks.name + "' completed with 
failure"
-    def task_started (self, node, task):
+    def task_started (self, node, task, message):
         print node + " : Task '" +  task.name + "' started"
-    def task_completed (self, node, task, result):
+    def task_completed (self, node, task, result, message):
         if (result == Tasks.Taskresult.success):
             print node + " : Task '" +  task.name + "' completed successfully"
         elif (result == Tasks.Taskresult.src_file_not_found):

Modified: gnunet-planetlab/gplmt/gplmt/Util.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Util.py        2013-07-15 12:26:57 UTC (rev 
28047)
+++ gnunet-planetlab/gplmt/gplmt/Util.py        2013-07-15 12:46:04 UTC (rev 
28048)
@@ -53,7 +53,7 @@
         if (True == verbose):
             self.verbose = True
         else:
-            self.verbose = False
+            self.verbose = False   
     def log (self, message):
         global main
         if (True == self.verbose):

Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-15 12:26:57 UTC (rev 
28047)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-15 12:46:04 UTC (rev 
28048)
@@ -333,30 +333,30 @@
                 paramiko.AuthenticationException,
                 socket.error) as e:  
             g_logger.log (self.node.hostname + " : Error while trying to 
connect: " + str(e))
-            g_notifications.node_connected (self.node.hostname, False)
-            g_notifications.tasklist_completed (self.node.hostname, 
self.tasks, False)
+            g_notifications.node_connected (self.node.hostname, False, str(e))
+            g_notifications.tasklist_completed (self.node.hostname, 
self.tasks, False, "")
             return
         
-        g_notifications.node_connected (self.node.hostname, True)
+        g_notifications.node_connected (self.node.hostname, True, "")
         transport = ssh.get_transport()        
         success = True
         result = Tasks.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)
+            g_notifications.task_started (self.node.hostname, task, "")
             if (task.__class__.__name__ == "Task"):
                 if (task.type == Tasks.Operation.run):
                     result = self.exec_run (task, transport)
-                    g_notifications.task_completed (self.node.hostname, task, 
result)
+                    g_notifications.task_completed (self.node.hostname, task, 
result, "")
                 elif (task.type == Tasks.Operation.put):
                     result = self.exec_put (task, transport)
-                    g_notifications.task_completed (self.node.hostname, task, 
result)
+                    g_notifications.task_completed (self.node.hostname, task, 
result, "")
                 elif (task.type == Tasks.Operation.get):
                     result = self.exec_get (task, transport)
-                    g_notifications.task_completed (self.node.hostname, task, 
result)
+                    g_notifications.task_completed (self.node.hostname, task, 
result, "")
                 elif (task.type == Tasks.Operation.run_per_host):
                     result = self.exec_run_per_host (task, transport)
-                    g_notifications.task_completed (self.node.hostname, task, 
result)                    
+                    g_notifications.task_completed (self.node.hostname, task, 
result, "")                    
                 else:
                     print "UNSUPPORTED OPERATION!"                    
             elif (task.__class__.__name__ == "Taskset"):
@@ -374,8 +374,8 @@
             task = self.tasks.get()
         
         ssh.close()
-        g_notifications.node_disconnected (self.node.hostname, True)
-        g_notifications.tasklist_completed (self.node.hostname, self.tasks, 
success)
+        g_notifications.node_disconnected (self.node.hostname, True, "")
+        g_notifications.tasklist_completed (self.node.hostname, self.tasks, 
success, "")
         g_logger.log (self.node.hostname + " : All tasks done for " + 
self.node.hostname)
         
 
@@ -389,7 +389,7 @@
         self.thread = None
     def start (self):
         g_logger.log ("Starting execution for node " + self.node.hostname)
-        g_notifications.tasklist_started (self.node.hostname, self.tasks)
+        g_notifications.tasklist_started (self.node.hostname, self.tasks, "")
         self.thread = NodeWorkerThread (1, self.node, self.tasks)
         self.thread.start()
     




reply via email to

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