diff --git a/osbenchmark/builder/installers/exception_handling_installer.py b/osbenchmark/builder/installers/exception_handling_installer.py new file mode 100644 index 000000000..d120af4b3 --- /dev/null +++ b/osbenchmark/builder/installers/exception_handling_installer.py @@ -0,0 +1,20 @@ +from osbenchmark.builder.installers.installer import Installer +from osbenchmark.exceptions import InstallError + + +class ExceptionHandlingInstaller(Installer): + def __init__(self, installer, executor=None): + super().__init__(executor) + self.installer = installer + + def install(self, host, binaries, all_node_ips): + try: + return self.installer.install(host, binaries, all_node_ips) + except Exception as e: + raise InstallError(f"Installing node on host \"{host}\" failed", e) + + def cleanup(self, host): + try: + return self.installer.cleanup(host) + except Exception as e: + raise InstallError(f"Cleaning up install data on host \"{host}\" failed", e) diff --git a/osbenchmark/exceptions.py b/osbenchmark/exceptions.py index 60d49b125..19a90a412 100644 --- a/osbenchmark/exceptions.py +++ b/osbenchmark/exceptions.py @@ -45,6 +45,11 @@ class LaunchError(BenchmarkError): Thrown whenever there was a problem launching the benchmark candidate """ +class InstallError(BenchmarkError): + """ + Thrown whenever there was a problem installing the benchmark candidate + """ + class ExecutorError(BenchmarkError): """