def run(self, command, override_src_dir=None): src_dir = self.src_dir if override_src_dir is None else override_src_dir logger.info("Building from sources in [%s].", src_dir) logger.info("Executing %s...", command) io.ensure_dir(self.log_dir) log_file = os.path.join(self.log_dir, "build.log") # we capture all output to a dedicated build log file build_cmd = "export JAVA_HOME={}; cd {}; {} >> {} 2>&1".format( self.java_home, src_dir, command, log_file) logger.info("Running build command [%s]", build_cmd) if process.run_subprocess(build_cmd): msg = "Executing '{}' failed. The last 20 lines in the build log file are:\n".format( command) msg += "=========================================================================================================\n" with open(log_file, "r", encoding="utf-8") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [{}].".format(log_file) raise BuildError(msg)
def run(self, task): from esrally.utils import jvm logger.info("Building from sources in [%s]." % self.src_dir) logger.info("Executing %s %s..." % (self.gradle, task)) io.ensure_dir(self.log_dir) log_file = "%s/build.log" % self.log_dir # we capture all output to a dedicated build log file jvm_major_version = jvm.major_version(self.java_home) if jvm_major_version > 8: logger.info( "Detected JVM with major version [%d]. Adjusting JDK module access options for the build." % jvm_major_version) gradle_opts = "export GRADLE_OPTS=\"%s\"; " % Builder.JAVA_9_GRADLE_OPTS else: gradle_opts = "" if process.run_subprocess( "%sexport JAVA_HOME=%s; cd %s; %s %s >> %s 2>&1" % (gradle_opts, self.java_home, self.src_dir, self.gradle, task, log_file)): msg = "Executing '%s %s' failed. The last 20 lines in the build log file are:\n" % ( self.gradle, task) msg += "=========================================================================================================\n" with open(log_file, "r") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [%s]." % log_file raise BuildError(msg)
def run(self, task): try: src_dir = self._config.opts("source", "local.src.dir") except config.ConfigError: logging.exception("Rally is not configured to build from sources") raise SystemSetupError( "Rally is not setup to build from sources. You can either benchmark a binary distribution or " "install the required software and reconfigure Rally with %s --configure." % PROGRAM_NAME) logger.info("Building Elasticsearch from sources in [%s]." % src_dir) gradle = self._config.opts("build", "gradle.bin") java_home = self._config.opts("runtime", "java8.home") log_dir = self._config.opts("system", "log.dir") logger.info("Executing %s %s..." % (gradle, task)) io.ensure_dir(log_dir) log_file = "%s/build.log" % log_dir # we capture all output to a dedicated build log file if process.run_subprocess( "export JAVA_HOME=%s; cd %s; %s %s >> %s 2>&1" % (java_home, src_dir, gradle, task, log_file)): msg = "Executing '%s %s' failed. The last 20 lines in the build log file are:\n" % ( gradle, task) msg += "=========================================================================================================\n" with open(log_file, "r") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [%s]." % log_file raise BuildError(msg)
def _exec(self, task_key): src_dir = self._config.opts("source", "local.src.dir") gradle = self._config.opts("build", "gradle.bin") task = self._config.opts("build", task_key) log_root = self._config.opts("system", "log.dir") build_log_dir = self._config.opts("build", "log.dir") log_dir = "%s/%s" % (log_root, build_log_dir) logger.info("Executing %s %s..." % (gradle, task)) io.ensure_dir(log_dir) log_file = "%s/build.%s.log" % (log_dir, task_key) # we capture all output to a dedicated build log file if process.run_subprocess("cd %s; %s %s > %s 2>&1" % (src_dir, gradle, task, log_file)): msg = "Executing '%s %s' failed. Here are the last 20 lines in the build log file:\n" % ( gradle, task) msg += "=========================================================================================================\n" with open(log_file, "r") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [%s]." % log_file raise BuildError(msg)
def run(self, task, override_src_dir=None): from esrally.utils import jvm src_dir = self.src_dir if override_src_dir is None else override_src_dir logger.info("Building from sources in [%s]." % src_dir) logger.info("Executing %s %s..." % (self.gradle, task)) io.ensure_dir(self.log_dir) log_file = "%s/build.log" % self.log_dir # we capture all output to a dedicated build log file build_cmd = "export JAVA_HOME=%s; cd %s; %s %s >> %s 2>&1" % ( self.java_home, src_dir, self.gradle, task, log_file) logger.info("Running build command [%s]" % build_cmd) if process.run_subprocess(build_cmd): msg = "Executing '%s %s' failed. The last 20 lines in the build log file are:\n" % ( self.gradle, task) msg += "=========================================================================================================\n" with open(log_file, "r", encoding="utf-8") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [%s]." % log_file raise BuildError(msg)
def run(self, task): logger.info("Building Elasticsearch from sources in [%s]." % self.src_dir) logger.info("Executing %s %s..." % (self.gradle, task)) io.ensure_dir(self.log_dir) log_file = "%s/build.log" % self.log_dir # we capture all output to a dedicated build log file if process.run_subprocess("export JAVA_HOME=%s; cd %s; %s %s >> %s 2>&1" % (self.java_home, self.src_dir, self.gradle, task, log_file)): msg = "Executing '%s %s' failed. The last 20 lines in the build log file are:\n" % (self.gradle, task) msg += "=========================================================================================================\n" with open(log_file, "r") as f: msg += "\t" msg += "\t".join(f.readlines()[-20:]) msg += "=========================================================================================================\n" msg += "The full build log is available at [%s]." % log_file raise BuildError(msg)