Esempio n. 1
0
def calc_airfoil(msh_input, airfoil_input):

    angles = divide_input(msh_input[0], msh_input[1], msh_input[2])
    queue = [airfoil.s(x, msh_input[3], y, airfoil_input[0], airfoil_input[1],
             airfoil_input[2], airfoil_input[3]) for x in angles for y in range(0, msh_input[4]+1)]
    print queue
    g = group(queue)

    res = g()
    while (res.ready() == False):
        print res.ready()
        time.sleep(3)

    print res.ready()
Esempio n. 2
0
def calc_airfoil(msh_input, airfoil_input):

    angles = divide_input(msh_input[0], msh_input[1], msh_input[2])
    length_queue = len(angles)

    instances = nc.servers.findall()
    nr_workers = 0
    for instance in instances:
        if(instance.name.startswith("EmilWorker")):
            nr_workers += 1

    floating_ip = os.environ['FLOATING_IP']

    float_ip = 'export BROKER_IP="{}"'.format(os.environ['FLOATING_IP'])

    with open('workerdata_init.yml', 'r') as file:
        f = file.read()
    f_updated = f.replace('brokerip', float_ip)

    with open('workerdata.yml', 'wb') as file:
        file.write(f_updated)

    if length_queue < 3:
        start_workers(1, nr_workers, nc)
    elif length_queue < 5:
        start_workers(2, nr_workers, nc)
    elif length_queue < 9:
        start_workers(3, nr_workers, nc)
    else:
        start_workers(4, nr_workers, nc)


    queue = [airfoil.s(x, msh_input[3], y, airfoil_input[0], airfoil_input[1],
             airfoil_input[2], airfoil_input[3]) for x in angles for y in range(0, msh_input[4]+1)]
    print queue
    g = group(queue)

    res = g()
    while (res.ready() == False):
        print res.ready()
        time.sleep(3)

    result = res.get()

    return result
Esempio n. 3
0
def calc_airfoil(msh_input, airfoil_input):

    angles = divide_input(msh_input[0], msh_input[1], msh_input[2])

    queue = [
        airfoil.s(x, msh_input[3], y, airfoil_input[0], airfoil_input[1],
                  airfoil_input[2], airfoil_input[3]) for x in angles
        for y in range(0, msh_input[4] + 1)
    ]
    print queue
    g = group(queue)

    res = g()
    while (res.ready() == False):
        print res.ready()
        time.sleep(3)

    result = res.get()

    return result