当前位置: 首页>>代码示例>>Python>>正文


Python WorkflowGraph.flatten方法代码示例

本文整理汇总了Python中dispel4py.workflow_graph.WorkflowGraph.flatten方法的典型用法代码示例。如果您正苦于以下问题:Python WorkflowGraph.flatten方法的具体用法?Python WorkflowGraph.flatten怎么用?Python WorkflowGraph.flatten使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dispel4py.workflow_graph.WorkflowGraph的用法示例。


在下文中一共展示了WorkflowGraph.flatten方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testComposite

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import flatten [as 别名]
def testComposite():
    comp = CompositePE()
    cons1 = TestOneInOneOut()
    cons2 = TestOneInOneOut()
    comp.connect(cons1, "output", cons2, "input")
    comp._map_input("comp_input", cons1, "input")
    comp._map_output("comp_output", cons2, "output")
    prod = TestProducer()
    cons = TestOneInOneOut()
    graph = WorkflowGraph()
    graph.connect(prod, "output", comp, "comp_input")
    graph.connect(comp, "comp_output", cons, "input")
    graph.flatten()
    results = simple_process.process_and_return(graph, {prod: 10})
    tools.eq_({cons.id: {"output": list(range(1, 11))}}, results)
开发者ID:anqilu,项目名称:dispel4py,代码行数:17,代码来源:simple_process_test.py

示例2: testCreateChain

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import flatten [as 别名]
def testCreateChain():
    def add(a, b):
        return a + b

    def mult(a, b):
        return a * b

    def is_odd(a):
        return a % 2 == 1

    c = [(add, {"b": 1}), (mult, {"b": 3}), is_odd]
    chain = create_iterative_chain(c)
    prod = TestProducer()
    graph = WorkflowGraph()
    graph.connect(prod, "output", chain, "input")
    graph.flatten()
    results = simple_process.process_and_return(graph, {prod: 2})
    for key, value in results.items():
        tools.eq_({"output": [False, True]}, value)
开发者ID:anqilu,项目名称:dispel4py,代码行数:21,代码来源:simple_process_test.py

示例3: testCompositeWithCreateParams

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import flatten [as 别名]
def testCompositeWithCreateParams():
    cons1 = TestOneInOneOut()
    cons2 = TestOneInOneOut()

    def create_graph(graph, connections):
        for i in range(connections):
            graph.connect(cons1, "output", cons2, "input")

    comp = CompositePE(create_graph, {"connections": 2})
    comp._map_input("comp_input", cons1, "input")
    comp._map_output("comp_output", cons2, "output")
    prod = TestProducer()
    cons = TestOneInOneOut()
    graph = WorkflowGraph()
    graph.connect(prod, "output", comp, "comp_input")
    graph.connect(comp, "comp_output", cons, "input")
    graph.flatten()
    results = simple_process.process_and_return(graph, {prod: 10})
    expected = []
    for i in range(1, 11):
        expected += [i, i]
    tools.eq_({cons.id: {"output": expected}}, results)
开发者ID:anqilu,项目名称:dispel4py,代码行数:24,代码来源:simple_process_test.py

示例4: Source

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import flatten [as 别名]
sc = Source()
sc.name='PE_source'

squaref=SimpleFunctionPE(square,{'prov_cluster':'mycluster'})
#squaref=SimpleFunctionPE(square)
divf=Div()
divf.name='PE_div'


#processes=[squaref,divf]
#chain = create_iterative_chain(processes, FunctionPE_class=SimpleFunctionPE)

#Initialise the graph
graph = WorkflowGraph()

#Common way of composing the graph
graph.connect(sc,'output',squaref,'input')
graph.connect(squaref,'output',divf,'input')
#graph.connect(divf,'output',squaref,'input')

# Alternatively with pipeline array
#Create pipelines from functions

#graph.connect(sc,'output',chain,'input')


graph.flatten()

#Prepare Input
input_data = {"PE_source": [{"input": [25]}]}
开发者ID:aspinuso,项目名称:VERCE,代码行数:32,代码来源:undetermined_tst2.py


注:本文中的dispel4py.workflow_graph.WorkflowGraph.flatten方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。