Skip to content
Snippets Groups Projects
Commit bdaed64c authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #8887: added default busnames and subjects in config.py

parent 645891eb
No related branches found
No related tags found
No related merge requests found
......@@ -5153,6 +5153,7 @@ SAS/ResourceAssignment/ResourceAssignmentService/test/CMakeLists.txt -text
SAS/ResourceAssignment/ResourceAssignmentService/test/test_ra_service_and_rpc.py -text
SAS/ResourceAssignment/ResourceAssignmentService/test/test_ra_service_and_rpc.run -text
SAS/ResourceAssignment/ResourceAssignmentService/test/test_ra_service_and_rpc.sh -text
SAS/ResourceAssignment/Services/src/config.py -text
SAS/ResourceAssignment/Services/src/rataskspecifiedservice -text
SAS/ResourceAssignment/Services/src/rataskspecifiedservice.ini -text
SAS/ResourceAssignment/Services/test/tRATaskSpecified.in_correlator -text
......
......@@ -7,7 +7,8 @@ lofar_add_bin_scripts(
python_install(
RATaskSpecified.py
RABusListener.py
DESTINATION lofar/sas/resourceassignment
config.py
DESTINATION lofar/sas/resourceassignment/rataskspecified
)
# supervisord config files
......
......@@ -28,6 +28,7 @@ Typical usage is to derive your own subclass from RABusListener and implement th
"""
from lofar.messaging.messagebus import AbstractBusListener
from .config import DEFAULT_NOTIFICATION_BUSNAME, RATASKSPECIFIED_NOTIFICATIONNAME
import qpid.messaging
import logging
......@@ -37,7 +38,7 @@ logger = logging.getLogger(__name__)
class RATaskSpecifiedBusListener(AbstractBusListener):
def __init__(self, busname='lofar.ra.notification', subject='OTDB.TaskSpecified', broker=None, **kwargs):
def __init__(self, busname=DEFAULT_NOTIFICATION_BUSNAME, subject=RATASKSPECIFIED_NOTIFICATIONNAME, broker=None, **kwargs):
"""
RATaskSpecifiedBusListener listens on the lofar ra message bus and calls (empty) on<SomeMessage> methods when such a message is received.
Typical usage is to derive your own subclass from RATaskSpecifiedBusListener and implement the specific on<SomeMessage> methods that you are interested in.
......
#!/usr/bin/python
# $Id$
DEFAULT_NOTIFICATION_BUSNAME = 'lofar.ra.notification'
RATASKSPECIFIED_NOTIFICATIONNAME = 'OTDB.TaskSpecified'
......@@ -19,30 +19,36 @@
# You should have received a copy of the GNU General Public License along
# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
#
# $Id: JobsToSchedule.py 33364 2016-01-21 21:21:12Z mol $
# $Id: rataskspecifiedservice.py 33364 2016-01-21 21:21:12Z mol $
"""
Daemon that listens to OTDB status changes to PRESCHEDULED, requests
the parset of such jobs (+ their predecessors), and posts them on the bus.
"""
from lofar.sas.resourceassignment.RATaskSpecified import RATaskSpecified
from lofar.sas.resourceassignment.rataskspecified.RATaskSpecified import RATaskSpecified
from lofar.sas.resourceassignment.rataskspecified.config import DEFAULT_NOTIFICATION_BUSNAME, RATASKSPECIFIED_NOTIFICATIONNAME
DEFAULT_OTDB_BUSNAME = 'lofar.otdb.status'
if __name__ == "__main__":
import sys
import logging
from optparse import OptionParser
from lofar.common.util import waitForInterrupt
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)
# Check the invocation arguments
parser = OptionParser("%prog -O otdb_bus -B my_bus [options]")
parser.add_option("-O", "--otdb_bus", dest="otdb_busname", type="string", default="",
parser = OptionParser("%prog [options]",
description="run the rataskspecified service")
parser.add_option("-o", "--otdb_bus", dest="otdb_busname", type="string", default=DEFAULT_OTDB_BUSNAME,
help="Bus or queue OTDB operates on")
parser.add_option("-B", "--my_bus", dest="my_busname", type="string", default="",
parser.add_option("-b", "--notification_bus", dest="notification_bus", type="string", default=DEFAULT_NOTIFICATION_BUSNAME,
help="Bus or queue we publish resource requests on")
parser.add_option("-s", "--notification_subject", dest="notification_subject", type="string", default=RATASKSPECIFIED_NOTIFICATIONNAME,
help="The subject of the event messages which this service publishes")
(options, args) = parser.parse_args()
if not options.statusbus or not options.parsetbus or not options.busname:
parser.print_help()
sys.exit(1)
with RATaskSpecified("OTDB.TaskSpecified", otdb_busname=options.otdb_busname, my_busname=options.my_busname) as jts:
with RATaskSpecified(RATASKSPECIFIED_NOTIFICATIONNAME, otdb_busname=options.otdb_busname, my_busname=options.notification_bus) as jts:
waitForInterrupt()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment