From c479efb2cf7e68aea94857ff44bdb694ddd0c060 Mon Sep 17 00:00:00 2001 From: Claudio-Daniel Freire Date: Tue, 26 Apr 2011 15:27:50 +0200 Subject: [PATCH] Build script with application commands and run the script - supports more complex commands than simply calling remote_spawn on the user-supplied command. --- src/nepi/testbeds/planetlab/application.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) 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, -- 2.47.0