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


Python WorkflowGraph.inputmappings方法代码示例

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


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

示例1: parallelStdDev

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def parallelStdDev(index=0):
    composite = WorkflowGraph()
    parStdDev = StdDevPE(index)
    reduceStdDev = StdDevReducePE()
    composite.connect(parStdDev, parStdDev.OUTPUT_NAME, reduceStdDev, reduceStdDev.INPUT_NAME)
    composite.inputmappings = { 'input' : (parStdDev, parStdDev.INPUT_NAME) }
    composite.outputmappings = { 'output' : (reduceStdDev, reduceStdDev.OUTPUT_NAME) }
    return composite
开发者ID:akrause2014,项目名称:dispel4py,代码行数:10,代码来源:aggregate.py

示例2: parallel_aggregate

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def parallel_aggregate(instPE, reducePE):
    composite = WorkflowGraph()
    reducePE.inputconnections[AggregatePE.INPUT_NAME]['grouping'] = 'global'
    reducePE.numprocesses = 1
    composite.connect(instPE, AggregatePE.OUTPUT_NAME, reducePE, AggregatePE.INPUT_NAME)
    composite.inputmappings = { 'input' : (instPE, AggregatePE.INPUT_NAME) }
    composite.outputmappings = { 'output' : (reducePE, AggregatePE.OUTPUT_NAME) }
    return composite
开发者ID:akrause2014,项目名称:dispel4py,代码行数:10,代码来源:aggregate.py

示例3: parallelAvg

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def parallelAvg(index=0):
    composite = WorkflowGraph()
    parAvg = AverageParallelPE(index)
    reduceAvg = AverageReducePE()
    composite.connect(parAvg, parAvg.OUTPUT_NAME, reduceAvg, reduceAvg.INPUT_NAME)
    composite.inputmappings = { 'input' : (parAvg, parAvg.INPUT_NAME) }
    composite.outputmappings = { 'output' : (reduceAvg, reduceAvg.OUTPUT_NAME) }
    return composite
开发者ID:akrause2014,项目名称:dispel4py,代码行数:10,代码来源:aggregate.py

示例4: parallelStdDev

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def parallelStdDev(index=0):
    '''
    Creates a STDDEV composite PE that can be parallelised using a map-reduce pattern.
    '''
    composite = WorkflowGraph()
    parStdDev = StdDevPE(index)
    reduceStdDev = StdDevReducePE()
    composite.connect(parStdDev, parStdDev.OUTPUT_NAME, reduceStdDev, reduceStdDev.INPUT_NAME)
    composite.inputmappings = { 'input' : (parStdDev, parStdDev.INPUT_NAME) }
    composite.outputmappings = { 'output' : (reduceStdDev, reduceStdDev.OUTPUT_NAME) }
    return composite
开发者ID:krischer,项目名称:dispel4py,代码行数:13,代码来源:aggregate.py

示例5: parallelAvg

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def parallelAvg(index=0):
    '''
    Creates an AVG composite PE that can be parallelised using a map-reduce pattern.
    '''
    composite = WorkflowGraph()
    parAvg = AverageParallelPE(index)
    reduceAvg = AverageReducePE()
    composite.connect(parAvg, parAvg.OUTPUT_NAME, reduceAvg, reduceAvg.INPUT_NAME)
    composite.inputmappings = { 'input' : (parAvg, parAvg.INPUT_NAME) }
    composite.outputmappings = { 'output' : (reduceAvg, reduceAvg.OUTPUT_NAME) }
    return composite
开发者ID:krischer,项目名称:dispel4py,代码行数:13,代码来源:aggregate.py

示例6: create_iterative_chain

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def create_iterative_chain(functions,
                           FunctionPE_class=SimpleFunctionPE,
                           name_prefix='PE_',
                           name_suffix=''):

    '''
    Creates a composite PE wrapping a pipeline that processes obspy streams.
    :param chain: list of functions that process data iteratively. The function
    accepts one input parameter, data, and returns an output data block
    (or None).
    :param requestId: id of the request that the stream is associated with
    :param controlParameters: environment parameters for the processing
    elements
    :rtype: dictionary inputs and outputs of the composite PE that was created
    '''

    prev = None
    first = None
    graph = WorkflowGraph()

    for fn_desc in functions:
        try:
            fn = fn_desc[0]
            params = fn_desc[1]
        except TypeError:
            fn = fn_desc
            params = {}

        # print 'adding %s to chain' % fn.__name__
        pe = FunctionPE_class()
        pe.compute_fn = fn
        pe.params = params
        pe.name = name_prefix + fn.__name__ + name_suffix

        if prev:
            graph.connect(prev, IterativePE.OUTPUT_NAME,
                          pe, IterativePE.INPUT_NAME)
        else:
            first = pe
        prev = pe

    # Map inputs and outputs of the wrapper to the nodes in the subgraph
    graph.inputmappings = {'input': (first, IterativePE.INPUT_NAME)}
    graph.outputmappings = {'output': (prev, IterativePE.OUTPUT_NAME)}

    return graph
开发者ID:KNMI,项目名称:wps_workflow,代码行数:48,代码来源:base.py

示例7: test_dot_composite

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def test_dot_composite():
    def inc(a):
        return a + 1

    def dec(a):
        return a - 1

    graph = WorkflowGraph()
    prod = TestProducer()
    comp = create_iterative_chain([inc, dec])
    cons = TestOneInOneOut()
    graph.connect(prod, "output", comp, "input")
    graph.connect(comp, "output", cons, "input")
    graph.inputmappings = {"input": (prod, "input")}
    root_prod = TestProducer()
    root_graph = WorkflowGraph()
    root_graph.connect(root_prod, "output", graph, "input")
    dot = draw(root_graph)
    tools.ok_("subgraph cluster_" in dot)
开发者ID:anqilu,项目名称:dispel4py,代码行数:21,代码来源:workflow_graph_test.py

示例8: createProcessingComposite

# 需要导入模块: from dispel4py.workflow_graph import WorkflowGraph [as 别名]
# 或者: from dispel4py.workflow_graph.WorkflowGraph import inputmappings [as 别名]
def createProcessingComposite(chain, suffix='', controlParameters={}, provRecorder=None):
    '''
    Creates a composite PE wrapping a pipeline that processes obspy streams.
    :param chain: list of functions that process obspy streams. The function takes one input parameter, stream, and returns an output stream.
    :param requestId: id of the request that the stream is associated with
    :param controlParameters: environment parameters for the processing elements
    :rtype: dictionary inputs and outputs of the composite PE that was created
    '''
    prev = None
    first = None
    graph = WorkflowGraph()
    
    for fn_desc in chain:
        pe = ObspyStreamPE()
        try:
        	fn = fn_desc[0]
        	params = fn_desc[1]
        except TypeError:
            fn = fn_desc
            params = {}
	
        pe.compute_fn = fn
        pe.name = 'ObspyStreamPE_' + fn.__name__ + suffix
        pe.controlParameters = controlParameters
        pe.appParameters = dict(params)
        pe.setCompute(fn, params)
        
        # connect the metadata output to the provenance recorder PE if there is one
        if provRecorder:
            graph.connect(pe, 'metadata', provRecorder, 'metadata')
        
        if prev:
            graph.connect(prev, OUTPUT_NAME, pe, INPUT_NAME)
        else:
            first = pe
        prev = pe
            
    # Map inputs and outputs of the wrapper to the nodes in the subgraph
    graph.inputmappings =  { 'input'  : (first, INPUT_NAME) }
    graph.outputmappings = { 'output' : (prev, OUTPUT_NAME) }
    
    return graph
开发者ID:andrejsim,项目名称:dispel4py,代码行数:44,代码来源:obspy_stream.py


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