gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22988 - in gnunet-planetlab/gplmt: . contrib
Date: Mon, 30 Jul 2012 16:53:00 +0200

Author: wachs
Date: 2012-07-30 16:53:00 +0200 (Mon, 30 Jul 2012)
New Revision: 22988

Modified:
   gnunet-planetlab/gplmt/Notifications.py
   gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf
   gnunet-planetlab/gplmt/gplmt.py
Log:
result logger


Modified: gnunet-planetlab/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/Notifications.py     2012-07-30 14:46:36 UTC (rev 
22987)
+++ gnunet-planetlab/gplmt/Notifications.py     2012-07-30 14:53:00 UTC (rev 
22988)
@@ -22,6 +22,7 @@
 #
 # Notifications     
 import Tasks
+import time
 
 class Notification:
     def __init__(self, logger):
@@ -39,11 +40,79 @@
         assert (0)
     def task_completed (self, node, tasks, success):
         assert (0)
+
+class NodeCollection:
+    def __init__(self):
+        self.nodes = list ()
+    def add (self, node):
+        self.nodes.append (node)
+    def get (self, name):
+        for n in self.nodes:
+            if (n.name == name):
+                return n
+        return None
         
+class Task:
+    def __init__(self, task, result, fail):
+        self.task = task
+        self.result = result
+        self.fail = fail
+        
+class Node:
+    def __init__(self, name):
+        self.name = name
+        self.start = time.time()
+        self.end = 0
+        self.tasks = list ()
+
+class TaskListResultNotification (Notification):
+    def __init__(self, logger):
+        assert (None != logger)
+        self.logger = logger
+        #self.nodes = NodeCollection ()
+    def summarize (self):
+        for n in self.nodes:
+            tsk_str = ""
+            for t in n.tasks:
+                tsk_f = "[e]"
+                if (t.fail == True):
+                    tsk_f = "[f]"
+                else:
+                    tsk_f = "[s]"
+                tsk_str += t.task.name + " " + tsk_f + " ->"
+            print n.name
+    def node_connected (self, node, success):
+        return
+    def node_disconnected (self, node, success):
+        return 
+    def tasklist_started (self, node, tasks):
+        return
+    def tasklist_completed (self, node, tasks, success):
+        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):
+        return
+    def task_completed (self, node, task, result):
+        return         
+
 class SimpleNotification (Notification):
     def __init__(self, logger):
         assert (None != logger)
         self.logger = logger
+        #self.nodes = NodeCollection ()
+    def summarize (self):
+        for n in self.nodes:
+            tsk_str = ""
+            for t in n.tasks:
+                tsk_f = "[e]"
+                if (t.fail == True):
+                    tsk_f = "[f]"
+                else:
+                    tsk_f = "[s]"
+                tsk_str += t.task.name + " " + tsk_f + " ->"
+            print n.name
     def node_connected (self, node, success):
         if (success == True):
             print node + " : connected successfully"
@@ -56,6 +125,7 @@
             print node + " : disconnected with failure"    
     def tasklist_started (self, node, tasks):
         print node + " : Tasklist '" +  tasks.name + "' started"
+        #self.nodes.add (Node(node))
     def tasklist_completed (self, node, tasks, success):
         if (success == True):
             print node + " : Tasklist '" +  tasks.name + "' completed 
successfully"

Modified: gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf
===================================================================
--- gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf     
2012-07-30 14:46:36 UTC (rev 22987)
+++ gnunet-planetlab/gplmt/contrib/deploy_to_tumple_deployment.conf     
2012-07-30 14:53:00 UTC (rev 22988)
@@ -1,10 +1,11 @@
 [gplmt]
 nodes = contrib/test_node.nodes
-tasks = contrib/deploy_gnunet_fc12.xml
+tasks = contrib/deploy_gnunet_fc8.xml
 
 # Which notification mechanism to use: 
 # simple: print messages to stdout
-notification = simple
+#notification = simple
+notification = result
 
 [planetlab]
 slice = tumple_gnunet_deployment

Modified: gnunet-planetlab/gplmt/gplmt.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt.py     2012-07-30 14:46:36 UTC (rev 22987)
+++ gnunet-planetlab/gplmt/gplmt.py     2012-07-30 14:53:00 UTC (rev 22988)
@@ -146,16 +146,18 @@
         sys.exit(2)        
 
 # Set up notifications
+
     if (configuration.notifications == "simple"):
         notifications = Notifications.SimpleNotification (main.logger)
+    if (configuration.notifications == "result"):
+        notifications = Notifications.TaskListResultNotification (main.logger)
     else:
-        notifications = Notifications.SimpleNotification (main.logger)
+        notifications = Notifications.TaskListResultNotification (main.logger)
 
 # Start execution
     worker = Worker.Worker (main.logger, configuration, nodes, tasks, 
notifications)
     worker.start()
-    
-    print "HERE"
+
 # Clean up
 
 




reply via email to

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