def main(): stage1 = UnorderedStage(increment, 3) stage2 = OrderedStage(double, 3) stage1.link(stage2) pipe = Pipeline(stage1) for number in range(10): pipe.put(number) pipe.put(None) for result in pipe.results(): print(result)
from mpipe import UnorderedStage, Pipeline def increment(value): return value + 1 def double(value): return value * 2 stage1 = UnorderedStage(increment, 2) stage2 = UnorderedStage(double, 2) stage1.link(stage2) pipe = Pipeline(stage1) for number in range(10): pipe.put(number) pipe.put(None) for result in pipe.results(): print(result)
from mpipe import OrderedStage, UnorderedStage, Pipeline def increment(value): return value + 1 def double(value): return value * 2 stage1 = UnorderedStage(increment, 3) stage2 = OrderedStage(double, 3) stage1.link(stage2) pipe = Pipeline(stage1) for number in range(10): pipe.put(number) pipe.put(None) for result in pipe.results(): print(result)
for jsonstring in extratedfile: linecount += 1 result = json.load(createtable.readablestring(jsonstring)) uniquerowkey = result['id'] query = queryfy.create_query_from_json(createtable.readablestring(jsonstring)) table.put(uniquerowkey, query) except Exception: error = traceback.format_exc() bundle.error=error logfile.write('LOGS:'+bundle.logs+'\n'+'ERRORS:'+bundle.error+'\n'+'TIME TAKEN: '+str(datetime.datetime.now()-bundle.starttime)) logfile.close() if __name__ == '__main__': stage1 = UnorderedStage(fetch, 4) stage2 = UnorderedStage(extractandclean, 4) stage3 = UnorderedStage(updatetable, 4) stage1.link(stage2) stage2.link(stage3) pipe = Pipeline(stage1) for number in range(0,8): pipe.put(number) pipe.put(None)