Example #1
0
 def test_B_slow_junit(self):
     h2o.tear_down_cloud()
     h2o.build_cloud(node_count=2)
     # we don't have the port or ip configuration here
     # that util/h2o.py does? Keep this in synch with spawn_h2o there.
     # also don't have --nosigar here?
     (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
             'java',
             '-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
             '-Dh2o.arg.name='+h2o.cloud_name(),
             '-Dh2o.arg.ip='+h2o.get_ip_address(),
             '-ea', '-jar', h2o.find_file('target/h2o.jar'),
             '-mainClass', 'org.junit.runner.JUnitCore',
             # The tests
             'water.ConcurrentKeyTest',
             'hex.MinorityClassTest'
             ])
     # getting UDP receiver stack traces if we shut down quickly after Junit
     # may need to wait a little bit before shutdown?
     time.sleep(3)
     rc = ps.wait(None)
     out = file(stdout).read()
     err = file(stderr).read()
     if rc is None:
         ps.terminate()
         raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
     elif rc != 0:
         raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
Example #2
0
def do_R(rScript, rLibrary):
    shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[
        0].http_addr + ":" + str(h2o.nodes[0].port)
    (ps, outpath, errpath) = h2o.spawn_cmd('rtest_with_h2o',
                                           shCmdString.split())
    rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
    if (rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #3
0
    def testAll(self):
        try:
            h2o.build_cloud(node_count=2)

            # we don't have the port or ip configuration here
            # that util/h2o.py does? Keep this in synch with spawn_h2o there.
            # also don't have --nosigar here?
            (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
                    'java',
                    '-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
                    '-Dh2o.arg.name=pytest-'+getpass.getuser(),
                    '-Dh2o.arg.ip='+h2o.get_ip_address(),
                    '-ea', '-jar', h2o.find_file('target/h2o.jar'),
                    '-mainClass', 'org.junit.runner.JUnitCore',
                    # The tests
                    'water.parser.ParserTest',
                    ])

            rc = ps.wait(None)
            out = file(stdout).read()
            err = file(stderr).read()
            if rc is None:
                ps.terminate()
                raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
            elif rc != 0:
                raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))

        finally:
            h2o.tear_down_cloud()
Example #4
0
    def test_R(self):
        rScript = h2o.find_file('R/tests/test_R_GLM_basic.R')
        rLibrary = h2o.find_file('R/H2O_S4.R')
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=10)
    def test_steam(self):
        self.create_models(self.import_frames())
        print "----------------------------------------------------------"
        print "                    Testing Steam...                      "
        print "----------------------------------------------------------"

        # Go up two dirs and add '/client'.
        # Don't know if there's a better way to do this. - Prithvi
        client_dir = os.path.join(
            os.path.split(
                os.path.split(os.path.dirname(
                    os.path.realpath(__file__)))[0])[0], 'client')

        # Run `make test -C path_to_h2o/client`
        command_string = "make test -C " + client_dir

        # Ideally there should have been some kind of exit code checking or exception handling here.
        # However, when `make test` fails, h2o.spawn_wait() fails hard without an exit code.
        # Further, if this is trapped in a try/except, the failed tests are not routed to stdout.
        (ps, outpath, errpath) = h2o.spawn_cmd('steam_tests',
                                               command_string.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=1000)
        print "----------------------------------------------------------"
        print "            Steam tests completed successfully!           "
        print "----------------------------------------------------------"
Example #6
0
 def test_B_slow_junit(self):
     h2o.tear_down_cloud()
     h2o.build_cloud(node_count=2)
     # we don't have the port or ip configuration here
     # that util/h2o.py does? Keep this in synch with spawn_h2o there.
     # also don't have --nosigar here?
     (ps, stdout, stderr) = h2o.spawn_cmd(
         'junit',
         [
             'java',
             '-Dh2o.arg.ice_root=' + h2o.tmp_dir('ice.'),
             '-Dh2o.arg.name=' + h2o.cloud_name(),
             '-Dh2o.arg.ip=' + h2o.get_ip_address(),
             '-ea',
             '-jar',
             h2o.find_file('target/h2o.jar'),
             '-mainClass',
             'org.junit.runner.JUnitCore',
             # The tests
             'water.ConcurrentKeyTest',
             'hex.MinorityClassTest'
         ])
     # getting UDP receiver stack traces if we shut down quickly after Junit
     # may need to wait a little bit before shutdown?
     time.sleep(3)
     rc = ps.wait(None)
     out = file(stdout).read()
     err = file(stderr).read()
     if rc is None:
         ps.terminate()
         raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" %
                         (out, err))
     elif rc != 0:
         raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" %
                         (out, err))
Example #7
0
    def test_A_fast_junit(self):
        try:
            h2o.build_cloud(node_count=2)

            # we don't have the port or ip configuration here
            # that util/h2o.py does? Keep this in synch with spawn_h2o there.
            # also don't have --nosigar here?
            (ps, stdout, stderr) = h2o.spawn_cmd(
                'junit',
                [
                    'java',
                    '-Dh2o.arg.ice_root=' + h2o.tmp_dir('ice.'),
                    '-Dh2o.arg.name=' + h2o.cloud_name(),
                    '-Dh2o.arg.ip=' + h2o.get_ip_address(),
                    '-ea',
                    '-jar',
                    h2o.find_file('target/h2o.jar'),
                    '-mainClass',
                    'org.junit.runner.JUnitCore',
                    # The tests
                    #'hex.GLMGridTest',
                    'hex.HistogramTest',
                    'hex.GLMTest',
                    'hex.KMeansTest',
                    'hex.MinorityClassTest',
                    'hex.NeuralNetSpiralsTest',
                    'hex.rf.RandomForestTest',
                    'hex.rf.RFPredDomainTest',
                    'water.AtomicTest',
                    'water.AutoSerialTest',
                    'water.BitCmpTest',
                    #'water.ConcurrentKeyTest.java',
                    'water.KeyToString',
                    'water.KVTest',
                    #'water.KVSpeedTest',
                    'water.api.RStringTest',
                    'water.parser.DatasetCornerCasesTest',
                    'water.parser.ParseCompressedAndXLSTest',
                    'water.parser.ParseFolderTest',
                    'water.parser.ParseProgressTest',
                    'water.parser.ParserTest',
                    'water.parser.RReaderTest',
                    'water.score.ScorePmmlTest',
                    'water.score.ScoreTest'
                ])

            rc = ps.wait(None)
            out = file(stdout).read()
            err = file(stderr).read()
            if rc is None:
                ps.terminate()
                raise Exception(
                    "junit timed out.\nstdout:\n%s\n\nstderr:\n%s" %
                    (out, err))
            elif rc != 0:
                raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" %
                                (out, err))

        finally:
            h2o.tear_down_cloud()
Example #8
0
    def test_steam(self):
        print "----------------------------------------------------------"
        print "                    Testing Steam...                      "
        print "----------------------------------------------------------"

        # Go up two dirs and add '/client'.
        # Don't know if there's a better way to do this. - Prithvi
        client_dir = os.path.join(
            os.path.split(
                os.path.split(os.path.dirname(
                    os.path.realpath(__file__)))[0])[0], 'client')

        node0 = h2o.nodes[0]
        os.environ['STEAM_NODE_ADDR'] = node0.http_addr
        os.environ['STEAM_NODE_PORT'] = str(node0.port)

        # Run `make test -C path_to_h2o/client`
        command_string = "make test -C " + client_dir

        # However, when `make test` fails, h2o.spawn_wait() fails hard without an exit code.
        # Further, if this is trapped in a try/except, the failed tests are not routed to stdout.
        (ps, outpath, errpath) = h2o.spawn_cmd('steam_tests',
                                               command_string.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=1000)
        print "----------------------------------------------------------"
        print "            Steam tests completed successfully!           "
        print "----------------------------------------------------------"
Example #9
0
    def test_A_all_junit(self):
        try:
            h2o.build_cloud(node_count=2, java_heap_GB=3)

            # we don't have the port or ip configuration here
            # that util/h2o.py does? Keep this in synch with spawn_h2o there.
            # also don't have --nosigar here?
            (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
                    'java',
                    '-Xms3G',
                    '-Xmx3G',
                    '-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
                    '-Dh2o.arg.name='+h2o.cloud_name(),
                    '-Dh2o.arg.ip='+h2o.get_ip_address(),
                    '-Dh2o.arg.port=54666',
                    '-ea', '-jar', h2o.find_file('target/h2o.jar'),
                    '-mainClass', 'org.junit.runner.JUnitCore',
                    # The all test suite
                    'water.suites.AllTestsSuite'
                   ])

            rc = ps.wait(None)
            out = file(stdout).read()
            err = file(stderr).read()
            if rc is None:
                ps.terminate()
                raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
            elif rc != 0:
                raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))

        finally:
            h2o.tear_down_cloud()
Example #10
0
    def test_R(self):
        rScript = h2o.find_file('R/tests/test_R_GLM_basic.R')
        rLibrary = h2o.find_file('R/H2O_S4.R')
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=10)
Example #11
0
    def test_R_RF_diff_class(self):
        print "\nStarting iris.csv class weight test"
        rScript = h2o.find_file('R/tests/test_R_RF_diff_class.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Compare results from different class weights
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)
        
        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #12
0
    def test_R_RF_diff_ignore(self):
        print "\nStarting iris.csv ignore predictor(s) test"
        rScript = h2o.find_file('R/tests/test_R_RF_diff_ignore.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Ignore successively more predictor columns
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)
        
        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #13
0
    def testAll(self):
        try:
            h2o.build_cloud(node_count=2)

            # we don't have the port or ip configuration here
            # that util/h2o.py does? Keep this in synch with spawn_h2o there.
            # also don't have --nosigar here?
            (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
                    'java',
                    '-Dh2o.arg.ice_root='+h2o.tmp_dir('ice.'),
                    '-Dh2o.arg.name='+h2o.cloud_name(),
                    '-Dh2o.arg.ip='+h2o.get_ip_address(),
                    '-ea', '-jar', h2o.find_file('target/h2o.jar'),
                    '-mainClass', 'org.junit.runner.JUnitCore',
                    # The tests
                    #'hex.GLMGridTest',
                    'hex.HistogramTest',
                    'hex.GLMTest',
                    'hex.KMeansTest',
                    'hex.MinorityClassTest',
                    'hex.rf.RandomForestTest',
                    'hex.rf.RFPredDomainTest',
                    'water.AtomicTest',
                    'water.AutoSerialTest',
                    'water.BitCmpTest',
                    #'water.ConcurrentKeyTest.java',
                    'water.KeyToString',
                    'water.KVTest',
                    #'water.KVSpeedTest',
                    'water.api.RStringTest',
                    'water.exec.ExprTest',
                    'water.exec.RBigDataTest',
                    'water.parser.DatasetCornerCasesTest',
                    'water.parser.ParseCompressedAndXLSTest',
                    'water.parser.ParseFolderTest',
                    'water.parser.ParseProgressTest',
                    'water.parser.ParserTest',
                    'water.parser.RReaderTest',
                    'water.score.ScorePmmlTest',
                    'water.score.ScoreTest'
                    ])

            rc = ps.wait(None)
            out = file(stdout).read()
            err = file(stderr).read()
            if rc is None:
                ps.terminate()
                raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
            elif rc != 0:
                raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))

        finally:
            h2o.tear_down_cloud()
Example #14
0
    def test_R_C_kmeans_prostate(self):
        print "\nStarting prostate.csv"
        rScript = h2o.find_file('R/tests/test_R_C_kmeans_prostate.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Run k-means with k = 5 on column 2 (Age)
        # Loop to see if we get same centers
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #15
0
    def test_R_B_benign(self):
        print "\nStarting benign.csv"
        rScript = h2o.find_file('R/tests/test_R_B_benign.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Columns start at 0
        # Test columns 0-13, with 3 as response
        # N-fold cross-validation = 5
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)
        
        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #16
0
    def test_R_C_prostate(self):
        print "\nStarting prostate.csv"
        rScript = h2o.find_file('R/tests/test_R_C_prostate.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Columns start at 0
        # Test columns 1-8, with 1 as response
        # (Skip 0 because member ID)
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)
Example #17
0
    def test_R_C_kmeans_prostate(self):
        print "\nStarting prostate.csv"
        rScript = h2o.find_file('R/tests/test_R_C_kmeans_prostate.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Run k-means with k = 5 on column 2 (Age)
        # Loop to see if we get same centers
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[
            0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) = h2o.spawn_cmd('rtest_with_h2o',
                                               shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if (rc != 0):
            raise Exception("R exited with non-zero return code %s" % rc)
Example #18
0
    def test_R_C_prostate(self):
        print "\nStarting prostate.csv"
        rScript = h2o.find_file('R/tests/test_R_C_prostate.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Columns start at 0
        # Test columns 1-8, with 1 as response
        # (Skip 0 because member ID)
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[
            0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) = h2o.spawn_cmd('rtest_with_h2o',
                                               shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if (rc != 0):
            raise Exception("R exited with non-zero return code %s" % rc)
Example #19
0
    def test_R_B_benign(self):
        print "\nStarting benign.csv"
        rScript = h2o.find_file('R/tests/test_R_B_benign.R')
        rLibrary = h2o.find_file('R/H2O_Load.R')

        # Columns start at 0
        # Test columns 0-13, with 3 as response
        # N-fold cross-validation = 5
        shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[
            0].http_addr + ":" + str(h2o.nodes[0].port)

        (ps, outpath, errpath) = h2o.spawn_cmd('rtest_with_h2o',
                                               shCmdString.split())
        rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
        if (rc != 0):
            raise Exception("R exited with non-zero return code %s" % rc)
Example #20
0
File: junit.py Project: nadya1/h2o
    def testScoring(self):
        (ps, stdout, stderr) = h2o.spawn_cmd('junit', [
                'java',
                '-ea', '-jar', h2o.find_file('target/h2o.jar'),
                '-mainClass', 'org.junit.runner.JUnitCore',
                # The tests
                'water.score.ScorePmmlTest',
                'water.score.ScoreTest',
                ])

        rc = ps.wait(None)
        out = file(stdout).read()
        err = file(stderr).read()
        if rc is None:
            ps.terminate()
            raise Exception("junit timed out.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
        elif rc != 0:
            raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" % (out, err))
    def test_steam(self):
        self.create_models(self.import_frames())
        print "----------------------------------------------------------"
        print "                    Testing Steam...                      "
        print "----------------------------------------------------------"

        # Go up two dirs and add '/client'.
        # Don't know if there's a better way to do this. - Prithvi
        client_dir = os.path.join(os.path.split(os.path.split(os.path.dirname(os.path.realpath(__file__)))[0])[0], 'client')

        # Run `make test -C path_to_h2o/client`
        command_string = "make test -C " + client_dir

        # Ideally there should have been some kind of exit code checking or exception handling here. 
        # However, when `make test` fails, h2o.spawn_wait() fails hard without an exit code. 
        # Further, if this is trapped in a try/except, the failed tests are not routed to stdout.
        (ps, outpath, errpath) =  h2o.spawn_cmd('steam_tests', command_string.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=1000)
        print "----------------------------------------------------------"
        print "            Steam tests completed successfully!           "
        print "----------------------------------------------------------"
Example #22
0
    def test_A_all_junit(self):
        try:
            h2o.build_cloud(node_count=2, java_heap_GB=3)

            # we don't have the port or ip configuration here
            # that util/h2o.py does? Keep this in synch with spawn_h2o there.
            # also don't have --nosigar here?
            (ps, stdout, stderr) = h2o.spawn_cmd(
                'junit',
                [
                    'java',
                    '-Xms3G',
                    '-Xmx3G',
                    '-Dh2o.arg.ice_root=' + h2o.tmp_dir('ice.'),
                    '-Dh2o.arg.name=' + h2o.cloud_name(),
                    '-Dh2o.arg.ip=' + h2o.get_ip_address(),
                    '-Dh2o.arg.port=54666',
                    '-ea',
                    '-jar',
                    h2o.find_file('target/h2o.jar'),
                    '-mainClass',
                    'org.junit.runner.JUnitCore',
                    # The all test suite
                    'water.suites.AllTestsSuite'
                ])

            rc = ps.wait(None)
            out = file(stdout).read()
            err = file(stderr).read()
            if rc is None:
                ps.terminate()
                raise Exception(
                    "junit timed out.\nstdout:\n%s\n\nstderr:\n%s" %
                    (out, err))
            elif rc != 0:
                raise Exception("junit failed.\nstdout:\n%s\n\nstderr:\n%s" %
                                (out, err))

        finally:
            h2o.tear_down_cloud()
Example #23
0
    def test_steam(self):
        print "----------------------------------------------------------"
        print "                    Testing Steam...                      "
        print "----------------------------------------------------------"

        # Go up two dirs and add '/client'.
        # Don't know if there's a better way to do this. - Prithvi
        client_dir = os.path.join(os.path.split(os.path.split(os.path.dirname(os.path.realpath(__file__)))[0])[0], 'client')

        node0 = h2o.nodes[0]
        os.environ['STEAM_NODE_ADDR'] = node0.http_addr
        os.environ['STEAM_NODE_PORT'] = str(node0.port)

        # Run `make test -C path_to_h2o/client`
        command_string = "make test -C " + client_dir


        # However, when `make test` fails, h2o.spawn_wait() fails hard without an exit code. 
        # Further, if this is trapped in a try/except, the failed tests are not routed to stdout.
        (ps, outpath, errpath) =  h2o.spawn_cmd('steam_tests', command_string.split())
        h2o.spawn_wait(ps, outpath, errpath, timeout=1000)
        print "----------------------------------------------------------"
        print "            Steam tests completed successfully!           "
        print "----------------------------------------------------------"
Example #24
0
def do_R(rScript, rLibrary):
	shCmdString = "R -f " + rScript + " --args " + rLibrary + " " + h2o.nodes[0].http_addr + ":" + str(h2o.nodes[0].port)
	(ps, outpath, errpath) =  h2o.spawn_cmd('rtest_with_h2o', shCmdString.split())
	rc = h2o.spawn_wait(ps, outpath, errpath, timeout=10)
	if(rc != 0): raise Exception("R exited with non-zero return code %s" % rc)