Пример #1
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)
Пример #2
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 "----------------------------------------------------------"
Пример #3
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)
Пример #4
0
    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 "----------------------------------------------------------"
Пример #5
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)
Пример #6
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)
Пример #7
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)
Пример #8
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)
Пример #9
0
    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 "----------------------------------------------------------"
Пример #10
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)
Пример #11
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)
Пример #12
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 "----------------------------------------------------------"
Пример #13
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)
Пример #14
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)
Пример #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)
Пример #16
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)