def test_set_regional_configs(patched_config, default_bootstrapper: Bootstrapper) -> None: default_bootstrapper.get_regional_configs = MagicMock( return_value=[patched_config]) default_bootstrapper.set_regional_configs() default_bootstrapper.get_regional_configs.assert_called_once() patched_config.write_config.assert_called_once()
def start_history_server(event_logs_s3_uri: str) -> None: """Bootstrap the history server instance and starts the Spark history server instance.""" bootstrapper = Bootstrapper() log.info("copying aws jars") bootstrapper.copy_aws_jars() log.info("copying cluster config") bootstrapper.copy_cluster_config() log.info("setting regional configs") bootstrapper.set_regional_configs() log.info("copying history server config") config_history_server(event_logs_s3_uri) log.info("bootstrap master node") bootstrapper.start_spark_standalone_primary() try: subprocess.run("sbin/start-history-server.sh", check=True) except subprocess.CalledProcessError as e: raise AlgorithmError(message=e.stderr.decode(sys.getfilesystemencoding()), caused_by=e, exit_code=e.returncode) except Exception as e: log.error("Exception during processing: " + str(e) + "\n" + traceback.format_exc()) raise AlgorithmError( message="error occurred during start-history-server execution. Please see logs for details.", caused_by=e, )