[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r22840 - in gnunet-planetlab/gplmt: . contrib
From: |
gnunet |
Subject: |
[GNUnet-SVN] r22840 - in gnunet-planetlab/gplmt: . contrib |
Date: |
Mon, 23 Jul 2012 14:04:02 +0200 |
Author: wachs
Date: 2012-07-23 14:04:02 +0200 (Mon, 23 Jul 2012)
New Revision: 22840
Modified:
gnunet-planetlab/gplmt/Configuration.py
gnunet-planetlab/gplmt/Worker.py
gnunet-planetlab/gplmt/contrib/deploy_gnunet.xml
gnunet-planetlab/gplmt/contrib/simpletasks.xml
Log:
- more steps for deployment
using select for worker
check for missing conf file
Modified: gnunet-planetlab/gplmt/Configuration.py
===================================================================
--- gnunet-planetlab/gplmt/Configuration.py 2012-07-23 11:50:57 UTC (rev
22839)
+++ gnunet-planetlab/gplmt/Configuration.py 2012-07-23 12:04:02 UTC (rev
22840)
@@ -23,6 +23,7 @@
# Configuration
import ConfigParser
+import os
class Configuration:
def __init__(self, filename, logger):
@@ -43,7 +44,9 @@
self.ssh_use_known_hosts = False
def load (self):
self.logger.log ("Loading configuration file '" + self.filename + "'")
-
+ if (False == os.path.exists (self.filename)):
+ print "File does not exist: '" + self.filename + "'"
+ return False
config = ConfigParser.RawConfigParser()
try:
config.read(self.filename)
Modified: gnunet-planetlab/gplmt/Worker.py
===================================================================
--- gnunet-planetlab/gplmt/Worker.py 2012-07-23 11:50:57 UTC (rev 22839)
+++ gnunet-planetlab/gplmt/Worker.py 2012-07-23 12:04:02 UTC (rev 22840)
@@ -29,6 +29,7 @@
import os
import time
import sys
+import select
from paramiko.ssh_exception import SSHException
# Global variables
@@ -45,56 +46,67 @@
def exec_run (self, task, transport):
try:
channel = transport.open_session()
- channel.settimeout(1.0)
+ #channel.settimeout(1.0)
channel.get_pty ()
+ #print "CMD: " + task.command + " " + task.arguments
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
else:
- timeout = 90
- exec_time = 0
+ timeout = -1
result = Tasks.Taskresult.success
+ exit_status = -1
+ start_time = time.time ()
- try:
- stdout = channel.makefile("rb")
- stderr = channel.makefile_stderr("rb")
- verbose_ssh = True
- while ((not channel.exit_status_ready()) and (exec_time <
timeout)):
- time.sleep(1)
- exec_time += 1
- if ((exec_time < timeout) or (verbose_ssh == True)):
- stdout_data = stdout.readlines()
- stderr_data = stderr.readlines()
- exit_status = channel.recv_exit_status()
- if (verbose_ssh == True):
- print stdout_data
- print stderr_data
- else:
- g_logger.log (self.node + " : Task '"+ task.name + "' had
timeout after " +str (exec_time)+ " seconds")
- result = Tasks.Taskresult.timeout
- except socket.timeout as e:
- g_logger.log (self.node + " : Task '"+ task.name + "' had timeout
after " +str (exec_time)+ " seconds: " + str(e))
-
+ stdout_data = ""
+ stderr_data = ""
+ while 1:
+ if (timeout != -1):
+ delta = time.time() - start_time
+ if (delta > timeout):
+ print "TIMEOUT"
+ result = Tasks.Taskresult.timeout
+ break
+ (r, w, e) = select.select([channel], [], [], 1)
+ if r:
+ got_data = False
+ if channel.recv_ready():
+ data = r[0].recv(4096)
+ if data:
+ got_data = True
+ g_logger.log ('STDOUT: ' + data)
+ stdout_data += data
+ if channel.recv_stderr_ready():
+ data = r[0].recv_stderr(4096)
+ if data:
+ got_data = True
+ g_logger.log ('STDERR: ' + data)
+ stderr_data += data
+ if not got_data:
+ break
+
if (result == Tasks.Taskresult.success):
+ exit_status = channel.recv_exit_status ()
+ print "RESULT " + str(time.time() - start_time) + " " +
str(exit_status)
+ if (result == Tasks.Taskresult.success):
if (task.expected_return_code != -1):
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))
+ g_logger.log (self.node + " : Task '"+ task.name + "'
completed after "+ str(time.time() - start_time) +" sec, but exit code "
+str(exit_status)+ " was not as expected " + str(task.expected_return_code))
g_logger.log (stdout_data)
g_logger.log (stderr_data)
result = Tasks.Taskresult.return_value_did_not_match
else:
- g_logger.log (self.node + " : Task '"+ task.name + "'
completed, exit code " +str(exit_status)+ " was as expected " +
str(task.expected_return_code))
+ g_logger.log (self.node + " : Task '"+ task.name + "'
completed after "+ str(time.time() - start_time) +" sec, exit code "
+str(exit_status)+ " was as expected " + str(task.expected_return_code))
if (task.expected_output != None):
output_contained = False
- for l in stdout_data:
- if (task.expected_output in l):
- output_contained = True
- for l in stderr_data:
- if (task.expected_output in l):
+ if (task.expected_output in stdout_data):
+ output_contained = True
+ if (task.expected_output in stderr_data):
output_contained = True
if (output_contained == True):
g_logger.log (self.node + " : Task '"+ task.name + "'
expected output '"+task.expected_output+"' was found")
@@ -102,8 +114,10 @@
g_logger.log (self.node + " : Task '"+ task.name + "'
expected output '"+task.expected_output+"' was not found")
result = Tasks.Taskresult.output_did_not_match
- if (result == Tasks.Taskresult.success):
+ if (result == Tasks.Taskresult.timeout):
g_logger.log (self.node + " : Task '"+ task.name + "' successful")
+ elif (result == Tasks.Taskresult.success):
+ g_logger.log (self.node + " : Task '"+ task.name + "' with
timeout")
else:
g_logger.log (self.node + " : Task '"+ task.name + "' failed")
return result
Modified: gnunet-planetlab/gplmt/contrib/deploy_gnunet.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/deploy_gnunet.xml 2012-07-23 11:50:57 UTC
(rev 22839)
+++ gnunet-planetlab/gplmt/contrib/deploy_gnunet.xml 2012-07-23 12:04:02 UTC
(rev 22840)
@@ -390,9 +390,9 @@
</run>
</sequence>
- <sequence enabled="true">
+ <sequence enabled="false">
<!-- Install libnettle -->
- <run id="1" name="Download libnettle" enabled="false">
+ <run id="1" name="Download libnettle" enabled="true">
<command>mkdir /tmp/libnettle; cd /tmp/libnettle; wget </command>
<arguments>http://www.lysator.liu.se/~nisse/archive/nettle-2.4.tar.gz</arguments>
<timeout>120</timeout>
@@ -400,7 +400,7 @@
<expected_output></expected_output>
<stop_on_fail>true</stop_on_fail>
</run>
- <run id="1" name="Unpack libnettle" enabled="false">
+ <run id="1" name="Unpack libnettle" enabled="true">
<command>cd /tmp/libnettle; tar -xzvf</command>
<arguments>nettle-2.4.tar.gz</arguments>
<timeout>120</timeout>
@@ -408,7 +408,7 @@
<expected_output></expected_output>
<stop_on_fail>true</stop_on_fail>
</run>
- <run id="1" name="Configure libnettle" enabled="false">
+ <run id="1" name="Configure libnettle" enabled="true">
<command>cd /tmp/libnettle/nettle-2.4; ./configure </command>
<arguments>--prefix=/usr --enable-shared</arguments>
<timeout>120</timeout>
@@ -433,6 +433,7 @@
<stop_on_fail>false</stop_on_fail>
</run>
</sequence>
+
<sequence enabled="false">
<!-- Install gnutls -->
<run id="1" name="Download gnutls" enabled="true">
@@ -445,7 +446,7 @@
</run>
<run id="1" name="Unpack gnutls" enabled="true">
<command>cd /tmp/gnutls; tar -xjvf</command>
- <arguments>gnutls-2.12.9.tar.bz</arguments>
+ <arguments>gnutls-2.12.9.tar.bz2</arguments>
<timeout>120</timeout>
<expected_return_code>0</expected_return_code>
<expected_output></expected_output>
@@ -454,7 +455,7 @@
<run id="1" name="Configure gnutls" enabled="true">
<command>cd /tmp/gnutls/gnutls-2.12.9; ./configure </command>
<arguments>--prefix=/usr --without-p11-kit</arguments>
- <timeout>120</timeout>
+ <timeout>0</timeout>
<expected_return_code>0</expected_return_code>
<expected_output></expected_output>
<stop_on_fail>true</stop_on_fail>
@@ -462,7 +463,7 @@
<run id="1" name="Install gnutls">
<command>cd /tmp/gnutls/gnutls-2.12.9; sudo make install</command>
<arguments> </arguments>
- <timeout>360</timeout>
+ <timeout>0</timeout>
<expected_return_code>0</expected_return_code>
<expected_output></expected_output>
<stop_on_fail>true</stop_on_fail>
@@ -470,16 +471,16 @@
<run id="1" name="gnutls clean up">
<command>sudo rm -rf /tmp/gnutls</command>
<arguments> </arguments>
- <timeout>10</timeout>
+ <timeout>0</timeout>
<expected_return_code>0</expected_return_code>
<expected_output></expected_output>
<stop_on_fail>false</stop_on_fail>
</run>
</sequence>
- <sequence enabled="false">
+ <sequence enabled="true">
<!-- Install gnutls -->
<run id="1" name="Download libunistring" enabled="true">
- <command>mkdir /tmp/gnutls; cd /tmp/libunistring; wget </command>
+ <command>mkdir /tmp/libunistring; cd /tmp/libunistring; wget
</command>
<arguments>http://ftp.gnu.org/gnu/libunistring/libunistring-0.9.3.tar.gz</arguments>
<timeout>120</timeout>
<expected_return_code>0</expected_return_code>
Modified: gnunet-planetlab/gplmt/contrib/simpletasks.xml
===================================================================
--- gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-23 11:50:57 UTC
(rev 22839)
+++ gnunet-planetlab/gplmt/contrib/simpletasks.xml 2012-07-23 12:04:02 UTC
(rev 22840)
@@ -1,19 +1,11 @@
<?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">
<run id="0" name="get date">
- <command>date</command>
+ <command>sudo date</command>
<arguments></arguments>
- <timeout>0</timeout>
+ <timeout>10</timeout>
<expected_return_code>0</expected_return_code>
- <expected_output>2013</expected_output>
+ <expected_output>home</expected_output>
<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>true</stop_on_fail>
- </run>
</tasklist>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r22840 - in gnunet-planetlab/gplmt: . contrib,
gnunet <=