[server.py] rename initialisation steps for better clarity
initialisation occurs in this order: - object creeation (via __init__ which should consume the cfg values it knows about) - registering each object with the dispatcher - calling init_module() on each module (for connecting to other modules, checking hw, creating threads....) - calling start_module(cb) on each module. after the module finished startup it should call cb(self) once. This is the right place to do initialisation of hw which is not needed to read from the hw. (uploading curves, polling/re-setting all parameters, etc.) Change-Id: Ieaf9df5876e764634836861241f58ab986027f44 Reviewed-on: https://forge.frm2.tum.de/review/18566 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
@ -28,6 +28,10 @@ sys.path.insert(0, sys.path[0] + '/..')
|
||||
# no fixtures needed
|
||||
import pytest
|
||||
|
||||
try:
|
||||
import Queue as queue
|
||||
except ImportError:
|
||||
import queue as queue
|
||||
|
||||
from secop.datatypes import BoolType, EnumType
|
||||
|
||||
@ -47,7 +51,11 @@ def test_Communicator():
|
||||
))()
|
||||
|
||||
o = Communicator(logger, {}, 'o1', dispatcher)
|
||||
o.init()
|
||||
o.early_init()
|
||||
o.init_module()
|
||||
q = queue.Queue()
|
||||
o.start_module(q.put)
|
||||
q.get()
|
||||
|
||||
def test_ModuleMeta():
|
||||
newclass = ModuleMeta.__new__(ModuleMeta, 'TestReadable', (Drivable, Writable, Readable, Module), {
|
||||
@ -100,5 +108,10 @@ def test_ModuleMeta():
|
||||
params_found.add(o)
|
||||
assert o.ctr not in ctr_found
|
||||
ctr_found.add(o.ctr)
|
||||
o1.init()
|
||||
o2.init()
|
||||
o1.early_init()
|
||||
o2.early_init()
|
||||
o1.init_module()
|
||||
o2.init_module()
|
||||
q = queue.Queue()
|
||||
o1.start_module(q.put)
|
||||
o2.start_module(q.put)
|
||||
|
Reference in New Issue
Block a user