gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r22632 - in gnunet-planetlab/gplmt: . contrib
Date: Fri, 13 Jul 2012 17:05:03 +0200

Author: wachs
Date: 2012-07-13 17:05:03 +0200 (Fri, 13 Jul 2012)
New Revision: 22632

Added:
   gnunet-planetlab/gplmt/contrib/simpletasks.xml
Modified:
   gnunet-planetlab/gplmt/Tasks.py
   gnunet-planetlab/gplmt/contrib/tasks.xml
   gnunet-planetlab/gplmt/contrib/test.conf
Log:
- changes

Modified: gnunet-planetlab/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/Tasks.py     2012-07-13 14:15:34 UTC (rev 22631)
+++ gnunet-planetlab/gplmt/Tasks.py     2012-07-13 15:05:03 UTC (rev 22632)
@@ -41,6 +41,7 @@
         self.expected_return_code = 0
         self.expected_output = ""
         self.stop_on_fail = False
+        self.next = None
     def log (self):
         glogger.log ("Task " + str(self.id) + ": " + self.name)
     def check (self):
@@ -75,34 +76,47 @@
             t.stop_on_fail = child.text
 
     if (False == t.check()):
-        print "Parsing invalid task with id " + str (t.id) + " name " + t.name 
+        print "Parsing invalid task with id " + str (t.id) + " name " + t.name
+        return None 
     else:
         t.log ()
+        return t
     
     
     #for child in task:        
     #        handle_child (child)
 
-def handle_sequence (elem):
+def handle_sequence (elem, list):
     print "sequence"
     for child in elem:
-            handle_child (child)
+            handle_child (child, list)
             
-def handle_parallel (elem):
+def handle_parallel (elem, list):
     print "parallel " + str(len(elem))
     
-    for child in elem:
-            handle_child (child)
+    #for child in elem:
+    #        handle_child (child)
     
-def handle_child (elem):
+def handle_child (elem, list):
     if (elem.tag == "task"):
-        handle_task (elem)
+        t = handle_task (elem)
+        if (None != t):
+            list.append(t)
+    elif (elem.tag == "parallel"):
+        handle_parallel (elem, list)
+    elif (elem.tag == "sequence"):
+        handle_sequence (elem, list)
     else:
-        if (elem.tag == "parallel"):
-            handle_parallel (elem)
-        if  (elem.tag == "sequence"):
-            handle_sequence (elem)
+        print "Invalid element in task file: " + elem.tag
 
+def print_sequence (list):
+    print "|",
+    for i in list:
+        print "->",
+        print i.name,
+
+    
+
 class Tasks:
     def __init__(self, filename, logger):
         assert (None != logger)
@@ -110,6 +124,7 @@
         glogger = logger
         self.logger = logger
         self.filename = filename
+        self.list = list ()
     def load (self):        
         self.logger.log ("Loading nodes file '" + self.filename + "'")
         try:
@@ -119,4 +134,6 @@
             return False
         print " root"
         for child in root:
-            handle_child (child)
+            handle_child (child, self.list)
+        print "Result"
+        print_sequence (self.list)

Added: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml                              
(rev 0)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml      2012-07-13 15:05:03 UTC 
(rev 22632)
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tasklist 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> 
+        <expected_return_code>0</expected_return_code>
+        <expected_output></expected_output>
+        <stop_on_fail>0</stop_on_fail>
+    </task> 
+</tasklist>

Modified: gnunet-planetlab/gplmt/contrib/tasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/tasks.xml    2012-07-13 14:15:34 UTC (rev 
22631)
+++ gnunet-planetlab/gplmt/contrib/tasks.xml    2012-07-13 15:05:03 UTC (rev 
22632)
@@ -12,7 +12,7 @@
     </task> 
     <parallel>
       <task>
-        <id>0</id>
+        <id>1</id>
         <name>run p2a</name>
         <type>run</type> 
         <command>cat</command> 
@@ -22,7 +22,7 @@
         <stop_on_fail>0</stop_on_fail>
     </task> 
       <task>
-        <id>0</id>
+        <id>2</id>
         <name>run p2b</name>
         <type>run</type> 
         <command>cat</command> 
@@ -32,8 +32,9 @@
         <stop_on_fail>0</stop_on_fail>
     </task>     
     </parallel>
+    <sequence>
       <task>
-        <id>0</id>
+        <id>3</id>
         <name>run 3</name>
         <type>run</type> 
         <command>cat</command> 
@@ -41,5 +42,16 @@
         <expected_return_code>0</expected_return_code>
         <expected_output></expected_output>
         <stop_on_fail>0</stop_on_fail>
-    </task> 
+         </task>
+          <task>
+        <id>4</id>
+        <name>run 4</name>
+        <type>run</type> 
+        <command>cat</command> 
+        <arguments></arguments> 
+        <expected_return_code>0</expected_return_code>
+        <expected_output></expected_output>
+        <stop_on_fail>0</stop_on_fail>
+         </task>
+    </sequence> 
 </tasklist>

Modified: gnunet-planetlab/gplmt/contrib/test.conf
===================================================================
--- gnunet-planetlab/gplmt/contrib/test.conf    2012-07-13 14:15:34 UTC (rev 
22631)
+++ gnunet-planetlab/gplmt/contrib/test.conf    2012-07-13 15:05:03 UTC (rev 
22632)
@@ -1,4 +1,5 @@
 [planetlab]
 slice = tum_dht_testing
 nodes = contrib/current.nodes
+#tasks = contrib/simpletasks.xml
 tasks = contrib/tasks.xml




reply via email to

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