Example #1
0
def test_api_calls():
    from sprokit.pipeline import config
    from sprokit.pipeline import process
    from sprokit.pipeline import process_cluster

    process_cluster.PythonProcessCluster.property_no_threads
    process_cluster.PythonProcessCluster.property_no_reentrancy
    process_cluster.PythonProcessCluster.property_unsync_input
    process_cluster.PythonProcessCluster.property_unsync_output
    process_cluster.PythonProcessCluster.type_any
    process_cluster.PythonProcessCluster.type_none
    process_cluster.PythonProcessCluster.type_data_dependent
    process_cluster.PythonProcessCluster.type_flow_dependent
    process_cluster.PythonProcessCluster.flag_output_const
    process_cluster.PythonProcessCluster.flag_output_shared
    process_cluster.PythonProcessCluster.flag_input_static
    process_cluster.PythonProcessCluster.flag_input_mutable
    process_cluster.PythonProcessCluster.flag_input_nodep
    process_cluster.PythonProcessCluster.flag_required

    class BaseProcess(process.PythonProcess):
        def __init__(self, conf):
            process.PythonProcess.__init__(self, conf)

    c = config.empty_config()

    p = BaseProcess(c)

    if process_cluster.cluster_from_process(p) is not None:
        test_error("A non-cluster process was detected as a cluster process")
Example #2
0
def test_register_cluster():
    from vital.config import config
    from sprokit.pipeline import process
    from sprokit.pipeline import process_cluster
    from sprokit.pipeline import process_factory

    proc_type = 'python_example'
    proc_desc = 'simple description'

    process_factory.add_process(proc_type, proc_desc,
                                base_example_process_cluster())

    if not proc_desc == process_factory.description(proc_type):
        test_error("Description was not preserved when registering")

    p = None

    try:
        p = process_factory.create_process(proc_type, '')
        if p is None:
            raise Exception()
    except BaseException:
        import sys

        e = sys.exc_info()[1]

        test_error(
            "Could not create newly registered process cluster type: %s" %
            str(e))

    if process_cluster.cluster_from_process(p) is None:
        test_error(
            "A cluster process from the registry was not detected as a cluster process"
        )
Example #3
0
def test_register_cluster():
    from sprokit.pipeline import config
    from sprokit.pipeline import process
    from sprokit.pipeline import process_cluster
    from sprokit.pipeline import process_factory

    proc_type = 'python_example'
    proc_desc = 'simple description'

    process_factory.add_process(proc_type, proc_desc, base_example_process_cluster())

    if not proc_desc == process_factory.description(proc_type):
        test_error("Description was not preserved when registering")

    p = None

    try:
        p = process_factory.create_process(proc_type, '')
        if p is None:
            raise Exception()
    except BaseException:
        import sys

        e = sys.exc_info()[1]

        test_error("Could not create newly registered process cluster type: %s" % str(e))

    if process_cluster.cluster_from_process(p) is None:
        test_error("A cluster process from the registry was not detected as a cluster process")