示例#1
0
文件: gen.py 项目: mgorny/inz-praca
def Condenser(st):
    yield st

    p = st.p
    h = st.h
    en = h2o.H2O(p=p, x=0)
    h_en = en.h
    while h > h_en:
        c = h2o.H2O(p=p, h=h)
        if c.x < 1:
            break

        h -= 10
        yield c
    yield en
示例#2
0
文件: gen.py 项目: mgorny/inz-praca
def Boiler(st, T2):
    p = st.p
    T = st.T

    while T <= T2:
        yield h2o.H2O(p, T)
        T += 1
示例#3
0
def flat_file(test):
    # read the flatfile and pick the first address and port
    with open((test.cfg.cloud_topology())['cloudByFlatFile']['flatFile'],
              'r') as f:
        first_line = f.readline()
        tokens = first_line.split(":", 2)
    test.a_node = h2o.H2O(use_this_ip_addr=tokens[0], port=int(tokens[1]))
    test.timeoutSecs = (
        test.cfg.cloud_topology())['cloudByFlatFile']['timeoutSecs']
示例#4
0
文件: gen.py 项目: mgorny/inz-praca
def SatCurve():
    Tmin = 273.15
    Tkr = 647.096

    T = Tmin
    while T < Tkr:
        yield h2o.H2O(x=0, T=T)

        if T >= 645.15:
            T += .2
        else:
            T += 1

    # punkt krytyczny
    yield h2o.H2O(x=0, T=Tkr)

    while T > Tmin:
        if T > 645.15:
            T -= .2
        else:
            T -= 1

        yield h2o.H2O(x=1, T=T)
示例#5
0
    args.host = arr[0]
    args.port = int(arr[1])

host = args.host
port = args.port

h2o.H2O.verboseprint("host: " + str(host))
h2o.H2O.verboseprint("port" + str(port))

pp = pprint.PrettyPrinter(indent=4)  # pretty printer for debugging

################
# The test body:
################

a_node = h2o.H2O(host, port)
h2o.H2O.verboseprint("connected to: ", str(host), ':', str(port))

import test_metadata
test_metadata.test(a_node, pp)

import test_html
test_html.test(a_node, pp)

import test_cluster_sanity
test_cluster_sanity.test(a_node, pp, algos)

# Clean up old objects from the DKV, in case the cluster has been doing other things:
if h2o_test_utils.isVerbose(): print('Cleaning up old stuff. . .')
h2o_test_utils.cleanup(a_node)
示例#6
0
        pojos[entity] = pojo

    return pojos


######
# MAIN:
######
if (len(args.usecloud) > 0):
    arr = args.usecloud.split(":")
    args.host = arr[0]
    args.port = int(arr[1])

h2o.H2O.verboseprint("connecting to: ", args.host, ":", args.port)

a_node = h2o.H2O(args.host, args.port)

print('creating the Java bindings in {}. . .'.format(args.dest))


#################################################################
# Get all the schemas and generate POJOs or Enums as appropriate.
# Note the medium ugliness that the enums list is global. . .
#################################################################
enums = {}

# write the schemas' POJOs, discovering enums on the way
all_schemas = a_node.schemas()['schemas']
all_schemas_map = {}  # save for later use

for schema in all_schemas:
示例#7
0
        # Python says True; json says true
        if actuals_dict[k]['type'] == 'boolean':
            expected = expected.lower()

        assert expected == actuals_dict[k][
            'actual_value'], "Parameter with name: " + k + " expected to have input value: " + str(
                expected) + ", instead has: " + str(
                    actuals_dict[k]['actual_value'])
    # TODO: training_frame, validation_frame


################
# The test body:
################

a_node = h2o.H2O("127.0.0.1", 54321)

# TODO: remove die fast test case:
if False:
    import_result = a_node.import_files(
        path="/Users/rpeck/Source/h2o2/smalldata/logreg/prostate.csv")
    parse_result = a_node.parse(
        key=import_result['keys'][0])  # TODO: handle multiple files
    prostate_key = parse_result['frames'][0]['key']['name']

    a_node.build_model(algo='kmeans',
                       training_frame=prostate_key,
                       parameters={'K': 2},
                       timeoutSecs=240)

    sys.exit()
示例#8
0
def local_cloud(test):
    test.a_node = h2o.H2O(
        use_this_ip_addr=(test.cfg.cloud_topology())['local_cloud']['ip'],
        port=(test.cfg.cloud_topology())['local_cloud']['port'])
    test.timeoutSecs = (
        test.cfg.cloud_topology())['local_cloud']['timeoutSecs']
示例#9
0
文件: gen.py 项目: mgorny/inz-praca
def Isobar(p, s1, s2):
    s = s1
    step = (s2 - s1) / 100
    while s <= s2:
        yield h2o.H2O(p=p, s=s)
        s += step
示例#10
0
文件: gen.py 项目: mgorny/inz-praca

def wr(f, c):
    with Tab(f) as t:
        for x in c:
            t.write(x)
            l = x

    return l


with open('.stamp', 'w'):
    pass

wr('_nasyc.txt', SatCurve())
s1 = h2o.H2O(10, 773.15)
wr('turbina-i.txt', Turbine(s1, .006))
s2 = wr('turbina.txt', Turbine(s1, .006, .8))
s3 = wr('skraplacz.txt', Condenser(s2))
wr('pompa-i.txt', Pump(s3, s1.p))
s0 = wr('pompa.txt', Pump(s3, s1.p, .8))
wr('kociol.txt', Boiler(s0, s1.T))

wr('izobara-10.txt', Isobar(s1.p, .5, .55))

wr('podgrz.txt', Condenser(h2o.H2O(p=0.2, h=2989.18)))
wr('podgrz-2.txt', Boiler(h2o.H2O(0.5, 84.93 + 273.15), 115.21 + 273.15))

wr('odgaz.txt', Condenser(h2o.H2O(p=0.5, h=3161.74)))
wr('odgaz-2.txt', Boiler(h2o.H2O(0.5, 115.21 + 273.15), 151.84 + 273.15))