[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22754 - in gnunet-planetlab/gplmt: . contrib
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22754 - in gnunet-planetlab/gplmt: . contrib |
Date: |
Wed, 18 Jul 2012 17:06:13 +0200 |
Author: wachs
Date: 2012-07-18 17:06:13 +0200 (Wed, 18 Jul 2012)
New Revision: 22754
Modified:
gnunet-planetlab/gplmt/Notifications.py
gnunet-planetlab/gplmt/Worker.py
gnunet-planetlab/gplmt/contrib/simpletasks.xml
Log:
- changes
Modified: gnunet-planetlab/gplmt/Notifications.py
===================================================================
--- gnunet-planetlab/gplmt/Notifications.py 2012-07-18 14:58:15 UTC (rev
22753)
+++ gnunet-planetlab/gplmt/Notifications.py 2012-07-18 15:06:13 UTC (rev
22754)
@@ -63,4 +63,7 @@
def task_started (self, node, task):
print node + " : Task '" + task.name + "' started"
def task_completed (self, node, task, success):
- print node + " : Task '" + task.name + "' completed"
\ No newline at end of file
+ if (success == True):
+ print node + " : Task '" + task.name + "' completed successfully"
+ else:
+ print node + " : Task '" + task.name + "' completed with failure"
\ No newline at end of file
Modified: gnunet-planetlab/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/Worker.py 2012-07-18 14:58:15 UTC (rev 22753)
+++ gnunet-planetlab/gplmt/Worker.py 2012-07-18 15:06:13 UTC (rev 22754)
@@ -85,11 +85,39 @@
if (task.__class__.__name__ == "Task"):
if (task.type == Tasks.Operation.run):
- stdin, stdout, stderr = ssh.exec_command(task.command + "
" + task.arguments, 1024)
- data = stdout.readline()
- print data
- #for line in data:
- # print line
+ transport = ssh.get_transport()
+ channel = transport.open_session()
+ channel.exec_command(task.command + " " + task.arguments)
+
+ exit_status = channel.recv_exit_status()
+ stdout_data = []
+ stderr_data = []
+
+ while channel.recv_ready():
+ stdout_data.append(channel.recv(1024))
+ stdout_data = "".join(stdout_data)
+
+ while channel.recv_stderr_ready():
+ stderr_data.append(channel.recv_stderr(1024))
+ stderr_data = "".join(stderr_data)
+
+ fail = False;
+ if (exit_status != task.expected_return_code):
+ g_logger.log (self.node + " : Task '"+ task.name + "'
completed, but exit code " +str(exit_status)+ " was not as expected " +
str(task.expected_return_code))
+ fail = True;
+ else:
+ g_logger.log (self.node + " : Task '"+ task.name + "'
completed, exit code " +str(exit_status)+ " was as expected " +
str(task.expected_return_code))
+ if ((task.expected_output not in stdout_data) and
+ (task.expected_output not in stderr_data)):
+ fail = True;
+
+ if (fail == True):
+ g_logger.log (self.node + " : Task '"+ task.name + "'
failed")
+ else:
+ g_logger.log (self.node + " : Task '"+ task.name + "'
successful")
+
+ g_notifications.task_completed (self.node, task, not fail)
+
elif (task.type == Tasks.Operation.put):
print "TO IMPLEMENT"
elif (task.type == Tasks.Operation.get):
Modified: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-18 14:58:15 UTC
(rev 22753)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-18 15:06:13 UTC
(rev 22754)
@@ -6,7 +6,7 @@
<type>run</type>
<command>date</command>
<arguments></arguments>
- <expected_return_code>0</expected_return_code>
+ <expected_return_code>1</expected_return_code>
<expected_output></expected_output>
<stop_on_fail>0</stop_on_fail>
</task>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22754 - in gnunet-planetlab/gplmt: . contrib,
gnunet <=