gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28181 - gnunet-planetlab/gplmt/gplmt
Date: Fri, 19 Jul 2013 09:52:41 +0200

Author: wachs
Date: 2013-07-19 09:52:40 +0200 (Fri, 19 Jul 2013)
New Revision: 28181

Modified:
   gnunet-planetlab/gplmt/gplmt/Worker.py
Log:
improved interuption handling


Modified: gnunet-planetlab/gplmt/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-19 07:41:33 UTC (rev 
28180)
+++ gnunet-planetlab/gplmt/gplmt/Worker.py      2013-07-19 07:52:40 UTC (rev 
28181)
@@ -110,7 +110,6 @@
         global interrupt
         tasklist_success = True
         # Connecting
-        res = False
         try:
             res = self.connect()
         except NotImplementedError as e:
@@ -119,20 +118,17 @@
         except Exception as e:
             print "Exception in Worker: " + str (e)
             pass
-        if (False == res):
-            g_notifications.node_connected (self.node, False, "Failed to 
connect")
+        if (Tasks.Taskresult.success != res.result):
+            g_notifications.node_connected (self.node, False, "Failed to 
connect: " + res.message)
             return
         else:
             g_notifications.node_connected (self.node, True, "Connected 
successfully")
-        
         # Starting tasklist 
         g_logger.log (self.node.hostname + " : Starting tasklist '" + 
self.tasks.name + "'")
         g_notifications.tasklist_started (self.node, self.tasks, "")           
 
-        task = self.tasks.get()
-        
+        task = self.tasks.get()        
         if (interrupt):
-            g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.user_interrupt, "")         
-               
+            g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.user_interrupt, "")                        
         # Executing Tasks 
         while (None != task and not interrupt):            
             g_logger.log (self.node.hostname + " : Running task id " 
+str(task.id)+" '" + task.name + "'")                        
@@ -162,7 +158,8 @@
             except Exception as e:
                 print "Exception in Worker:" + str (e)
                 pass
-            
+            if (interrupt):
+                break
             if ((task_result.result != Tasks.Taskresult.success) and 
(task.stop_on_fail == True)):
                 g_logger.log (self.node.hostname + " : Task failed and 
therefore execution is stopped")
                 g_notifications.task_completed (self.node, task, 
task_result.result, task_result.message, task_result.output)         
@@ -174,10 +171,9 @@
         if (interrupt):            
             g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.user_interrupt, "")
             if (None != task):
-                g_notifications.task_completed (self.node, task, 
task_result.user_interrupt, "task was interrupted", "")                     
-                     
-        if (False == tasklist_success):
-            g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.fail, "")
+                g_notifications.task_completed (self.node, task, 
Tasks.Taskresult.user_interrupt, "task was interrupted", "")                    
                     
+        elif (False == tasklist_success):
+            g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.fail, "")            
         else:
             g_notifications.tasklist_completed (self.node, self.tasks, 
Tasks.Taskresult.success, "")   
         #disconnect




reply via email to

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