Exemple #1
0
def test_meta_merge():
    w =  Workflow()

    @w.create_task(lambda x: x*2)
    def start(x):
        return x+42

    @w.create_task()
    def mid(x):
        return x*2

    @w.create_task()
    def final(l):
        return sum(l)

    a = start(3)
    b = [mid(a) for _ in range(a.metadata)]
    c = final(b)

    w.save("dag.dot")
    p = LP.ProcessProvider()
    e = LimitEngine(p, 1)
    e.start(w)

    e.join()
    print c.value
Exemple #2
0
def test_meta():
    w = Workflow()

    @w.create_task()
    def foo(x):
        pass

    @w.create_task()
    def bar(y):
        pass

    @w.create_task()
    def split(z):
        pass

    @w.create_task()
    def merge(l):
        pass

    a = split(1)
    foo(a)
    bar(a)

    w.save("dag.dot")
Exemple #3
0
def test_mapper(a, n):
    w = Workflow()

    @w.create_task()
    def start(x):
        sleep(10)
        return x + 3

    @w.create_task()
    def middle(x):
        sleep(10)
        return x + 42

    @w.create_task()
    def final(res):
        sleep(10)
        return sum(res)

    y = start(a)
    l = [middle(y) for _ in range(n)]
    return final(l)
Exemple #4
0
def test_diamond():
    w = Workflow()

    @w.create_task()
    def start_task(x):
        time.sleep(10)
        return x + 3

    @w.create_task()
    def mid_task(x):
        time.sleep(10)
        return x + 42

    @w.create_task()
    def final(l):
        time.sleep(10)
        return sum(l)

    y = start_task(1)
    res = final([mid_task(y) for _ in range(10)])
    w.save("dag.dot")

    # p = LP.ProcessProvider()
    p = LP.LXCProvider()
    # p = QingProvider(api_keypath="access_key.csv",
    #                  zone="pek2",
    #                  image="img-otvbfhwn",
    #                  keypair="kp-p2h7c1sp",
    #                  vxnets="vxnet-0domhwj")
    e = LimitEngine(p, 4)

    st = time.time()
    e.start_with_server(w)
    ft = time.time()

    w.dump_time("exectime.json")

    print "Result:", res.value
    print "Cost:", p.total_cost()
    print "Makespan:", ft - st
Exemple #5
0
dag_path = base_path + "dag/"
output_path = base_path + "output/"
plot_path = base_path + "plot/"
support_path = base_path + "support/"
info_path = support_path + "ec2.json"
hv_module_path = support_path + "hv.py"

workflows = {
    "LIGO": [30, 50, 100],
    "MONTAGE": [30, 50, 100],
    "CYBERSHAKE": [30, 50, 100]
}
algorithms = ["spea2_star", "esc_p", "esc_f", "esc_nh", "moabc"]
hv_reference_point = [1.1, 1.1]

w = Workflow(disabled=False)


@w.create_task()
def generate_xml(app, size):
    xml_path = dag_path + "%s_%d.dax" % (app, size)
    wf_generator = sh.Command(support_path +
                              "WorkflowGenerator/bin/AppGenerator")
    wf_generator("-a%s" % app, "--", n=size, _out=xml_path)
    return xml_path


@w.create_task()
def convert_dag(xml_path):
    json_path = xml_path[:-4] + ".json"
    convert_program = sh.Command(support_path + "convert")