Ejemplo n.º 1
0
def test_simple_example2():
    producer = IntProducer(0, 40, 0.01)
    sum_agg = SumAggregator()(producer)
    printer = CommandlineConsumer()(sum_agg)
    flow = Flow([producer], [printer])
    flow.run()
    flow.join()
Ejemplo n.º 2
0
def test_mp_example1():
    producer = IntProducer(0, 40, 0.1)
    identity = IdentityProcessor(nb_tasks = 5)(producer)
    identity1 = IdentityProcessor(nb_tasks = 5)(identity)
    joined = JoinerProcessor(nb_tasks = 5)(identity, identity1)
    printer = CommandlineConsumer()(joined)
    flow = Flow([producer], [printer])
    flow.run()
    flow.join()
Ejemplo n.º 3
0
def test_taskmodulenode_example1():
    producer = IntProducer(0, 40, 0.05)
    identity = IdentityProcessor(nb_tasks = 1)(producer)
    identity1 = IdentityProcessor(nb_tasks = 1)(identity)
    joined = JoinerProcessor(nb_tasks = 1)(identity, identity1)
    task_module = TaskModuleNode(identity, joined)
    printer = CommandlineConsumer()(task_module)
    flow = Flow([producer], [printer])
    flow.run()
    flow.join()
Ejemplo n.º 4
0
def test_graph_with_no_consumer():
    # Graph with no consumer should run.
    producer = IntProducer(0, 40, 0.05)
    identity = IdentityProcessor(nb_tasks=1)(producer)
    identity1 = IdentityProcessor(nb_tasks=1)(identity)
    joined = JoinerProcessor(nb_tasks=1)(identity, identity1)
    task_module = TaskModuleNode(identity, joined)
    flow = Flow([producer], [])
    flow.run()
    flow.join()
Ejemplo n.º 5
0
def test_graph_with_deadend_processor():
    # Graph with no consumer should run.
    producer = IntProducer(0, 40, 0.05)
    identity = IdentityProcessor(nb_tasks=1)(producer)
    identity1 = IdentityProcessor(nb_tasks=1)(identity)
    joined = JoinerProcessor(nb_tasks=1)(identity, identity1)
    task_module = TaskModuleNode(identity, joined)
    dead_end = IdentityProcessor()(task_module)
    printer = CommandlineConsumer()(task_module)
    flow = Flow([producer], [printer])
    flow.run()
    flow.join()
from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer

producer = IntProducer(0, 40, 0.1)
identity = IdentityProcessor()(producer)
identity1 = IdentityProcessor()(identity)
joined = JoinerProcessor()(identity, identity1)
printer = CommandlineConsumer()(joined)
flow = Flow([producer], [printer],maintain_states=True,state_config={"flow_name":"simple_example","save_interval":25})
flow.run()
flow.join()
Ejemplo n.º 7
0
from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer

producer = IntProducer(0, 40, 0.1)
identity = IdentityProcessor(nb_tasks=5)(producer)
identity1 = IdentityProcessor(nb_tasks=5)(identity)
joined = JoinerProcessor(nb_tasks=5)(identity, identity1)
printer = CommandlineConsumer()(joined)
flow = Flow([producer], [printer])
flow.run()
flow.join()
Ejemplo n.º 8
0
from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer
from videoflow.core.constants import BATCH

producer = IntProducer(0, 40, 0.1)
identity = IdentityProcessor(fps=4, nb_tasks=5, name='i1')(producer)
identity1 = IdentityProcessor(fps=2, nb_tasks=10, name='i2')(identity)
joined = JoinerProcessor(nb_tasks=5)(identity, identity1)
printer = CommandlineConsumer()(joined)
flow = Flow([producer], [printer], flow_type=BATCH)
flow.run()
flow.join()
Ejemplo n.º 9
0
import time

from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer

producer = IntProducer(0, 40, 0.1)
identity = IdentityProcessor(nb_tasks=5)(producer)
identity1 = IdentityProcessor(nb_tasks=5)(identity)
joined = JoinerProcessor(nb_tasks=5)(identity, identity1)
printer = CommandlineConsumer()(joined)
flow = Flow([producer], [printer])
flow.run()
time.sleep(2)
flow.stop()
Ejemplo n.º 10
0
from videoflow.core import Flow
from videoflow.producers import IntProducer
from videoflow.processors import IdentityProcessor, JoinerProcessor
from videoflow.consumers import CommandlineConsumer
from videoflow.core.constants import BATCH

reader = IntProducer(0, 100, 0.001)
game_state_processor = IdentityProcessor(fps=6, nb_tasks=1, name='i1')(reader)
hero_processors = JoinerProcessor()(reader, game_state_processor)
ability_processor = JoinerProcessor()(reader, game_state_processor,
                                      hero_processors)
ammo_processor = JoinerProcessor()(reader, game_state_processor)
death_processor = JoinerProcessor()(reader, game_state_processor)
hp_processor = JoinerProcessor()(reader, game_state_processor)
killfeed_processor = JoinerProcessor(fps=1, nb_tasks=5)(reader,
                                                        game_state_processor)
map_processor = JoinerProcessor()(reader, game_state_processor)
resurrect_processor = JoinerProcessor()(reader, game_state_processor)
sr_processor = JoinerProcessor()(reader, game_state_processor)
ultimate_processor = JoinerProcessor()(reader, game_state_processor)
player_score_processor = JoinerProcessor()(reader, game_state_processor)
consumer_before = JoinerProcessor()(
    reader, game_state_processor, hero_processors, death_processor,
    killfeed_processor, ammo_processor, hp_processor, ultimate_processor,
    ability_processor, player_score_processor, map_processor, sr_processor,
    resurrect_processor)
consumer = CommandlineConsumer()(consumer_before)
flow = Flow([reader], [consumer], flow_type=BATCH)
flow.run()
flow.join()