Ejemplo n.º 1
0
def run():
    input_end = RabbitmqInputEndpoint('amz_qa:input', **RABBITMQ_CONF)
    output_end = RabbitmqOutputEndpoint(
        ['amz_qa:input', 'amz_qa:output', 'amz_ip_ban:input'], **RABBITMQ_CONF)
    queue = asyncio.Queue()
    notify_input_end = pipeflow.QueueInputEndpoint(queue)
    notify_output_end = pipeflow.QueueOutputEndpoint(queue)
    queue = asyncio.Queue()
    inner_input_end = pipeflow.QueueInputEndpoint(queue)
    inner_output_end = pipeflow.QueueOutputEndpoint(queue)

    server = pipeflow.Server()

    task_group = server.add_group('task', 1)
    task_group.set_handle(handle_task)
    task_group.add_input_endpoint('input', input_end)
    task_group.add_input_endpoint('notify', notify_input_end)
    task_group.add_output_endpoint('input_back', output_end, 'amz_qa:input')
    task_group.add_output_endpoint('inner_output', inner_output_end)

    worker_group = server.add_group('work', MAX_WORKERS)
    worker_group.set_handle(handle_worker)
    worker_group.add_input_endpoint('inner_input', inner_input_end)
    worker_group.add_output_endpoint('output', output_end, 'amz_qa:output')
    worker_group.add_output_endpoint('inner_output', inner_output_end)
    worker_group.add_output_endpoint('notify', notify_output_end)
    worker_group.add_output_endpoint('ban', output_end, 'amz_ip_ban:input')

    server.run()
Ejemplo n.º 2
0
def run():
    input_end = RabbitmqInputEndpoint('http_callback:input', **RABBITMQ_CONF)
    server = pipeflow.Server()
    group = server.add_group('main', MAX_WORKERS)
    group.add_input_endpoint('input', input_end)
    group.set_handle(handle_worker)
    server.run()
Ejemplo n.º 3
0
def run():
    input_end = RabbitmqInputEndpoint('statistic:input', **RABBITMQ_CONF)
    server = pipeflow.Server()
    server.add_worker(auto_flush)
    group = server.add_group('main', MAX_WORKERS)
    group.add_input_endpoint('input', input_end)
    group.set_handle(handle_worker)
    server.run()
Ejemplo n.º 4
0
def run():
    input_end = RabbitmqInputEndpoint('amz_product:input', **RABBITMQ_CONF)
    input5_end = RabbitmqInputEndpoint('amz_product:5:input', **RABBITMQ_CONF)
    output_end = RabbitmqOutputEndpoint([
        'amz_product:input', 'amz_product:5:input', 'amz_product:output',
        'amz_ip_ban:input'
    ], **RABBITMQ_CONF)

    server = pipeflow.Server()
    group = server.add_group('main', MAX_WORKERS)
    group.set_handle(handle_worker)
    group.add_input_endpoint('input', input_end)
    group.add_input_endpoint('input5_end', input5_end)
    group.add_output_endpoint('input_back', output_end, 'amz_product:input')
    group.add_output_endpoint('input_5_back', output_end,
                              'amz_product:5:input')
    group.add_output_endpoint('output', output_end, 'amz_product:output')
    group.add_output_endpoint('ban', output_end, 'amz_ip_ban:input')
    server.run()
Ejemplo n.º 5
0
def run():
    get_popt()
    input_end = RabbitmqInputEndpoint('amz_bsr_result:input', **RABBITMQ_CONF)
    output_end = pipeflow.RedisOutputEndpoint('amz_product:output:bsr',
                                              **BSR_REDIS_CONF)

    server = pipeflow.Server()
    group = server.add_group('main', 1)
    group.set_handle(handle_worker)
    group.add_input_endpoint('input', input_end)
    group.add_output_endpoint('output', output_end)
    server.run()
Ejemplo n.º 6
0
def run():
    ban_input_end = RabbitmqInputEndpoint('amz_ip_ban:input', **RABBITMQ_CONF)
    release_ip_end = TimeInputEndpoint('amz_banned_ip', **IP_REDIS_CONF)
    ban_ip_end = TimeOutputEndpoint([('amz_banned_ip', 2880)], **IP_REDIS_CONF)

    server = pipeflow.Server()
    group = server.add_group('remove', 1)
    group.add_input_endpoint('input', ban_input_end)
    group.add_output_endpoint('output', ban_ip_end)
    group.set_handle(remove_proxy)

    group = server.add_group('realse', 1)
    group.add_input_endpoint('input', release_ip_end)
    group.set_handle(release_proxy)
    server.run()