from numap import NuMap from papy.core import Dagger, Piper def l33t(inbox): word = inbox[0] return word.replace('e', '3').replace('o', '0') def l33ter(inbox): word = inbox[0] return word.replace('l', '1') # execution endgine numap = NuMap() # function nodes l33t_piper = Piper(l33t, parallel=numap) l33ter_piper = Piper(l33ter, parallel=numap) # topology pipeline = Dagger() pipeline.add_pipe((l33t_piper, l33ter_piper)) end = pipeline.get_outputs()[0] # runtime pipeline.connect([['hello', 'world']]) pipeline.start() print list(end)
("package", "txt"), ), "params":{ } } sh_worker = Worker(script, (sh_cfg,)) py_worker = Worker(script, (py_cfg,)) # execution engine numap = NuMap() # function nodes sh_piper = Piper(sh_worker, parallel=numap) py_piper = Piper(py_worker, parallel=numap) # topology pipeline = Dagger() pipeline.add_pipe((sh_piper, py_worker)) end = pipeline.get_outputs()[0] # runtime pipeline.connect( [[ {"message":"work_moar.txt"}, {"message":"nevar_give_up.txt"} ]]) pipeline.start() print list(end)
# -*- coding: utf-8 -*- from numap import NuMap from papy.core import Dagger, Piper def l33t(inbox): word = inbox[0] return word.replace('e', '3').replace('o', '0') def l33ter(inbox): word = inbox[0] return word.replace('l', '1') # execution endgine numap = NuMap() # function nodes l33t_piper = Piper(l33t, parallel=numap) l33ter_piper = Piper(l33ter, parallel=numap) # topology pipeline = Dagger() pipeline.add_pipe((l33t_piper, l33ter_piper)) end = pipeline.get_outputs()[0] # runtime pipeline.connect([['hello', 'world']]) pipeline.start() print list(end)
#!/usr/bin/env python # -*- coding: utf-8 -*- from papy.core import Piper, Dagger def l33t(inbox): word = inbox[0] return word.replace('e', '3').replace('o', '0') def join(inbox): left_word, right_word = inbox return left_word + " " + right_word left_l33t = Piper(l33t, branch=1) right_l33t = Piper(l33t, branch=2) join_l33t = Piper(join) pipeline = Dagger() pipeline.add_pipe((left_l33t, join_l33t)) pipeline.add_pipe((right_l33t, join_l33t)) end = pipeline.get_outputs()[0] pipeline.connect([ ['hello', 'hi'], ['world', 'folks'] ]) pipeline.start() print list(end)
#!/usr/bin/env python # -*- coding: utf-8 -*- from papy.core import Piper, Dagger def l33t(inbox): word = inbox[0] return word.replace("e", "3").replace("o", "0") def join(inbox): left_word, right_word = inbox return left_word + " " + right_word left_l33t = Piper(l33t, branch=1) right_l33t = Piper(l33t, branch=2) join_l33t = Piper(join) pipeline = Dagger() pipeline.add_pipe((left_l33t, join_l33t)) pipeline.add_pipe((right_l33t, join_l33t)) end = pipeline.get_outputs()[0] pipeline.connect([["hello", "hi"], ["world", "folks"]]) pipeline.start() print list(end)
"script": "python_script.py", "in": ("greeting", ), "out": (("package", "txt"), ), "params": {} } sh_worker = Worker(script, (sh_cfg, )) py_worker = Worker(script, (py_cfg, )) # execution engine numap = NuMap() # function nodes sh_piper = Piper(sh_worker, parallel=numap) py_piper = Piper(py_worker, parallel=numap) # topology pipeline = Dagger() pipeline.add_pipe((sh_piper, py_worker)) end = pipeline.get_outputs()[0] # runtime pipeline.connect([[{ "message": "work_moar.txt" }, { "message": "nevar_give_up.txt" }]]) pipeline.start() print list(end)
#!/usr/bin/env python # -*- coding: utf-8 -*- from numap import NuMap from papy.core import Dagger, Piper from papy.util.func import ipasser def merge(inbox): word1 = inbox[0] word2 = inbox[1] return word1 + word2 # function nodes merge_p = Piper(merge) inp1_p = Piper(ipasser) inp2_p = Piper(ipasser) # topology pipeline = Dagger() pipeline.add_pipe((inp2_p, merge_p), branch="2") pipeline.add_pipe((inp1_p, merge_p), branch="1") end = pipeline.get_outputs()[0] # # runtime pipeline.connect([['hello ', 'world '], ["world", "hello"]]) pipeline.start() print list(end)
#!/usr/bin/env python # -*- coding: utf-8 -*- from numap import NuMap from papy.core import Dagger, Piper from papy.util.func import ipasser def merge(inbox): word1 = inbox[0] word2 = inbox[1] return word1 + word2 # function nodes merge_p = Piper(merge) inp1_p = Piper(ipasser) inp2_p = Piper(ipasser) # topology pipeline = Dagger() pipeline.add_pipe((inp2_p, merge_p), branch="2") pipeline.add_pipe((inp1_p, merge_p), branch="1") end = pipeline.get_outputs()[0] # # runtime pipeline.connect([['hello ', 'world '], ["world", "hello"]]) pipeline.start() print list(end)