make secop.poller.Poller default

modules using the old poller (now called secop.poller.BasicPoller)
need to explcitly declare it (pollerClass = BasicPoller)

BasicPoller is still used in:

secop_mlz/amagnet.py
secop_mlz/entangle.py
secop/simulation.py

Remark: before removing BasicPoller we may need a replacement for
Readable.pollParams

Change-Id: If1ae8b68e02f13e601334656b818337c882e06cc
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21910
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
2019-11-27 09:51:59 +01:00
parent ca8b07496f
commit 59fbd5cac0
7 changed files with 47 additions and 34 deletions

View File

@ -58,17 +58,13 @@ class PollerBase:
poller as value.
<name> is module.iodev or module.name, if iodev is not present
'''
try:
pollerClass = module.pollerClass
except AttributeError:
return # no pollerClass -> fall back to simple poller
# for modules with the same iodev, a common poller is used,
# modules without iodev all get their own poller
name = getattr(module, 'iodev', module.name)
poller = table.get((pollerClass, name), None)
poller = table.get((cls, name), None)
if poller is None:
poller = pollerClass(name)
table[(pollerClass, name)] = poller
poller = cls(name)
table[(cls, name)] = poller
poller.add_to_poller(module)
def start(self, started_callback):
@ -97,8 +93,6 @@ class PollerBase:
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self.name)
__nonzero__ = __bool__ # Py2/3 compat
class Poller(PollerBase):
'''a standard poller
@ -246,4 +240,14 @@ class Poller(PollerBase):
'''is there any poll item?'''
return any(self.queues.values())
__nonzero__ = __bool__ # Py2/3 compat
class BasicPoller(PollerBase):
"""basic poller
this is just a dummy, the poller thread is started in Readable.startModule
"""
# pylint: disable=abstract-method
@classmethod
def add_to_table(cls, table, module):
pass