From: Claudio-Daniel Freire Date: Tue, 26 Apr 2011 13:27:50 +0000 (+0200) Subject: Build script with application commands and run the script - supports more complex... X-Git-Tag: nepi_v2~118 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=c479efb2cf7e68aea94857ff44bdb694ddd0c060;p=nepi.git Build script with application commands and run the script - supports more complex commands than simply calling remote_spawn on the user-supplied command. --- diff --git a/src/nepi/testbeds/planetlab/application.py b/src/nepi/testbeds/planetlab/application.py index 841c20a2..59332c93 100644 --- a/src/nepi/testbeds/planetlab/application.py +++ b/src/nepi/testbeds/planetlab/application.py @@ -70,10 +70,26 @@ class Application(object): raise AssertionError, "Misconfigured application: unspecified slice" def start(self): + # Create shell script with the command + # This way, complex commands and scripts can be ran seamlessly + # sync files + (out,err),proc = server.popen_scp( + cStringIO.StringIO(self.command), + '%s@%s:%s' % (self.slicename, self.node.hostname, + os.path.join(self.home_path, "app.sh")), + port = None, + agent = None, + ident_key = self.ident_path, + server_key = self.node.server_key + ) + + if proc.wait(): + raise RuntimeError, "Failed to set up application: %s %s" % (out,err,) + # Start process in a "daemonized" way, using nohup and heavy # stdin/out redirection to avoid connection issues (out,err),proc = rspawn.remote_spawn( - self._replace_paths(self.command), + self._replace_paths("bash ./app.sh"), pidfile = './pid', home = self.home_path,