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

Task #9931: added config, and made skeleton for qpid service

parent 49e29c75
No related branches found
No related tags found
No related merge requests found
......@@ -2946,6 +2946,7 @@ LTA/LTAIngest/bin/CMakeLists.txt -text
LTA/LTAIngest/bin/ingestservice -text
LTA/LTAIngest/bin/ingestservice.ini -text
LTA/LTAIngest/lib/CMakeLists.txt -text
LTA/LTAIngest/lib/config.py -text
LTA/LTAIngest/lib/ingestservice.py -text
LTA/LTAIngest/old/ClientForm-0.1.17/ClientForm-0.1.17/PKG-INFO -text
LTA/LTAIngest/old/ClientForm-0.1.17/PKG-INFO -text
......
......@@ -5,5 +5,5 @@ runs the ingest service
'''
if __name__ == '__main__':
from lofar.lta.ltaingest.ingestservice import main
from lofar.lta.ingest.ingestservice import main
main()
python_install(ingestservice.py
DESTINATION lofar/lta/ltaingest)
config.py
DESTINATION lofar/lta/ingest)
from lofar.messaging import adaptNameToEnvironment
DEFAULT_INGEST_BUSNAME = adaptNameToEnvironment('lofar.lta.ingest.command')
DEFAULT_INGEST_SERVICENAME = 'IngestService'
......@@ -26,10 +26,27 @@ import qpid.messaging
import logging
from datetime import datetime
import time
from lofar.messaging import Service
from lofar.messaging.Service import MessageHandlerInterface
from lofar.lta.ingest.config import DEFAULT_INGEST_BUSNAME, DEFAULT_INGEST_SERVICENAME
logger = logging.getLogger(__name__)
__all__ = []
class IngestServiceMessageHandler(MessageHandlerInterface):
def __init__(self, **kwargs):
super(IngestServiceMessageHandler, self).__init__(**kwargs)
self.service2MethodMap = {}
def createService(busname=DEFAULT_INGEST_BUSNAME, servicename=DEFAULT_INGEST_SERVICENAME, broker=None, verbose=False):
return Service(servicename,
IngestServiceMessageHandler,
busname=busname,
broker=broker,
use_service_methods=True,
numthreads=1,
handler_args={},
verbose=verbose)
def main():
# make sure we run in UTC timezone
......@@ -42,10 +59,16 @@ def main():
# Check the invocation arguments
parser = OptionParser("%prog [options]",
description='runs the resourceassigner service')
description='runs the ingest service')
parser.add_option('-q', '--broker', dest='broker', type='string',
default=None,
help='Address of the qpid broker, default: localhost')
parser.add_option("--ingest_busname", dest="ingest_busname", type="string",
default=DEFAULT_INGEST_BUSNAME,
help="Name of the bus on which the ingest service listens. [default: %default]")
parser.add_option("--ingest_servicename", dest="ingest_servicename", type="string",
default=DEFAULT_INGEST_SERVICENAME,
help="Name of the ingest service. [default: %default]")
parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
(options, args) = parser.parse_args()
......@@ -53,7 +76,10 @@ def main():
logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
level=logging.DEBUG if options.verbose else logging.INFO)
with createService(servicename=options.ingest_servicename, busname=options.ingest_busname, broker=options.broker, verbose=options.verbose) as ingest_service:
waitForInterrupt()
if __name__ == '__main__':
main()
__all__ = ['main']
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment