Exemple #1
0
def test_register():
    from vital.config import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import scheduler_factory

    modules.load_known_modules()

    sched_type = 'python_example'
    sched_desc = 'simple description'

    scheduler_factory.add_scheduler(sched_type, sched_desc,
                                    example_scheduler(True))

    if not sched_desc == scheduler_factory.description(sched_type):
        test_error("Description was not preserved when registering")

    p = pipeline.Pipeline()

    try:
        s = scheduler_factory.create_scheduler(sched_type, p)
        if s is None:
            raise Exception()
    except:
        test_error("Could not create newly registered scheduler type")
Exemple #2
0
def test_api_calls():
    from vital.config import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import scheduler_factory

    modules.load_known_modules()

    sched_type = 'thread_per_process'
    c = config.empty_config()
    p = pipeline.Pipeline()

    scheduler_factory.create_scheduler(sched_type, p)
    scheduler_factory.create_scheduler(sched_type, p, c)
    scheduler_factory.types()
    scheduler_factory.description(sched_type)
    scheduler_factory.default_type
def test_api_calls():
    from sprokit.pipeline import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import scheduler_factory

    modules.load_known_modules()

    sched_type = 'thread_per_process'
    c = config.empty_config()
    p = pipeline.Pipeline()

    scheduler_factory.create_scheduler(sched_type, p)
    scheduler_factory.create_scheduler(sched_type, p, c)
    scheduler_factory.types()
    scheduler_factory.description(sched_type)
    scheduler_factory.default_type
Exemple #4
0
def run_pipeline(sched_type, pipe, conf):
    from sprokit.pipeline import config
    from sprokit.pipeline import modules
    from sprokit.pipeline import scheduler_factory

    modules.load_known_modules()

    s = scheduler_factory.create_scheduler(sched_type, pipe, conf)

    s.start()
    s.wait()
Exemple #5
0
def run_pipeline(sched_type, pipe, conf):
    from vital.config import config
    from vital.modules import modules
    from sprokit.pipeline import scheduler_factory
    import sys

    modules.load_known_modules()

    if sched_type in cpp_scheds:
        expect_exception("trying to run a python process on a C++ scheduler", RuntimeError,
                         scheduler_factory.create_scheduler, sched_type, pipe, conf)

    else:
        s = scheduler_factory.create_scheduler(sched_type, pipe, conf)

        s.start()
        s.wait()
Exemple #6
0
def run_pipeline(sched_type, pipe, conf):
    from sprokit.pipeline import config
    from sprokit.pipeline import modules
    from sprokit.pipeline import scheduler_factory
    import sys

    modules.load_known_modules()

    if sched_type in cpp_scheds:
        expect_exception("trying to run a python process on a C++ scheduler", RuntimeError,
                         scheduler_factory.create_scheduler, sched_type, pipe, conf)

    else:
        s = scheduler_factory.create_scheduler(sched_type, pipe, conf)

        s.start()
        s.wait()
Exemple #7
0
def test_wrapper_api():
    from vital.config import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import process_factory
    from sprokit.pipeline import scheduler_factory

    sched_type = 'python_example'
    sched_desc = 'simple description'

    modules.load_known_modules()

    scheduler_factory.add_scheduler(sched_type, sched_desc,
                                    example_scheduler(False))

    p = pipeline.Pipeline()

    proc_type = 'orphan'
    proc_name = 'orphan'

    proc = process_factory.create_process(proc_type, proc_name)

    p.add_process(proc)

    def check_scheduler(s):
        if s is None:
            test_error("Got a 'None' scheduler")
            return

        s.start()
        s.pause()
        s.resume()
        s.stop()
        s.start()
        s.wait()

        del s

    p.reset()
    p.setup_pipeline()

    s = scheduler_factory.create_scheduler(sched_type, p)
    check_scheduler(s)
def test_wrapper_api():
    from sprokit.pipeline import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import process_factory
    from sprokit.pipeline import scheduler_factory

    sched_type = 'python_example'
    sched_desc = 'simple description'

    modules.load_known_modules()

    scheduler_factory.add_scheduler(sched_type, sched_desc, example_scheduler(False))

    p = pipeline.Pipeline()

    proc_type = 'orphan'
    proc_name = 'orphan'

    proc = process_factory.create_process(proc_type, proc_name)

    p.add_process(proc)

    def check_scheduler(s):
        if s is None:
            test_error("Got a 'None' scheduler")
            return

        s.start()
        s.pause()
        s.resume()
        s.stop()
        s.start()
        s.wait()

        del s

    p.reset()
    p.setup_pipeline()

    s = scheduler_factory.create_scheduler(sched_type, p)
    check_scheduler(s)
def test_register():
    from sprokit.pipeline import config
    from vital.modules import modules
    from sprokit.pipeline import pipeline
    from sprokit.pipeline import scheduler_factory

    modules.load_known_modules()

    sched_type = 'python_example'
    sched_desc = 'simple description'

    scheduler_factory.add_scheduler(sched_type, sched_desc, example_scheduler(True))

    if not sched_desc == scheduler_factory.description(sched_type):
        test_error("Description was not preserved when registering")

    p = pipeline.Pipeline()

    try:
        s = scheduler_factory.create_scheduler(sched_type, p)
        if s is None:
            raise Exception()
    except:
        test_error("Could not create newly registered scheduler type")