本文整理汇总了Python中dispel4py.workflow_graph.WorkflowGraph类的典型用法代码示例。如果您正苦于以下问题:Python WorkflowGraph类的具体用法?Python WorkflowGraph怎么用?Python WorkflowGraph使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WorkflowGraph类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testContinuousReduce
def testContinuousReduce():
prod = NumberProducer()
test = TestPE()
graph = WorkflowGraph()
graph.connect(prod, 'output', test, 'input')
results = simple_process.process_and_return(graph, {prod: 5})
tools.eq_({test.id: {'output': [[0] for i in range(5)]}}, results)
示例2: test_types
def test_types():
graph = WorkflowGraph()
prod = TestProducer()
cons = TestOneInOneOut()
graph.connect(prod, "output", cons, "input")
graph.propagate_types()
tools.eq_(prod.outputconnections["output"]["type"], cons.inputconnections["input"]["type"])
示例3: testConsumer
def testConsumer():
graph = WorkflowGraph()
prod = TestProducer()
cons = PrintDataConsumer()
graph.connect(prod, "output", cons, "input")
results = simple_process.process_and_return(graph, {prod: 10})
tools.eq_({}, results)
示例4: testIterative
def testIterative():
graph = WorkflowGraph()
prod = TestProducer()
cons = TestIterative()
graph.connect(prod, "output", cons, "input")
results = simple_process.process_and_return(graph, {prod: 25})
tools.eq_({cons.id: {"output": list(range(1, 26))}}, results)
示例5: main
def main():
if len(sys.argv) < 5:
print "Incorrect arguments provided. Proper format: python tupleCounter.py <inputFile> <numRepeats> <outputFile> <numCores>"
sys.exit()
inputFilename = sys.argv[1]
numRepeats = int(sys.argv[2])
outputFile = sys.argv[3]
numCores = int(sys.argv[4])
producer = TupleProducer(inputFilename, numRepeats)
makeDicts = MakeDict()
collector = CollectCounts(outputFile)
graph = WorkflowGraph()
graph.connect(producer, 'output', makeDicts, 'input')
graph.connect(makeDicts, 'output', collector, 'input')
from dispel4py.new.multi_process import process as multi_process
import argparse
args = argparse.Namespace
args.num = numCores
args.simple = False
multi_process(graph, {producer: 1}, args)
示例6: esgf_workflow
def esgf_workflow(source, worker, monitor=None, headers=None):
graph = WorkflowGraph()
# TODO: configure limit
esgsearch = EsgSearch(
url=wps_url(),
search_url=source.get('url', 'https://esgf-data.dkrz.de/esg-search'),
constraints=source.get('constraints', source.get('facets')), # facets for backward compatibility
query=source.get('query'),
limit=source.get('limit', 100),
search_type='File',
distrib=source.get('distrib'),
replica=source.get('replica'),
latest=source.get('latest'),
temporal=source.get('temporal'),
start=source.get('start'),
end=source.get('end'))
esgsearch.set_monitor(monitor, 0, 10)
download = Download(url=wps_url(), headers=headers)
download.set_monitor(monitor, 10, 50)
doit = GenericWPS(headers=headers, **worker)
doit.set_monitor(monitor, 50, 100)
graph.connect(esgsearch, esgsearch.OUTPUT_NAME,
download, download.INPUT_NAME)
graph.connect(download, download.OUTPUT_NAME, doit, doit.INPUT_NAME)
result = simple_process.process(graph, inputs={esgsearch: [{}]})
status_location = result.get((doit.id, doit.STATUS_LOCATION_NAME))[0]
status = result.get((doit.id, doit.STATUS_NAME))[0]
return dict(worker=dict(status_location=status_location, status=status))
示例7: testWriter
def testWriter():
graph = WorkflowGraph()
prod = TestProducer()
cons1 = TestOneInOneOutWriter()
graph.connect(prod, "output", cons1, "input")
results = simple_process.process_and_return(graph, {prod: 5})
tools.eq_({cons1.id: {"output": list(range(1, 6))}}, results)
示例8: graph_sum
def graph_sum():
prod = NumberProducer(1000)
prod.name = 'NumberProducer'
s = parallelSum()
graph = WorkflowGraph()
graph.connect(prod, 'output', s, 'input')
return graph
示例9: testWordCount
def testWordCount():
prod = RandomWordProducer()
filt = RandomFilter()
count = WordCounter()
graph = WorkflowGraph()
graph.connect(prod, "output", filt, "input")
graph.connect(filt, "output", count, "input")
simple_process.process(graph, inputs={prod: 100})
示例10: parallelStdDev
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
示例11: parallelAvg
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
示例12: testOnetoAll
def testOnetoAll():
graph = WorkflowGraph()
prod = t.TestProducer()
cons = t.TestOneInOneOut()
cons.numprocesses = 2
cons.inputconnections['input']['grouping'] = 'all'
graph.connect(prod, 'output', cons, 'input')
return graph
示例13: graph_min_max
def graph_min_max():
prod = NumberProducer(1000)
mi = parallelMin()
ma = parallelMax()
graph = WorkflowGraph()
graph.connect(prod, 'output', mi, 'input')
graph.connect(prod, 'output', ma, 'input')
return graph
示例14: parallel_aggregate
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
示例15: testTee
def testTee():
graph = WorkflowGraph()
prod = TestProducer()
cons1 = TestOneInOneOut()
cons2 = TestOneInOneOut()
graph.connect(prod, 'output', cons1, 'input')
graph.connect(prod, 'output', cons2, 'input')
multiprocess(graph, 3, [{}, {}, {}])