From 63e0df2d5b49312c60824b20056d25f19b7546a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20J=C3=BCrges?= <jurges@astron.nl> Date: Fri, 7 Dec 2018 13:46:06 +0000 Subject: [PATCH] Task SW-549: Add script for TBB restart recording --- .gitattributes | 2 ++ MAC/TBB/bin/CMakeLists.txt | 1 + MAC/TBB/bin/tbb_restart_recording | 16 ++++++++++++++++ MAC/TBB/lib/CMakeLists.txt | 1 + MAC/TBB/lib/tbb_restart_recording.py | 27 +++++++++++++++++++++++++++ 5 files changed, 47 insertions(+) create mode 100755 MAC/TBB/bin/tbb_restart_recording create mode 100755 MAC/TBB/lib/tbb_restart_recording.py diff --git a/.gitattributes b/.gitattributes index d3fd8652db8..dd093894668 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3727,6 +3727,7 @@ MAC/Services/test/tPipelineControl.sh eol=lf MAC/TBB/bin/tbb_freeze -text MAC/TBB/bin/tbb_load_firmware -text MAC/TBB/bin/tbb_release_recording -text +MAC/TBB/bin/tbb_restart_recording -text MAC/TBB/bin/tbb_set_storage -text MAC/TBB/bin/tbb_start_recording -text MAC/TBB/bin/tbb_upload_to_cep -text @@ -3735,6 +3736,7 @@ MAC/TBB/lib/tbb_config.py -text MAC/TBB/lib/tbb_freeze.py -text MAC/TBB/lib/tbb_load_firmware.py -text MAC/TBB/lib/tbb_release_recording.py -text +MAC/TBB/lib/tbb_restart_recording.py -text MAC/TBB/lib/tbb_set_storage.py -text MAC/TBB/lib/tbb_start_recording.py -text MAC/TBB/lib/tbb_upload_to_cep.py -text diff --git a/MAC/TBB/bin/CMakeLists.txt b/MAC/TBB/bin/CMakeLists.txt index a62388e6afa..d85e9d07055 100644 --- a/MAC/TBB/bin/CMakeLists.txt +++ b/MAC/TBB/bin/CMakeLists.txt @@ -4,6 +4,7 @@ lofar_add_bin_scripts( tbb_freeze tbb_load_firmware tbb_release_recording + tbb_restart_recording tbb_set_storage tbb_start_recording tbb_upload_to_cep diff --git a/MAC/TBB/bin/tbb_restart_recording b/MAC/TBB/bin/tbb_restart_recording new file mode 100755 index 00000000000..05523f3d11e --- /dev/null +++ b/MAC/TBB/bin/tbb_restart_recording @@ -0,0 +1,16 @@ +#!/usr/bin/env python + +######################################################################## +# +# Restart TBB recording on a bunch of stations +# +######################################################################## + +import logging +from lofar.mac.tbb.tbb_restart_recording import main + + +if __name__ == '__main__': + format = '%(asctime)-15s | %(message)s' + logging.basicConfig(format=format, level=logging.INFO) + main() diff --git a/MAC/TBB/lib/CMakeLists.txt b/MAC/TBB/lib/CMakeLists.txt index 03e7806f788..58308c268fa 100644 --- a/MAC/TBB/lib/CMakeLists.txt +++ b/MAC/TBB/lib/CMakeLists.txt @@ -8,6 +8,7 @@ python_install( tbb_freeze.py tbb_load_firmware.py tbb_release_recording.py + tbb_restart_recording.py tbb_set_storage.py tbb_start_recording.py tbb_upload_to_cep.py diff --git a/MAC/TBB/lib/tbb_restart_recording.py b/MAC/TBB/lib/tbb_restart_recording.py new file mode 100755 index 00000000000..47952eb1a80 --- /dev/null +++ b/MAC/TBB/lib/tbb_restart_recording.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +######################################################################## +# +# Restart TBB recording on a bunch of stations +# +######################################################################## + +import argparse +import logging +from lofar.mac.tbb.tbb_config import supported_modes +from lofar.mac.tbb.tbb_release_recording import release_tbb +from lofar.mac.tbb.tbb_start_recording import start_tbb + + +def main(): + parser = argparse.ArgumentParser("This script will restart TBB recording on a bunch of stations.") + parser.add_argument('-s', '--stations', dest='stations', help="comma-separated list of station LCUs (e.g. cs030c,cs031c; also accepts lcurun aliases like 'today', 'nl', ...)", default='today') + parser.add_argument('-m', '--mode', dest='mode', help="supported tbb modes: %s" % supported_modes, default='subband') + parser.add_argument('-b', '--subbands', dest='subbands', help='Subband range, e.g. 10:496', default='10:496') + args = parser.parse_args() + + if args.mode not in supported_modes: + raise ValueError('Mode must be one of %s' % supported_modes) + + release_tbb(args.stations) + start_tbb(args.stations, args.mode, args.subbands) -- GitLab