diff --git a/MAC/Services/TBB/TBBClient/lib/__init__.py b/MAC/Services/TBB/TBBClient/lib/__init__.py index 63b263683cef5ad3645977ab0ffdda066dca6aa3..e6bad7f3f551e553a1bb5f76be1881b89f2c017e 100644 --- a/MAC/Services/TBB/TBBClient/lib/__init__.py +++ b/MAC/Services/TBB/TBBClient/lib/__init__.py @@ -5,25 +5,25 @@ from threading import Event import logging logger = logging.getLogger(__name__) -from lofar.mac.tbb.config import DEFAULT_TBB_BUSNAME, DEFAULT_TBB_SERVICENAME, DEFAULT_BROKER -from lofar.mac.tbb.config import DEFAULT_TBB_NOTIFICATION_BUSNAME -from lofar.mac.tbb.client.rpc import TBBRPC -from lofar.mac.tbb.client.tbbbuslistener import TBBBusListener +from lofar.mac.tbbservice.config import DEFAULT_TBB_BUSNAME, DEFAULT_TBB_SERVICENAME, DEFAULT_BROKER +from lofar.mac.tbbservice.config import DEFAULT_TBB_NOTIFICATION_BUSNAME +from lofar.mac.tbbservice.client.tbbservice_rpc import TBBRPC +from lofar.mac.tbbservice.client.tbbbuslistener import TBBBusListener class Waiter(TBBBusListener): '''Helper class which overrides TBBBusListener.onDataWritersFinished and waits for synchronization using threading Events''' - def __init__(self, busname=notification_busname, broker=broker, **kwargs): - self.wait_event = Event() - super(Waiter, self).__init__(busname=busname, broker=broker, **kwargs) + def __init__(self, busname=DEFAULT_TBB_NOTIFICATION_BUSNAME, broker=DEFAULT_BROKER, **kwargs): + self.wait_event = Event() + super(Waiter, self).__init__(busname=busname, broker=broker, **kwargs) - def onDataWritersFinished(self, msg_content): - # signal that we're done waiting - self.wait_event.set() + def onDataWritersFinished(self, msg_content): + # signal that we're done waiting + self.wait_event.set() - def wait(self, timeout=24*3600): - # wait until onDataWritersFinished - self.wait_event.wait(timeout) + def wait(self, timeout=24*3600): + # wait until onDataWritersFinished + self.wait_event.wait(timeout) def start_datawriters_and_wait_until_finished(service_busname=DEFAULT_TBB_BUSNAME, service_name=DEFAULT_TBB_SERVICENAME, diff --git a/MAC/Services/TBB/TBBClient/lib/tbbbuslistener.py b/MAC/Services/TBB/TBBClient/lib/tbbbuslistener.py index 9df4e82418abf05b83c6e83e1b4b940dc0b5bdff..4040b375b29c207034d1c92ee26c3dece7623f9a 100644 --- a/MAC/Services/TBB/TBBClient/lib/tbbbuslistener.py +++ b/MAC/Services/TBB/TBBClient/lib/tbbbuslistener.py @@ -21,7 +21,7 @@ from lofar.common.util import humanreadablesize from lofar.messaging.messagebus import AbstractBusListener -from lofar.mac.tbb.config import DEFAULT_TBB_NOTIFICATION_BUSNAME, DEFAULT_TBB_NOTIFICATION_SUBJECTS, DEFAULT_BROKER +from lofar.mac.tbbservice.config import DEFAULT_TBB_NOTIFICATION_BUSNAME, DEFAULT_TBB_NOTIFICATION_SUBJECTS, DEFAULT_BROKER import logging logger = logging.getLogger() diff --git a/MAC/TBB/lib/tbb_freeze.py b/MAC/TBB/lib/tbb_freeze.py index a72b2955eef4d398486b533a1843dbe34fae18d7..0a945d02c73ee1f27b91802b0d2789bbb52edf52 100755 --- a/MAC/TBB/lib/tbb_freeze.py +++ b/MAC/TBB/lib/tbb_freeze.py @@ -46,7 +46,7 @@ def freeze_tbb(stations, dm, timesec, timensec): for cmd in cmds: cmd = relay + cmd - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) @@ -68,7 +68,7 @@ def freeze_tbb(stations, dm, timesec, timensec): relay = [lcurun_command, stations] cmd = relay + [tbb_command, '--stop'] - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) diff --git a/MAC/TBB/lib/tbb_load_firmware.py b/MAC/TBB/lib/tbb_load_firmware.py index c27cab6094af534c5ed2f3c76eb477529e5c1476..260fa4e862f73e25584b8c71f92655ce7f222487 100755 --- a/MAC/TBB/lib/tbb_load_firmware.py +++ b/MAC/TBB/lib/tbb_load_firmware.py @@ -31,7 +31,7 @@ def load_tbb_firmware(stations, mode): relay = [lcurun_command, stations] cmd = [tbb_command, '--config=%s' % slot] cmd = relay + cmd - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) # Wait for 60s. The TBBs will reset when a new firmware gets loaded @@ -46,7 +46,7 @@ def load_tbb_firmware(stations, mode): for board in range(6): cmd = [tbb_command, '--imageinfo=%s' % str(board)] cmd = relay + cmd - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) logging.info(subprocess.check_output(cmd)) diff --git a/MAC/TBB/lib/tbb_release_recording.py b/MAC/TBB/lib/tbb_release_recording.py index bcac09f7baab2995e8228776b07e76c1e327f8d0..0692d58b3e79d53e23a881ffe3cf741a8ac26ee3 100755 --- a/MAC/TBB/lib/tbb_release_recording.py +++ b/MAC/TBB/lib/tbb_release_recording.py @@ -18,7 +18,7 @@ def release_tbb(stations): relay = [lcurun_command, stations] cmd = relay + [tbb_command, '--free'] - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) def main(): diff --git a/MAC/TBB/lib/tbb_set_storage.py b/MAC/TBB/lib/tbb_set_storage.py index a3367e7d6011bdbcbb24b43bec35bd843f4de5b2..3ce51a4e38d6c40f04810bf0a588e6f460d039f2 100755 --- a/MAC/TBB/lib/tbb_set_storage.py +++ b/MAC/TBB/lib/tbb_set_storage.py @@ -25,7 +25,7 @@ def set_tbb_storage(map): for cmd in cmds: cmd = relay + cmd - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) diff --git a/MAC/TBB/lib/tbb_start_recording.py b/MAC/TBB/lib/tbb_start_recording.py index 62238235f72e041fe7572a0a82de8edfa55e4b32..3c4a4ac09607991205a3fa8ee6d68f86f4fbfca2 100755 --- a/MAC/TBB/lib/tbb_start_recording.py +++ b/MAC/TBB/lib/tbb_start_recording.py @@ -33,7 +33,7 @@ def start_tbb(stations, mode, subbands): for cmd in cmds: cmd = relay + cmd - logging.info('Executing %s' % cmd) + logging.info('Executing %s', ' '.join(cmd)) subprocess.check_call(cmd) time.sleep(2) diff --git a/MAC/TBB/lib/tbb_upload_to_cep.py b/MAC/TBB/lib/tbb_upload_to_cep.py index a4ea171611f4cfdfbca32a6073da3b8f5b80d5e0..0ea62469772dabe203c76df50df4dcb66e49ff7d 100755 --- a/MAC/TBB/lib/tbb_upload_to_cep.py +++ b/MAC/TBB/lib/tbb_upload_to_cep.py @@ -64,7 +64,7 @@ def upload_tbb_data(stations, dm, start_time, duration, sub_bands, wait_time, bo cmd += str(wait_time) cmd += "; done" command = relay + [cmd] - logging.info("Executing %s" % (command)) + logging.info('Executing %s', ' '.join(command)) subprocess.check_call(command) time.sleep(wait_time) logging.info("Uploading TBB data done.")