[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22780 - in gnunet-planetlab/gplmt: . contrib
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22780 - in gnunet-planetlab/gplmt: . contrib |
Date: |
Fri, 20 Jul 2012 10:39:36 +0200 |
Author: wachs
Date: 2012-07-20 10:39:36 +0200 (Fri, 20 Jul 2012)
New Revision: 22780
Modified:
gnunet-planetlab/gplmt/Tasks.py
gnunet-planetlab/gplmt/contrib/simpletasks.xml
gnunet-planetlab/gplmt/tasklist_schema.xsd
Log:
modified schmea
Modified: gnunet-planetlab/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/Tasks.py 2012-07-20 08:07:11 UTC (rev 22779)
+++ gnunet-planetlab/gplmt/Tasks.py 2012-07-20 08:39:36 UTC (rev 22780)
@@ -29,6 +29,8 @@
glogger = None
+supported_operations = ["run", "monitor", "get", "put"]
+
class Taskresult:
success=0
timeout=1
@@ -38,8 +40,9 @@
class Operation:
none=0
run=1
- get=2
- put=3
+ monitor=2
+ get=3
+ put=4
class Task:
def __init__(self):
@@ -66,24 +69,25 @@
def handle_task (elem):
t = Task ()
+
+ if (None != elem.attrib.get("name")):
+ t.name = elem.attrib.get("name")
+
+ if (None != elem.attrib.get("id")):
+ t.id = elem.attrib.get("id")
+
+ if (elem.tag == "run"):
+ t.type = Operation.run
+ elif (elem.tag == "monitor"):
+ t.type = Operation.monitor
+ elif (elem.text == "get"):
+ t.type = Operation.get
+ elif (elem.text == "put"):
+ t.type = Operation.put
+ else:
+ t.type = Operation.none
+
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 == "type") and (child.text != None)):
- if (child.text == "run"):
- t.type = Operation.run
- elif (child.text == "get"):
- t.type = Operation.get
- elif (child.text == "put"):
- t.type = Operation.put
- else:
- t.type = Operation.none
if ((child.tag == "command") and (child.text != None)):
t.command = child.text
if ((child.tag == "arguments") and (child.text != None)):
@@ -121,7 +125,7 @@
glogger.log ("Found parallel execution with " + str(len(elem)) + "
elements")
ptask = Taskset ()
for child in elem:
- if (elem.tag == "task"):
+ if (elem.tag in supported_operations):
t = handle_task (elem)
if (None != t):
ptask.set.append(t)
@@ -137,7 +141,8 @@
l.append (ptask)
def handle_child (elem, l):
- if (elem.tag == "task"):
+ global support_operations
+ if (elem.tag in supported_operations):
t = handle_task (elem)
if (None != t):
l.append(t)
Modified: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-20 08:07:11 UTC
(rev 22779)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-20 08:39:36 UTC
(rev 22780)
@@ -1,24 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>get date</name>
- <type>run</type>
+ <run id="0" name="get date">
<command>date</command>
<arguments></arguments>
+ <timeout>0</timeout>
<expected_return_code>0</expected_return_code>
<expected_output>2012</expected_output>
- <stop_on_fail>yes</stop_on_fail>
- </task>
- <task name="simple tasks">
- <id>0</id>
- <name>get date</name>
- <type>run</type>
+ <stop_on_fail>true</stop_on_fail>
+ </run>
+ <run id="1" name="sleep 3">
<command>sleep 3</command>
<arguments></arguments>
<timeout>10</timeout>
<expected_return_code>0</expected_return_code>
<expected_output></expected_output>
- <stop_on_fail>yes</stop_on_fail>
- </task>
+ <stop_on_fail>true</stop_on_fail>
+ </run>
</tasklist>
Modified: gnunet-planetlab/gplmt/tasklist_schema.xsd
===================================================================
--- gnunet-planetlab/gplmt/tasklist_schema.xsd 2012-07-20 08:07:11 UTC (rev
22779)
+++ gnunet-planetlab/gplmt/tasklist_schema.xsd 2012-07-20 08:39:36 UTC (rev
22780)
@@ -7,7 +7,10 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="sequence" type="sequence" />
<xs:element name="parallel" type="parallel" />
- <xs:element name="task" type="task" />
+ <xs:element name="run" type="run" />
+ <xs:element name="monitor" type="monitor" />
+ <xs:element name="put" type="put" />
+ <xs:element name="get" type="get" />
</xs:choice>
</xs:sequence>
<xs:attribute name="name" type="xs:string"/>
@@ -18,7 +21,10 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="sequence" type="sequence" />
<xs:element name="parallel" type="parallel" />
- <xs:element name="task" type="task" />
+ <xs:element name="run" type="run" />
+ <xs:element name="monitor" type="monitor" />
+ <xs:element name="put" type="put" />
+ <xs:element name="get" type="get" />
</xs:choice>
</xs:sequence>
</xs:complexType>
@@ -28,24 +34,58 @@
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="sequence" type="sequence" />
<xs:element name="parallel" type="parallel" />
- <xs:element name="task" type="task" />
+ <xs:element name="run" type="run" />
+ <xs:element name="monitor" type="monitor" />
+ <xs:element name="put" type="put" />
+ <xs:element name="get" type="get" />
</xs:choice>
</xs:sequence>
</xs:complexType>
-
-<xs:complexType name="task">
+
+<xs:complexType name="run">
<xs:sequence>
- <xs:element name="id" type="xs:integer"/>
- <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="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"/>
- </xs:sequence>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:integer"/>
+ <xs:attribute name="name" type="xs:string"/>
+</xs:complexType>
+
+<xs:complexType name="monitor">
+ <xs:sequence>
+ <xs:element name="command" 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"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:integer"/>
+ <xs:attribute name="name" type="xs:string"/>
</xs:complexType>
+<xs:complexType name="put">
+ <xs:sequence>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="destination" type="xs:string"/>
+ <xs:element name="stop_on_fail" type="xs:boolean"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:integer"/>
+ <xs:attribute name="name" type="xs:string"/>
+</xs:complexType>
+<xs:complexType name="get">
+ <xs:sequence>
+ <xs:element name="source" type="xs:string"/>
+ <xs:element name="destination" type="xs:string"/>
+ <xs:element name="stop_on_fail" type="xs:boolean"/>
+ </xs:sequence>
+ <xs:attribute name="id" type="xs:integer"/>
+ <xs:attribute name="name" type="xs:string"/>
+</xs:complexType>
+
</xs:schema>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22780 - in gnunet-planetlab/gplmt: . contrib,
gnunet <=