gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22721 - in gnunet-planetlab/gplmt: . contrib
Date: Tue, 17 Jul 2012 17:17:21 +0200

Author: wachs
Date: 2012-07-17 17:17:21 +0200 (Tue, 17 Jul 2012)
New Revision: 22721

Added:
   gnunet-planetlab/gplmt/Notifications.py
Modified:
   gnunet-planetlab/gplmt/Tasks.py
   gnunet-planetlab/gplmt/Worker.py
   gnunet-planetlab/gplmt/contrib/simpletasks.xml
   gnunet-planetlab/gplmt/contrib/tasks.xml
   gnunet-planetlab/gplmt/gplmt.py
   gnunet-planetlab/gplmt/tasklist_schema.xsd
Log:
- modifications


Added: gnunet-planetlab/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/Notifications.py                             (rev 0)
+++ gnunet-planetlab/gplmt/Notifications.py     2012-07-17 15:17:21 UTC (rev 
22721)
@@ -0,0 +1,30 @@
+#!/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 
+#
+# Notifications
+
+class Notification:
+    def __init__(self, logger):
+        assert (None != logger)
+        self.logger = logger
+    def tasklist_started (self, tasks):
+        print "Tasklist '" +  tasks.name + "' started"
\ No newline at end of file

Modified: gnunet-planetlab/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/Tasks.py     2012-07-17 14:59:10 UTC (rev 22720)
+++ gnunet-planetlab/gplmt/Tasks.py     2012-07-17 15:17:21 UTC (rev 22721)
@@ -38,6 +38,7 @@
         self.type = Operation.none
         self.command = ""
         self.arguments = ""
+        self.timeout = 0
         self.expected_return_code = 0
         self.expected_output = ""
         self.stop_on_fail = False
@@ -56,10 +57,14 @@
 def handle_task (elem):
     t = Task ()
     for child in elem:
+        if (child.tag == "name"):
+            t.name = child.text
         if (child.tag == "id"):
+            try:
+                t.id = int(child.text)
+            except ValueError:
+                print "Invalid id '"+child.text+"' for task name " + t.name
             t.id = child.text
-        if (child.tag == "name"):
-            t.name = child.text
         if (child.tag == "type"):
             if (child.text == "run"):            
                 t.type = Operation.run
@@ -73,8 +78,16 @@
             t.command = child.text
         if (child.tag == "arguments"):
             t.arguments = child.text
+        if (child.tag == "timeout"):
+            try:
+                t.timeout = int(child.text)
+            except ValueError:
+                print "Invalid timeout '"+child.text+"' for task id " + str 
(t.id) + " name " + t.name
         if (child.tag == "expected_return_code"):
-            t.expected_return_code = child.text
+            try:
+                t.expected_return_code = int(child.text)
+            except ValueError:
+                print "Invalid expected return code '" +child.text+ "' for 
task id " + str (t.id) + " name " + t.name            
         if (child.tag == "stop_on_fail"):
             t.stop_on_fail = child.text
 
@@ -84,10 +97,6 @@
     else:
         t.log ()
         return t
-    
-    
-    #for child in task:        
-    #        handle_child (child)
 
 def handle_sequence (elem, l):
     for child in elem:
@@ -95,7 +104,6 @@
             
 def handle_parallel (elem, l):
     glogger.log ("Found parallel execution with " + str(len(elem)) + " 
elements")
-
     ptask = Taskset ()
     for child in elem:
         if (elem.tag == "task"):
@@ -104,10 +112,10 @@
                 ptask.set.append(t)
                 print "Added " + t.name + " to set"
         elif (elem.tag == "parallel"):
-            print "x"
+            glogger.log ("x")
         #    handle_parallel (elem, l)
         elif (elem.tag == "sequence"):
-            print "x"
+            glogger.log ("x")
         #        handle_sequence (elem, l)
         else:
             print "Invalid element in task file: " + elem.tag
@@ -144,11 +152,13 @@
         glogger = logger
         self.logger = logger
         self.filename = filename
+        self.name = None
         self.l = list ()
     def load (self):        
         self.logger.log ("Loading nodes file '" + self.filename + "'")
         try:
            root = ElementTree.parse (self.filename).getroot()     
+           self.name = root.attrib.get("name")
         except IOError:
             print "File " + self.filename + " not found"
             return False

Modified: gnunet-planetlab/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/Worker.py    2012-07-17 14:59:10 UTC (rev 22720)
+++ gnunet-planetlab/gplmt/Worker.py    2012-07-17 15:17:21 UTC (rev 22721)
@@ -27,13 +27,6 @@
 
 exitFlag = 0
 
-def print_time(threadName, delay, counter):
-    while counter:
-        if exitFlag:
-            thread.exit()
-        time.sleep(delay)
-        print "%s: %s" % (threadName, time.ctime(time.time()))
-        counter -= 1
 
 class NodeWorkerThread (threading.Thread):
     def __init__(self, threadID, name, tasks):

Modified: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml      2012-07-17 14:59:10 UTC 
(rev 22720)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml      2012-07-17 15:17:21 UTC 
(rev 22721)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<tasklist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="../tasklist_schema.xsd">
-  <task>
+<tasklist name="Simple task list" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="../tasklist_schema.xsd">
+  <task name="simple tasks">
         <id>0</id>
         <name>run 1</name>
         <type>run</type> 

Modified: gnunet-planetlab/gplmt/contrib/tasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/tasks.xml    2012-07-17 14:59:10 UTC (rev 
22720)
+++ gnunet-planetlab/gplmt/contrib/tasks.xml    2012-07-17 15:17:21 UTC (rev 
22721)
@@ -1,11 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<tasklist xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="../tasklist_schema.xsd">
+<tasklist name="Tasklist example" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:noNamespaceSchemaLocation="../tasklist_schema.xsd">
   <task>
         <id>0</id>
         <name>run 1</name>
         <type>run</type> 
         <command>cat</command> 
-        <arguments></arguments> 
+        <arguments></arguments>
+        <timeout>10</timeout> 
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>
@@ -17,6 +18,7 @@
         <type>run</type> 
         <command>cat</command> 
         <arguments></arguments> 
+        <timeout>30</timeout>
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>
@@ -27,6 +29,7 @@
         <type>run</type> 
         <command>cat</command> 
         <arguments></arguments> 
+        <timeout>30</timeout>
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>
@@ -39,6 +42,7 @@
         <type>run</type> 
         <command>cat</command> 
         <arguments></arguments> 
+        <timeout>30</timeout>
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>
@@ -49,6 +53,7 @@
         <type>run</type> 
         <command>cat</command> 
         <arguments></arguments> 
+        <timeout>30</timeout>
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>

Modified: gnunet-planetlab/gplmt/gplmt.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt.py     2012-07-17 14:59:10 UTC (rev 22720)
+++ gnunet-planetlab/gplmt/gplmt.py     2012-07-17 15:17:21 UTC (rev 22721)
@@ -93,8 +93,6 @@
     configuration = Configuration.Configuration (main.config_file, 
main.logger);
     if (configuration.load() == False):
         sys.exit(2)
-
-
     
     # command line beats configuration
     if (main.nodes_file == ""):
@@ -121,7 +119,11 @@
     tasks = Tasks.Tasks (main.tasks_file, main.logger);
     if (tasks.load() == False):
         sys.exit(2)        
+    sys.exit(2)   
 
+# Set up notifications
+
+
 # Start execution
     worker = Worker.Worker (main.logger, nodes, tasks)
     worker.start()

Modified: gnunet-planetlab/gplmt/tasklist_schema.xsd
===================================================================
--- gnunet-planetlab/gplmt/tasklist_schema.xsd  2012-07-17 14:59:10 UTC (rev 
22720)
+++ gnunet-planetlab/gplmt/tasklist_schema.xsd  2012-07-17 15:17:21 UTC (rev 
22721)
@@ -9,7 +9,8 @@
       <xs:element name="parallel" type="parallel" />
       <xs:element name="task" type="task" />
     </xs:choice>
-  </xs:sequence>
+  </xs:sequence>
+  <xs:attribute name="name" type="xs:string"/>
 </xs:complexType>
 
 <xs:complexType name="sequence">
@@ -38,7 +39,8 @@
     <xs:element name="name" type="xs:string"/>
     <xs:element name="type" type="xs:string"/>
     <xs:element name="command" type="xs:string"/>
-    <xs:element name="arguments" type="xs:string"/>
+    <xs:element name="arguments" type="xs:string"/>
+    <xs:element name="timeout" type="xs:integer"/>
     <xs:element name="expected_return_code"  type="xs:integer"/>
     <xs:element name="expected_output" type="xs:string"/>
     <xs:element name="stop_on_fail" type="xs:boolean"/>




reply via email to

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