Skip to content
Snippets Groups Projects
Commit 945f0ba9 authored by Jörn Künsemöller's avatar Jörn Künsemöller
Browse files

Task SW-560: A bunch of bugfixes, so let the tbbservice commands actually go through

parent bb0e7579
No related branches found
No related tags found
No related merge requests found
......@@ -14,9 +14,9 @@ class TBBRPC(RPCWrapper):
servicename=servicename,
broker=broker)
def start_datawriters(self):
def start_datawriters(self, voevent_xml):
logger.info("Requesting start of tbb data writers...")
result = self.rpc('start_datawriters')
result = self.rpc('start_datawriters', voevent_xml)
logger.info("Received start datawriter request result %s" % result)
return result
......
......@@ -361,7 +361,7 @@ class TBBControlService:
log_message = "Freezing the TBB data on stations %s. DM = %s, time = %f" % (stations, dm, (float(timesec) + (1e-9 * int(timensec))))
logger.info(log_message + "...")
freeze_tbb(stations, dm, timesec, timensec)
logger.info(log_message + "done.")
logger.info(log_message + " done.")
# todo: treat start_time as sec, nsec tuple instead of float for higher precision
def upload_data(self, stations, dm, start_time, duration, sub_bands, wait_time, boards):
......
......@@ -46,7 +46,7 @@ def freeze_tbb(stations, dm, timesec, timensec):
for cmd in cmds:
cmd = relay + cmd
logging.info('Executing %s', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
subprocess.check_call(cmd)
......@@ -66,9 +66,9 @@ def freeze_tbb(stations, dm, timesec, timensec):
logging.info('Waiting %s seconds before stopping TBB boards' % sleeptime)
time.sleep(sleeptime)
relay = [lcurun_command, stations]
relay = lcurun_command + [stations]
cmd = relay + [tbb_command, '--stop']
logging.info('Executing %s', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
subprocess.check_call(cmd)
......
......@@ -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', ' '.join(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', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
logging.info(subprocess.check_output(cmd))
......
......@@ -18,7 +18,7 @@ def release_tbb(stations):
relay = lcurun_command + [stations]
cmd = relay + [tbb_command, '--free']
logging.info('Executing %s', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
subprocess.check_call(cmd)
......
......@@ -19,7 +19,7 @@ def restart_tbb_recording(stations):
relay = lcurun_command + [stations]
cmd = relay + [tbb_command, "--record"]
logging.info("Executing %s", " ".join(cmd))
logging.info("Executing %s" % " ".join(cmd))
subprocess.check_call(cmd)
time.sleep(2)
......
......@@ -25,7 +25,7 @@ def set_tbb_storage(map):
for cmd in cmds:
cmd = relay + cmd
logging.info('Executing %s', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
subprocess.check_call(cmd)
......
......@@ -35,7 +35,7 @@ def start_tbb(stations, mode, subbands):
for cmd in cmds:
cmd = relay + cmd
logging.info('Executing %s', ' '.join(cmd))
logging.info('Executing %s' % ' '.join(cmd))
subprocess.check_call(cmd)
time.sleep(2)
......
......@@ -36,11 +36,12 @@ ALERT_BROKER_PORT = 8099
ALERT_PACKET_TYPE_FILTER = None # list of int or None for all
DEFAULT_TBB_CEP_NODES = None # list of nodes to dump to, e.g. ["cpu%s" % str(num).zfill(2) for num in expand_list("01-50")], or None for all available
DEFAULT_TBB_SUBBANDS = "10-496" # The subbands to dump. Note: When starting the recording (tbbservice_start_recording), the subband range HAS to cover 487 subbands (typically 10-496)
DEFAULT_TBB_STATIONS = ['rs409'] # ['cs001','cs002','cs003','cs004','cs005','cs006','cs007','cs011','cs013','cs017','cs021','cs024','cs026','cs028','cs030','cs031','cs032','cs101','cs103','cs201','cs301','cs302','cs401','cs501','rs106','rs205','rs208','rs210','rs305','rs306','rs307','rs310','rs406','rs407','rs409','rs503','rs508','rs509'] # List of stations to include in tbb dump (filtered for those who are actually observing at event ToA), or None for all observing.
DEFAULT_TBB_SUBBANDS = expand_list("10-496") # The subbands to dump. Note: When starting the recording (tbbservice_start_recording), the subband range HAS to cover 487 subbands (typically 10-496)
DEFAULT_TBB_STATIONS = ['rs409'] # ['cs001','cs002','cs003','cs004','cs005','cs006','cs007','cs011','cs013','cs017','cs021','cs024','cs026','cs028','cs030','cs031','cs032','cs101','cs103','cs201','cs301','cs302','cs401','cs501','rs106','rs205','rs208','rs210','rs305','rs306','rs307','rs310','rs406','rs407','rs409','rs503','rs508','rs509'] # List of stations to include in tbb dump (filtered for those who are actually observing at event ToA)
DEFAULT_TBB_PROJECT = "COM_ALERT"
DEFAULT_TBB_ALERT_MODE = "subband"
DEFAULT_TBB_BOARDS = expand_list("0-5")
DEFAULT_CONSTANT_TIME_BETWEEN_SUBBAND_DUMPS = 0 # constant time in seconds to wait between subband dumps
DEFAULT_DURATION_FACTOR_BETWEEN_SUBBAND_DUMPS = 0.00012 # linear scaling factor to increase time between dumps with duration
\ No newline at end of file
......@@ -215,7 +215,7 @@ def translate_arrival_time_to_frequency(reference_time, reference_frequency, dm,
# todo: If the Qpid communication does not hurt, maybe it makes more sense to move this to the TBB Service?
def do_tbb_subband_dump(starttime, duration, dm, project, triggerid,
stoptime=None, stations=DEFAULT_TBB_STATIONS, subbands=DEFAULT_TBB_SUBBANDS, rcus=None,
boards=None, nodes=DEFAULT_TBB_CEP_NODES, voevent_xml=None):
boards=DEFAULT_TBB_BOARDS, nodes=DEFAULT_TBB_CEP_NODES, voevent_xml=None):
"""
This 'recipe' calls the tbb service to freeze data on the bords and perform the tbbdump.
The first data of the dump is recorded at starttime in the subband of highest frequency. Subbands of lower frequency
......@@ -292,7 +292,7 @@ def do_tbb_subband_dump(starttime, duration, dm, project, triggerid,
# restart recording
logger.info("Restarting recording")
rpc.restart_recording()
rpc.restart_recording(lcus_str)
class ALERTHandler(VOEventListenerInterface):
......@@ -343,7 +343,8 @@ class ALERTHandler(VOEventListenerInterface):
logger.info('ALERT event %s passed science pre-flight checks' % triggerid)
# _send_notification('ALERT Broker', ALERT_BROKER_HOST, self.project, triggerid, voevent_xml) # todo: do we want that? do we want it on same bus?
logger.info('ALERT event %s is accepted. Initiating TBB dump: starttime %s, duration %ssec, dm %s' % (triggerid, starttime, duration, dm))
do_tbb_subband_dump(starttime, duration, dm, DEFAULT_TBB_PROJECT, triggerid, stoptime=stoptime, stations=self._cache.get_stations())
available_stations = self._determine_station_sets()['available']
do_tbb_subband_dump(starttime, duration, dm, DEFAULT_TBB_PROJECT, triggerid, stoptime=stoptime, stations=available_stations)
else:
raise Exception('ALERT event %s rejected by science pre-flight checks!' % triggerid)
else:
......@@ -402,18 +403,23 @@ class ALERTHandler(VOEventListenerInterface):
logger.warning('No observations running at %s, so TBB\'s are not recording', stoptime)
return False
active_stations = set(hostname2stationname(x) for x in self._cache.get_stations())
active_tbb_stations = set(hostname2stationname(x) for x in DEFAULT_TBB_STATIONS).intersection(active_stations)
station_sets = self._determine_station_sets()
if len(active_tbb_stations) > 0:
logger.info('Enough TBB stations available: %s', active_tbb_stations)
if len(station_sets['available']) > 0:
logger.info('Enough TBB stations available: %s', station_sets['available'])
else:
logger.warning('No TBB stations available. requested=%s available=%s', DEFAULT_TBB_STATIONS, active_stations)
logger.warning('No TBB stations available. requested=%s active=%s', station_sets['requested'], station_sets['active'])
return False
# all prerequisites are met.
return True
def _determine_station_sets(self):
active_stations = set(hostname2stationname(x) for x in ['cs101', 'RS409']) # self._cache.get_stations())
active_tbb_stations = set(hostname2stationname(x) for x in DEFAULT_TBB_STATIONS).intersection(active_stations)
return {'active': active_stations, 'available': active_tbb_stations, 'requested': DEFAULT_TBB_STATIONS}
def create_service(servicename=TRIGGER_SERVICENAME, busname=TRIGGER_BUSNAME):
return Service(servicename,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment