[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22782 - in gnunet-planetlab/gplmt: . contrib
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22782 - in gnunet-planetlab/gplmt: . contrib |
Date: |
Fri, 20 Jul 2012 11:01:51 +0200 |
Author: wachs
Date: 2012-07-20 11:01:51 +0200 (Fri, 20 Jul 2012)
New Revision: 22782
Modified:
gnunet-planetlab/gplmt/Tasks.py
gnunet-planetlab/gplmt/Worker.py
gnunet-planetlab/gplmt/contrib/simpletasks.xml
Log:
improved task handling
Modified: gnunet-planetlab/gplmt/Tasks.py
===================================================================
--- gnunet-planetlab/gplmt/Tasks.py 2012-07-20 08:47:59 UTC (rev 22781)
+++ gnunet-planetlab/gplmt/Tasks.py 2012-07-20 09:01:51 UTC (rev 22782)
@@ -105,7 +105,7 @@
if ((child.tag == "expected_output") and (child.text != None)):
t.expected_output = child.text
if ((child.tag == "stop_on_fail") and (child.text != None)):
- if (child.text == "yes"):
+ if (str.upper(child.text) == "TRUE"):
t.stop_on_fail = True
else:
t.stop_on_fail = False
Modified: gnunet-planetlab/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/Worker.py 2012-07-20 08:47:59 UTC (rev 22781)
+++ gnunet-planetlab/gplmt/Worker.py 2012-07-20 09:01:51 UTC (rev 22782)
@@ -29,6 +29,7 @@
import os
import time
import sys
+from paramiko.ssh_exception import SSHException
# Global variables
g_logger = None
@@ -42,11 +43,12 @@
self.node = node
self.tasks = tasks
def exec_run (self, task, transport):
- fail = False
- g_logger.log (self.node + " : Task '"+ task.command + " " +
task.arguments + "'")
- channel = transport.open_session()
- channel.settimeout(1.0)
- channel.exec_command(task.command + " " + task.arguments)
+ try:
+ channel = transport.open_session()
+ channel.settimeout(1.0)
+ channel.exec_command(task.command + " " + task.arguments)
+ except SSHException as e:
+ print self.node + " : Error while trying to connect: " + str(e)
if (task.timeout > 0):
timeout = task.timeout
@@ -75,7 +77,7 @@
else:
g_logger.log (self.node + " : Task '"+ task.name + "'
completed, exit code " +str(exit_status)+ " was as expected " +
str(task.expected_return_code))
- if ((fail == False) and (task.expected_output != None)):
+ if (task.expected_output != None):
output_contained = False
for l in stdout_data:
if (task.expected_output in l):
@@ -93,9 +95,9 @@
g_logger.log (self.node + " : Task '"+ task.name + "' successful")
else:
g_logger.log (self.node + " : Task '"+ task.name + "' failed")
- g_notifications.task_completed (self.node, task, result)
+ return result
+
def run(self):
- success = False
g_logger.log (self.node + " : Starting tasklist " + self.tasks.name)
task = self.tasks.get()
try:
@@ -138,21 +140,20 @@
transport = ssh.get_transport()
success = True
+ result = Tasks.Taskresult.success
while (None != task):
- fail = False
+ g_logger.log (self.node + " : Running task id " +str(task.id)+" '"
+ task.name + "'")
+ g_notifications.task_started (self.node, task)
if (task.__class__.__name__ == "Task"):
if (task.type == Tasks.Operation.run):
- fail = self.exec_run (task, transport)
+ result = self.exec_run (task, transport)
+ g_notifications.task_completed (self.node, task, result)
elif (task.type == Tasks.Operation.put):
print "TO IMPLEMENT"
elif (task.type == Tasks.Operation.get):
print "TO IMPLEMENT"
else:
- print "TO IMPLEMENT"
-
-
- g_logger.log (self.node + " : Running task " + task.name)
- g_notifications.task_started (self.node, task)
+ print "TO IMPLEMENT"
elif (task.__class__.__name__ == "Taskset"):
g_logger.log (self.node + " : Running task set")
if ((task.stop_on_fail == True) and (result !=
Tasks.Taskresult.success)):
@@ -164,7 +165,6 @@
ssh.close()
g_notifications.node_disconnected (self.node, True)
- print
g_notifications.tasklist_completed (self.node, self.tasks, success)
g_logger.log (self.node + " : All tasks done for " + self.node)
Modified: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-20 08:47:59 UTC
(rev 22781)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-20 09:01:51 UTC
(rev 22782)
@@ -5,7 +5,7 @@
<arguments></arguments>
<timeout>0</timeout>
<expected_return_code>0</expected_return_code>
- <expected_output>2012</expected_output>
+ <expected_output>2013</expected_output>
<stop_on_fail>true</stop_on_fail>
</run>
<run id="1" name="sleep 3">
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22782 - in gnunet-planetlab/gplmt: . contrib,
gnunet <=