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, process.ProcessName()) 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" )
def test_create(): from sprokit.pipeline import datum from sprokit.pipeline import process process.ProcessType() process.ProcessTypes() process.ProcessName() process.ProcessNames() process.ProcessProperty() process.ProcessProperties() process.PortDescription() process.PortFrequency(1) process.PortFrequency(1, 1) process.Port() process.Ports() process.PortType() process.PortFlag() process.PortFlags() process.PortAddr() process.PortAddrs() process.Connection() process.Connections() process.PortInfo('type', process.PortFlags(), 'desc', process.PortFrequency(1, 1)) process.ConfInfo('default', 'desc', False) process.DataInfo(True, datum.DatumType.invalid) process.DataCheck.none process.DataCheck.sync process.DataCheck.valid
def test_api_calls(): from sprokit.pipeline import config from sprokit.pipeline import modules from sprokit.pipeline import process from sprokit.pipeline import process_registry modules.load_known_modules() reg = process_registry.ProcessRegistry.self() proc_type = 'orphan' c = config.empty_config() reg.create_process(proc_type, process.ProcessName()) reg.create_process(proc_type, process.ProcessName(), c) reg.types() reg.description(proc_type) process_registry.Process.property_no_threads process_registry.Process.property_no_reentrancy process_registry.Process.property_unsync_input process_registry.Process.property_unsync_output process_registry.Process.port_heartbeat process_registry.Process.config_name process_registry.Process.config_type process_registry.Process.type_any process_registry.Process.type_none process_registry.Process.type_data_dependent process_registry.Process.type_flow_dependent process_registry.Process.flag_output_const process_registry.Process.flag_input_static process_registry.Process.flag_input_mutable process_registry.Process.flag_input_nodep process_registry.Process.flag_required cluster_bases = process_registry.ProcessCluster.__bases__ if not cluster_bases[0] == process_registry.Process: test_error("The cluster class does not inherit from the process class")
def test_register(): from sprokit.pipeline import config from sprokit.pipeline import process from sprokit.pipeline import process_factory proc_type = 'python_example' proc_desc = 'simple description' process_factory.add_process(proc_type, proc_desc, example_process(True)) if not proc_desc == process_factory.description(proc_type): test_error("Description was not preserved when registering") try: p = process_factory.create_process(proc_type, process.ProcessName()) if p is None: raise Exception() except: test_error("Could not create newly registered process type")
def test_api_calls(): from sprokit.pipeline import config from sprokit.pipeline import datum from sprokit.pipeline import edge from sprokit.pipeline import modules from sprokit.pipeline import process from sprokit.pipeline import process_registry from sprokit.pipeline import stamp e = edge.Edge() e.makes_dependency() e.has_data() e.full_of_data() e.datum_count() d = datum.complete() s = stamp.new_stamp(1) ed = edge.EdgeDatum(d, s) e.push_datum(ed) e.get_datum() e.push_datum(ed) e.peek_datum() e.pop_datum() modules.load_known_modules() reg = process_registry.ProcessRegistry.self() p = reg.create_process('orphan', process.ProcessName()) e.set_upstream_process(p) e.set_downstream_process(p) e.mark_downstream_as_complete() e.is_downstream_complete() e.config_dependency e.config_capacity
def test_wrapper_api(): from sprokit.pipeline import config from sprokit.pipeline import edge from sprokit.pipeline import process from sprokit.pipeline import process_factory proc_type = 'python_example' proc_desc = 'simple description' proc_base_type = 'python_base_example' proc_base_desc = 'simple base description' iport = 'no_such_iport' oport = 'no_such_oport' key = 'no_such_key' ptype = 'no_type' process_factory.add_process(proc_type, proc_desc, example_process(False)) process_factory.add_process(proc_base_type, proc_base_desc, base_example_process()) def check_process(p): if p is None: test_error("Got a 'None' process") return p.properties() p.input_ports() p.output_ports() expect_exception("asking for info on a non-existant input port", RuntimeError, p.input_port_info, iport) expect_exception("asking for info on a non-existant output port", RuntimeError, p.output_port_info, oport) e = edge.Edge() expect_exception("connecting to a non-existant input port", RuntimeError, p.connect_input_port, iport, e) expect_exception("connecting to a non-existant output port", RuntimeError, p.connect_output_port, oport, e) p.available_config() p.available_tunable_config() expect_exception("asking for info on a non-existant config key", RuntimeError, p.config_info, key) expect_exception("setting a type on a non-existent input port", RuntimeError, p.set_input_port_type, iport, ptype) expect_exception("setting a type on a non-existent output port", RuntimeError, p.set_output_port_type, oport, ptype) p.reset() p.configure() p.init() # TODO: Can't check this because the core frequency of the process # cannot be set. Needs to be stepped within a pipeline to verify this. # Enable the ran_step check in p.check when this is fixed. #p.step() # TODO: Can't check this because only the process_cluster base class # and the pipeline may reconfigure a process. Needs to be stepped # within a pipeline to verify this. Enable the ran_step check in # p.check when this is fixed. #p.reconfigure(reconf) del p p = process_factory.create_process(proc_type, process.ProcessName()) check_process(p) p = process_factory.create_process(proc_base_type, process.ProcessName()) check_process(p)
def test_api_calls(path_unused): from sprokit.pipeline import config from sprokit.pipeline import process from sprokit.pipeline import process_registry from sprokit.pipeline_util import load o = load.ConfigKeyOptions() o.flags o.provider o.flags = load.ConfigFlags() o.provider = load.ConfigProvider() o = load.ConfigKey() o.key_path o.options o.key_path = config.ConfigKeys() o.options = load.ConfigKeyOptions() o = load.ConfigValue() o.key o.value o.key = load.ConfigKey() o.value = config.ConfigValue() o = load.ConfigBlock() o.key o.values o.key = config.ConfigKeys() o.values = load.ConfigValues() o = load.ProcessBlock() o.name o.type o.config_values o.name = process.ProcessName() o.type = process.ProcessType() o.config_values = load.ConfigValues() o = load.ConnectBlock() o.from_ o.to o.from_ = process.PortAddr() o.to = process.PortAddr() o = load.PipeBlock() o.config = load.ConfigBlock() o.config o.process = load.ProcessBlock() o.process o.connect = load.ConnectBlock() o.connect o = load.ClusterConfig() o.description o.config_value o.description = config.ConfigDescription() o.config_value = load.ConfigValue() o = load.ClusterInput() o.description o.from_ o.targets o.description = process.PortDescription() o.from_ = process.Port() o.targets = process.PortAddrs() o = load.ClusterOutput() o.description o.from_ o.to o.description = process.PortDescription() o.from_ = process.PortAddr() o.to = process.Port() o = load.ClusterSubblock() o.config = load.ClusterConfig() if o.config is None: test_error("The 'config' is None when the cluster subblock is a config") if o.input is not None: test_error("The 'input' is not None when the cluster subblock is a config") if o.output is not None: test_error("The 'output' is not None when the cluster subblock is a config") o.input = load.ClusterInput() if o.config is not None: test_error("The 'config' is not None when the cluster subblock is an input") if o.input is None: test_error("The 'input' is None when the cluster subblock is an input") if o.output is not None: test_error("The 'output' is not None when the cluster subblock is an input") o.output = load.ClusterOutput() if o.config is not None: test_error("The 'config' is not None when the cluster subblock is an output") if o.input is not None: test_error("The 'input' is not None when the cluster subblock is an output") if o.output is None: test_error("The 'output' is None when the cluster subblock is an output") o = load.ClusterBlock() o.type o.description o.subblocks o.type = process.ProcessType() o.description = process_registry.ProcessDescription() o.subblocks = load.ClusterSubblocks() o = load.ClusterDefineBlock() o.config = load.ConfigBlock() if o.config is None: test_error("The 'config' is None when the pipe subblock is a config") if o.process is not None: test_error("The 'process' is not None when the pipe subblock is a config") if o.connect is not None: test_error("The 'connect' is not None when the pipe subblock is a config") if o.cluster is not None: test_error("The 'cluster' is not None when the pipe subblock is a config") o.process = load.ProcessBlock() if o.config is not None: test_error("The 'config' is not None when the pipe subblock is a process") if o.process is None: test_error("The 'process' is None when the pipe subblock is a process") if o.connect is not None: test_error("The 'connect' is not None when the pipe subblock is a process") if o.cluster is not None: test_error("The 'cluster' is not None when the pipe subblock is a process") o.connect = load.ConnectBlock() if o.config is not None: test_error("The 'config' is not None when the pipe subblock is a connection") if o.process is not None: test_error("The 'process' is not None when the pipe subblock is a connection") if o.connect is None: test_error("The 'connect' is None when the pipe subblock is a connection") if o.cluster is not None: test_error("The 'cluster' is not None when the pipe subblock is a connection") o.cluster = load.ClusterBlock() if o.config is not None: test_error("The 'config' is not None when the pipe subblock is a cluster") if o.process is not None: test_error("The 'process' is not None when the pipe subblock is a cluster") if o.connect is not None: test_error("The 'connect' is not None when the pipe subblock is a cluster") if o.cluster is None: test_error("The 'cluster' is None when the pipe subblock is a cluster")