Skip to content
Snippets Groups Projects
Commit 204baa25 authored by Jan David Mol's avatar Jan David Mol
Browse files

Make sure attributes are polled when subscribing to them

parent 9606e7ea
Branches
No related tags found
No related merge requests found
...@@ -8,6 +8,7 @@ from prometheus_client import Counter ...@@ -8,6 +8,7 @@ from prometheus_client import Counter
from tango import DeviceProxy, EventType from tango import DeviceProxy, EventType
from tangostationcontrol.common.lofar_logging import log_exceptions from tangostationcontrol.common.lofar_logging import log_exceptions
from tangostationcontrol.common.constants import DEFAULT_POLLING_PERIOD_MS
from tangostationcontrol.metrics import AttributeMetric from tangostationcontrol.metrics import AttributeMetric
logger = logging.getLogger() logger = logging.getLogger()
...@@ -87,11 +88,8 @@ class EventSubscriptions: ...@@ -87,11 +88,8 @@ class EventSubscriptions:
# make sure the attribute is polled, otherwise we wont receive event # make sure the attribute is polled, otherwise we wont receive event
if not proxy.is_attribute_polled(attr_name): if not proxy.is_attribute_polled(attr_name):
logger.error( logger.info(f"Enabling polling for {proxy.name()}/{attr_name}.")
f"Error, no polling_period set for attribute \ proxy.poll_attribute(attr_name, DEFAULT_POLLING_PERIOD_MS)
{proxy.name()}/{attr_name}. \
We will not get any events without a polling_period"
)
# subscribe # subscribe
event_id = proxy.subscribe_event( event_id = proxy.subscribe_event(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment