- if not ccnr or ccnr.state < ResourceState.STARTED:
- self.ec.schedule(reschedule_delay, self.deploy)
+ self.info("Uploading command '%s'" % command)
+
+ # We want to make sure the content is published
+ # before the experiment starts.
+ # Run the command as a bash script in the background,
+ # in the host ( but wait until the command has
+ # finished to continue )
+ env = self.replace_paths(env)
+ command = self.replace_paths(command)
+
+ (out, err), proc = self.execute_command(command,
+ env, blocking = True)
+
+ if proc.poll():
+ msg = "Failed to execute command"
+ self.error(msg, out, err)
+ raise RuntimeError(msg)
+
+ def do_start(self):
+ if self.state == ResourceState.READY:
+ command = self.get("command")
+ self.info("Starting command '%s'" % command)
+
+ self.set_started()