scripts/run.py
def start(self):
        """
        Start one node of H2O.
        (Stash away the self.child and self.pid internally here.)

        :return none
        """

        # there is no hdfs currently in ec2, except s3n/hdfs
        # the core-site.xml provides s3n info
        # it's possible that we can just always hardware the hdfs version
        # to match the cdh3 cluster we're hard-wiring tests to
        # i.e. it won't make s3n/s3 break on ec2

        if self.is_client:
            main_class = "water.H2OClientApp"
        else:
            main_class = "water.H2OApp"

        if "JAVA_HOME" in os.environ:
            java = os.environ["JAVA_HOME"] + "/bin/java"
        else:
            java = "java"
        classpath_sep = ";" if sys.platform == "win32" else ":"
        classpath = self.h2o_jar if self.cp == "" else self.h2o_jar + classpath_sep + self.cp

        cmd = [java,
               # "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005",
               "-Xmx" + self.xmx,
               "-ea"]
        if self.jvm_opts is not None:
            cmd += [self.jvm_opts]
        cmd += ["-cp", classpath,
               main_class,
               "-name", self.cloud_name,
               "-port", str(self.port),
               "-ip", self.ip]
        if self.flatfile is not None:
            cmd += ["-flatfile", self.flatfile]

        if self.ldap_config_path is not None:
            cmd.append('-login_conf')
            cmd.append(self.ldap_config_path)
            cmd.append('-ldap_login')

        # If the jacoco flag was included, then modify cmd to generate coverage
        # data using the jacoco agent
        if g_jacoco_include:
            root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
            agent_dir = os.path.join(root_dir, "jacoco", "jacocoagent.jar")
            jresults_dir = os.path.join(self.output_dir, "jacoco")
            if not os.path.exists(jresults_dir):
                os.mkdir(jresults_dir)
            jresults_dir = os.path.join(jresults_dir, "{cloud}_{node}".format(cloud=self.cloud_num, node=self.node_num))
            jacoco = "-javaagent:" + agent_dir + "=destfile=" + \
                     os.path.join(jresults_dir, "{cloud}_{node}.exec".format(cloud=self.cloud_num, node=self.node_num))
            opt0, opt1 = g_jacoco_options
            if opt0 is not None:
                jacoco += ",includes={inc}".format(inc=opt0.replace(',', ':'))
            if opt1 is not None:
                jacoco += ",excludes={ex}".format(ex=opt1.replace(',', ':'))

            cmd = cmd[:1] + [jacoco] + cmd[1:]

        if self.test_ssl:
            cmd.append("-internal_security_conf")
            if g_convenient:
                cmd.append("../h2o-algos/src/test/resources/ssl.properties")
            else:
                cmd.append("../../../h2o-algos/src/test/resources/ssl3.properties")

        # Add S3N credentials to cmd if they exist.
        # ec2_hdfs_config_file_name = os.path.expanduser("~/.ec2/core-site.xml")
        # if (os.path.exists(ec2_hdfs_config_file_name)):
        #     cmd.append("-hdfs_config")
        #     cmd.append(ec2_hdfs_config_file_name)

        self.output_file_name = \
            os.path.join(self.output_dir, "java_" + str(self.cloud_num) + "_" + str(self.node_num) + ".out.txt")
        f = open(self.output_file_name, "w")

        if g_convenient:
            cwd = os.getcwd()
            here = os.path.abspath(os.path.dirname(__file__))
            there = os.path.abspath(os.path.join(here, ".."))
            os.chdir(there)
            self.child = subprocess.Popen(args=cmd,
                                          stdout=f,
                                          stderr=subprocess.STDOUT,
                                          cwd=there)
            os.chdir(cwd)
        else:
            try:
              self.child = subprocess.Popen(args=cmd,
                                            stdout=f,
                                            stderr=subprocess.STDOUT,
                                            cwd=self.output_dir)
              self.pid = self.child.pid
              print("+ CMD: " + ' '.join(cmd))

            except OSError:
                raise "Failed to spawn %s in %s" % (cmd, self.output_dir)
def start(self):
        """
        Start one node of H2O.
        (Stash away the self.child and self.pid internally here.)

        :return none
        """

        # there is no hdfs currently in ec2, except s3n/hdfs
        # the core-site.xml provides s3n info
        # it's possible that we can just always hardware the hdfs version
        # to match the cdh3 cluster we're hard-wiring tests to
        # i.e. it won't make s3n/s3 break on ec2

        if self.is_client:
            main_class = "water.H2OClientApp"
        else:
            main_class = "water.H2OApp"

        if "JAVA_HOME" in os.environ:
            java = os.environ["JAVA_HOME"] + "/bin/java"
        else:
            java = "java"
        classpath_sep = ";" if sys.platform == "win32" else ":"
        classpath = self.h2o_jar if self.cp == "" else self.h2o_jar + classpath_sep + self.cp

        cmd = [java,
               # "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005",
               "-Xmx" + self.xmx,
               "-ea"]
        if self.jvm_opts is not None:
            cmd += [self.jvm_opts]
        cmd += ["-cp", classpath,
               main_class,
               "-name", self.cloud_name,
               "-port", str(self.port),
               "-ip", self.ip]
        if self.flatfile is not None:
            cmd += ["-flatfile", self.flatfile]

        if self.ldap_config_path is not None:
            cmd.append('-login_conf')
            cmd.append(self.ldap_config_path)
            cmd.append('-ldap_login')

        # If the jacoco flag was included, then modify cmd to generate coverage
        # data using the jacoco agent
        if g_jacoco_include:
            root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
            agent_dir = os.path.join(root_dir, "jacoco", "jacocoagent.jar")
            jresults_dir = os.path.join(self.output_dir, "jacoco")
            if not os.path.exists(jresults_dir):
                os.mkdir(jresults_dir)
            jresults_dir = os.path.join(jresults_dir, "{cloud}_{node}".format(cloud=self.cloud_num, node=self.node_num))
            jacoco = "-javaagent:" + agent_dir + "=destfile=" + \
                     os.path.join(jresults_dir, "{cloud}_{node}.exec".format(cloud=self.cloud_num, node=self.node_num))
            opt0, opt1 = g_jacoco_options
            if opt0 is not None:
                jacoco += ",includes={inc}".format(inc=opt0.replace(',', ':'))
            if opt1 is not None:
                jacoco += ",excludes={ex}".format(ex=opt1.replace(',', ':'))

            cmd = cmd[:1] + [jacoco] + cmd[1:]

        if self.test_ssl:
            cmd.append("-internal_security_conf")
            if g_convenient:
                cmd.append("../h2o-algos/src/test/resources/ssl.properties")
            else:
                cmd.append("../../../h2o-algos/src/test/resources/ssl3.properties")

        # Add S3N credentials to cmd if they exist.
        # ec2_hdfs_config_file_name = os.path.expanduser("~/.ec2/core-site.xml")
        # if (os.path.exists(ec2_hdfs_config_file_name)):
        #     cmd.append("-hdfs_config")
        #     cmd.append(ec2_hdfs_config_file_name)

        self.output_file_name = \
            os.path.join(self.output_dir, "java_" + str(self.cloud_num) + "_" + str(self.node_num) + ".out.txt")
        f = open(self.output_file_name, "w")

        if g_convenient:
            cwd = os.getcwd()
            here = os.path.abspath(os.path.dirname(__file__))
            there = os.path.abspath(os.path.join(here, ".."))
            os.chdir(there)
            self.child = subprocess.Popen(args=cmd,
                                          stdout=f,
                                          stderr=subprocess.STDOUT,
                                          cwd=there)
            os.chdir(cwd)
        else:
            try:
              self.child = subprocess.Popen(args=cmd,
                                            stdout=f,
                                            stderr=subprocess.STDOUT,
                                            cwd=self.output_dir)
              self.pid = self.child.pid
              print("+ CMD: " + ' '.join(cmd))

            except OSError:
                raise "Failed to spawn %s in %s" % (cmd, self.output_dir)
Start one node of H2O.
        (Stash away the self.child and self.pid internally here.)

        :return none