Пример #1
0
def create_pipeline(events_queue=None):
    election = Election(events_queue=events_queue)

    election_pipeline = Pipeline(
        [Node(election.check_for_quorum),
         Node(election.requeue_transactions)])

    return election_pipeline
Пример #2
0
def create_pipeline():
    testPipline = TestPipline()
    pipeline = Pipeline([
        Pipe(maxsize=5000),
        Node(testPipline.filter_tx, fraction_of_cores=5),
        Node(testPipline.create),
    ])
    return pipeline
Пример #3
0
def indata_pipeline_outdata():
    from multipipes import Pipeline, Pipe, Node

    indata = Pipe()
    outdata = Pipe()

    def divide(a, b):
        return a / b

    def inc(n):
        return n + 1

    p = Pipeline([
        Node(divide),
        Node(inc, fraction_of_cores=1),
    ])

    p.setup(indata=indata, outdata=outdata)

    return (indata, p, outdata)
Пример #4
0
def create_pipeline(timeout=5, backlog_reassign_delay=5):
    """Create and return the pipeline of operations to be distributed
    on different processes."""

    stm = StaleTransactionMonitor(
        timeout=timeout, backlog_reassign_delay=backlog_reassign_delay)

    monitor_pipeline = Pipeline(
        [Node(stm.check_transactions),
         Node(stm.reassign_transactions)])

    return monitor_pipeline
def create_pipeline():
    """Create and return the pipeline of operations to be distributed
    on different processes."""

    voter = Vote()

    return Pipeline([
        Node(voter.validate_block),
        Node(voter.ungroup),
        Node(voter.validate_tx, fraction_of_cores=1),
        Node(voter.vote),
        Node(voter.write_vote)
    ])
Пример #6
0
def create_pipeline():
    """Create and return the pipeline of operations to be distributed
    on different processes."""

    block = Block()

    block_pipeline = Pipeline([
        Node(block.filter_tx),
        Node(block.validate_tx, fraction_of_cores=1),
        Node(block.create, timeout=1),
        Node(block.write),
        Node(block.delete_tx),
    ])

    return block_pipeline
Пример #7
0
def create_pipeline():
    """Create and return the pipeline of operations to be distributed
    on different processes."""

    block_pipeline = BlockPipeline()

    pipeline = Pipeline([
        Pipe(maxsize=1000),
        Node(block_pipeline.filter_tx),
        Node(block_pipeline.validate_tx, fraction_of_cores=1),
        Node(block_pipeline.create, timeout=1),
        Node(block_pipeline.write),
        Node(block_pipeline.delete_tx),
    ])

    return pipeline
Пример #8
0
def test_step():
    result = []

    def append(val):
        result.append(val)

    p = Pipeline([Node(emit()), Node(lambda x: x**2), Node(append)])

    p.step()
    assert result == [0]

    p.step()
    assert result == [0, 1]

    p.step()
    assert result == [0, 1, 4]

    p.step()
    p.step()
    p.step()
    assert result == [0, 1, 4, 9, 16, 25]
Пример #9
0
def create_pipeline():
    localVote = LocalVote()
    localVote__pipeline = Pipeline([])
    return localVote__pipeline
def test_step():
    result = []

    def append(val):
        result.append(val)

    p = Pipeline([
        Node(emit()),
        Node(lambda x: x**2),
        Node(append)
    ])

    p.step()
    assert result == [0]

    p.step()
    assert result == [0, 1]

    p.step()
    assert result == [0, 1, 4]

    p.step()
    p.step()
    p.step()
    assert result == [0, 1, 4, 9, 16, 25]
Пример #11
0
def create_pipeline():
    localBlock = LocalBlock()
    localBlock__pipeline = Pipeline([])
    return localBlock__pipeline