示例#1
0
文件: link_uo.py 项目: volks73/mpipe
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)
示例#2
0
文件: unordered.py 项目: todo/mpipe
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)
示例#3
0
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)
示例#4
0
            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)