gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r28136 - gnunet-planetlab/gplmt/gplmt
Date: Thu, 18 Jul 2013 09:48:18 +0200

Author: wachs
Date: 2013-07-18 09:48:18 +0200 (Thu, 18 Jul 2013)
New Revision: 28136

Modified:
   gnunet-planetlab/gplmt/gplmt/Tasks.py
Log:
read options while parsing tasklist


Modified: gnunet-planetlab/gplmt/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/gplmt/Tasks.py       2013-07-18 07:47:46 UTC (rev 
28135)
+++ gnunet-planetlab/gplmt/gplmt/Tasks.py       2013-07-18 07:48:18 UTC (rev 
28136)
@@ -47,8 +47,7 @@
     return_value_did_not_match = 3
     output_did_not_match = 4
     src_file_not_found = 5
-    user_interrupt = 6
-    
+    user_interrupt = 6    
 
 class Operation:
     none=0
@@ -240,6 +239,19 @@
     else:
         print "Invalid element in task file: " + elem.tag
 
+def handle_options (root, tasks):
+    for child in root:
+        if (child.tag == "target"):
+            if (child.text != None):
+                tasks.target = child.text
+                glogger.log ("Tasklist specified target: '" + 
str(tasks.target) + "'")
+        elif (child.tag == "log_dir"):
+            if (child.text != None):
+                tasks.log_dir = child.text
+                glogger.log ("Tasklist specified log dir: '" + 
str(tasks.log_dir) + "'")
+        else:
+            print "Invalid option in task file: " + str(child.tag)
+
 def print_sequence (l):
     for i in l:
         print "->",
@@ -253,16 +265,17 @@
     
 
 class Tasks:
-    def __init__(self, filename, logger, startid):
+    def __init__(self, filename, logger, startid, name="<Undefined>", 
log_dir="", target=None):
         assert (None != logger)
         global glogger
         glogger = logger
         self.logger = logger
         self.filename = filename
-        self.name = "<Undefined>"
         self.l = list ()
         self.startid = startid
         self.startid_found = False
+        self.log_dir = log_dir
+        self.target = target
     def load_singletask (self, cmd, logger):
         t = Task()
         self.name = "Execute single command"
@@ -312,7 +325,10 @@
             return False
         if (enabled == True):
             for child in root:
-                handle_child (child, self)
+                if (child.tag == "options"):
+                    handle_options (child, self)
+                else:
+                    handle_child (child, self)
         else:
             print "Tasklist " + self.filename + " was disabled"
         #print_sequence (self.l)




reply via email to

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