diff options
author | Sander Vrijders <sander.vrijders@ugent.be> | 2018-01-12 16:07:52 +0100 |
---|---|---|
committer | Sander Vrijders <sander.vrijders@ugent.be> | 2018-01-12 16:12:10 +0100 |
commit | 91c87d35e3c9eeee43788f4acab2e6567bbb9c7d (patch) | |
tree | bc318441b2dce0cea3e6b5b375d8c8efa4899689 | |
parent | d8ee9eae0f08b9408a143cea71f0114457660c30 (diff) | |
download | rumba-91c87d35e3c9eeee43788f4acab2e6567bbb9c7d.tar.gz rumba-91c87d35e3c9eeee43788f4acab2e6567bbb9c7d.zip |
testbeds: Add check for jFed return value
This adds a check for the return value whenever jFed is called. It
avoids Rumba trying to continue on an experiment that failed to swap
in.
Fixes #37
-rw-r--r-- | rumba/testbeds/jfed.py | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/rumba/testbeds/jfed.py b/rumba/testbeds/jfed.py index ac54042..5bf07d4 100644 --- a/rumba/testbeds/jfed.py +++ b/rumba/testbeds/jfed.py @@ -195,10 +195,13 @@ class Testbed(mod.Testbed): file.close() def swap_out(self, experiment): - subprocess.call(["java", "-jar", self.jfed_jar, "delete", "-S", - self.proj_name, "-s", - self.exp_name, "-p", self.cert_file, - "-P", self.password]) + try: + subprocess.check_call(["java", "-jar", self.jfed_jar, "delete", + "-S", self.proj_name, "-s", self.exp_name, + "-p", self.cert_file, "-P", self.password]) + except subprocess.CalledProcessError as e: + logger.error("jFed returned with error " + str(e.returncode)) + raise def swap_in(self, experiment): for node in experiment.nodes: @@ -211,23 +214,32 @@ class Testbed(mod.Testbed): node.ssh_config.username = self.username node.ssh_config.password = self.password - subprocess.call(["java", "-jar", self.jfed_jar, "create", "-S", - self.proj_name, "--rspec", - self.rspec, "-s", - self.exp_name, "-p", self.cert_file, "-k", - "usercert,userkeys,shareduserallkeys", - "--create-slice", - "--manifest", self.manifest, - "-P", self.password, - "-e", self.exp_hours]) + logger.info("Launching jFed...") + + try: + subprocess.check_call(["java", "-jar", self.jfed_jar, "create", + "-S", self.proj_name, "--rspec", + self.rspec, "-s", self.exp_name, "-p", + self.cert_file, "-k", + "usercert,userkeys,shareduserallkeys", + "--create-slice", "--manifest", + self.manifest, "-P", self.password, + "-e", self.exp_hours]) + except subprocess.CalledProcessError as e: + logger.error("jFed returned with error " + str(e.returncode)) + raise if "exogeni" in self.auth_name: - subprocess.call(["java", "-jar", self.jfed_jar, - "manifest", "-S", self.proj_name, - "-s", self.exp_name, - "-p", self.cert_file, - "--manifest", self.manifest, - "-P", self.password]) + try: + subprocess.check_call(["java", "-jar", self.jfed_jar, + "manifest", "-S", self.proj_name, + "-s", self.exp_name, + "-p", self.cert_file, + "--manifest", self.manifest, + "-P", self.password]) + except subprocess.CalledProcessError as e: + logger.error("jFed returned with error " + str(e.returncode)) + raise rspec = xml.parse(self.manifest) xml_nodes = rspec.getElementsByTagName("node") |