コード例 #1
0
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    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 [options]",
                          description="run the rataskspecified service")
    parser.add_option("-e", "--exchange", dest="exchange", type="string",
                      default=DEFAULT_BUSNAME,
                      help="Bus or queue to communicate on. [default: %default]")
    parser.add_option('-b', '--broker', dest='broker', type='string', default=DEFAULT_BROKER,
                      help='Address of the broker, default: localhost')
    (options, args) = parser.parse_args()

    with OTDBBusListener(handler_type=RATaskSpecifiedOTDBEventMessageHandler,
                         exchange=options.exchange,
                         broker=options.broker):
        waitForInterrupt()
コード例 #2
0
ファイル: propagator.py プロジェクト: jjdmol/LOFAR
def main():
    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                                                description='runs the resourceassignment database service')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    parser.add_option("--otdb_notification_busname", dest="otdb_notification_busname", type="string",
                      default=DEFAULT_OTDB_NOTIFICATION_BUSNAME,
                      help="Bus or queue where the OTDB notifications are published. [default: %default]")
    parser.add_option("--otdb_notification_subject", dest="otdb_notification_subject", type="string",
                      default=DEFAULT_OTDB_NOTIFICATION_SUBJECT,
                      help="Subject of OTDB notifications on otdb_notification_busname. [default: %default]")
    parser.add_option("--radb_busname", dest="radb_busname", type="string",
                      default=DEFAULT_RADB_BUSNAME,
                      help="Name of the radb bus exchange on the qpid broker. [default: %default]")
    parser.add_option("--radb_servicename", dest="radb_servicename", type="string",
                      default=DEFAULT_RADB_SERVICENAME,
                      help="Name of the radb service. [default: %default]")
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)

    with OTDBtoRATaskStatusPropagator(otdb_notification_busname=options.otdb_notification_busname,
                                      otdb_notification_subject=options.otdb_notification_subject,
                                      radb_busname=options.radb_busname,
                                      radb_servicename=options.radb_servicename,
                                      broker=options.broker):
        waitForInterrupt()
コード例 #3
0
def main():
    """
    Starts the momqueryservice.GetObjectDetails service
    """
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the momqueryservice')
    parser.add_option('-b', '--broker', dest='broker', type='string', default=DEFAULT_BROKER,
                      help='Address of the messaging broker, default: %default')
    parser.add_option("-e", "--exchange", dest="exchange", type="string", default=DEFAULT_BUSNAME,
                      help="Name of the bus exchange on the broker, [default: %default]")
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="MoM")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    logger.info("Using dbcreds: %s", dbcreds.stringWithHiddenPassword())

    with RPCService(service_name=DEFAULT_MOMQUERY_SERVICENAME,
                    handler_type=MoMQueryServiceMessageHandler, handler_kwargs={'dbcreds': dbcreds},
                    broker=options.broker, exchange=options.exchange,
                    num_threads=6):
        waitForInterrupt()
コード例 #4
0
ファイル: SSDBQueryService.py プロジェクト: mfkiwl/LOFAR
def main():
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the systemstatus database service')
    parser.add_option('-q', '--broker', dest='broker', type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option("-b", "--busname", dest="busname", type="string",
                      default=DEFAULT_SSDB_BUSNAME,
                      help="Name of the bus exchange on the qpid broker. [default: %default]")
    parser.add_option("-s", "--servicename", dest="servicename", type="string",
                      default=DEFAULT_SSDB_SERVICENAME,
                      help="Name for this service. [default: %default]")
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="SSDB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    logger.info("Using dbcreds: %s" % dbcreds.stringWithHiddenPassword())

    with createService(busname=options.busname, servicename=options.servicename, dbcreds=dbcreds, broker=options.broker):
        waitForInterrupt()
コード例 #5
0
def main():
    from optparse import OptionParser

    # Check the invocation arguments
    parser = OptionParser('%prog [options]',
                          description='run the ingest job monitor')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the message broker, default: %default')
    parser.add_option(
        '-e',
        '--exchange',
        dest='exchange',
        type='string',
        default=DEFAULT_BUSNAME,
        help=
        'Name of the exchange on which the ingest notifications are published, default: %default'
    )
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO,
                        stream=sys.stdout)

    event_listener = IngestEventMesssageBusListener(exchange=options.exchange,
                                                    broker=options.broker)

    # wrap event_listener in a janitor to auto cleanup the designed listening queue upon exit.
    # this tool is only meant for live listening, not for historic logs.
    with BusListenerJanitor(event_listener):
        waitForInterrupt()
コード例 #6
0
ファイル: messagelogger.py プロジェクト: mfkiwl/lofar-1
def main():
    from optparse import OptionParser

    # Check the invocation arguments
    parser = OptionParser('%prog [options]', description='run the messegelogger, which logs each received message')
    parser.add_option('-b', '--broker', dest='broker', type='string', default=DEFAULT_BROKER,
                      help='Address of the messaging broker, default: %default')
    parser.add_option("-e", "--exchange", dest="exchange", type="string", default=DEFAULT_BUSNAME,
                      help="Name of the bus (exchange) to receive messages from. [default: %default]")
    parser.add_option("-r", "--routing_key", dest="routing_key", type="string", default="#",
                      help="filter messages on by subject using this routing_key. #=all. [default: %default]")
    parser.add_option("-n", "--no_newlines", dest="no_newlines", action='store_true',
                      help="remove newlines in message content, so we have single line log messages")
    parser.add_option("-m", "--max_content_size", dest="max_content_size", type="int", default=-1,
                      help="delimit the logged content to at most <max_content_size> characters (or all if -1). [default: %default]")
    options, args = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)

    logger.info("**************************")
    logger.info("* starting messagelogger *")
    logger.info("**************************")

    with MessageLogger(exchange=options.exchange, routing_key=options.routing_key, broker=options.broker,
                       remove_content_newlines=bool(options.no_newlines), max_content_size=options.max_content_size):
        waitForInterrupt()
コード例 #7
0
ファイル: service.py プロジェクト: jjdmol/LOFAR
def main():
    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassignment database service')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    parser.add_option("-b", "--busname", dest="busname", type="string", default=DEFAULT_BUSNAME, help="Name of the bus exchange on the qpid broker, default: %s" % DEFAULT_BUSNAME)
    parser.add_option("-s", "--servicename", dest="servicename", type="string", default=DEFAULT_SERVICENAME, help="Name for this service, default: %s" % DEFAULT_SERVICENAME)
    parser.add_option('-Q', '--log-queries', dest='log_queries', action='store_true', help='log all pqsl queries')
    parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="RADB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    setQpidLogLevel(logging.INFO)
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.DEBUG if options.verbose else logging.INFO)

    logger.info("Using dbcreds: %s" % dbcreds.stringWithHiddenPassword())

    with createService(busname=options.busname,
                       servicename=options.servicename,
                       broker=options.broker,
                       verbose=options.verbose,
                       log_queries=options.log_queries,
                       dbcreds=dbcreds):
        waitForInterrupt()
コード例 #8
0
ファイル: propagator.py プロジェクト: mfkiwl/lofar-1
def main():
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO)

    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the resourceassignment database service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        '-e',
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help=
        "Bus or queue where the OTDB notifications are published. [default: %default]"
    )
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="RADB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)
    logger.info("Using dbcreds: %s" % dbcreds.stringWithHiddenPassword())

    with OTDBBusListener(handler_type=OTDBtoRATaskStatusPropagator,
                         exchange=options.exchange,
                         broker=options.broker,
                         num_threads=1):
        waitForInterrupt()
コード例 #9
0
ファイル: service.py プロジェクト: mfkiwl/LOFAR
def main():
    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the resourceassignment database service')
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option(
        "-b",
        "--busname",
        dest="busname",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the qpid broker, default: %s" %
        DEFAULT_BUSNAME)
    parser.add_option("-s",
                      "--servicename",
                      dest="servicename",
                      type="string",
                      default=DEFAULT_SERVICENAME,
                      help="Name for this service, default: %s" %
                      DEFAULT_SERVICENAME)
    parser.add_option('-Q',
                      '--log-queries',
                      dest='log_queries',
                      action='store_true',
                      help='log all pqsl queries')
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="RADB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    setQpidLogLevel(logging.INFO)
    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    logger.info("Using dbcreds: %s" % dbcreds.stringWithHiddenPassword())

    with createService(busname=options.busname,
                       servicename=options.servicename,
                       broker=options.broker,
                       verbose=options.verbose,
                       log_queries=options.log_queries,
                       dbcreds=dbcreds):
        waitForInterrupt()
コード例 #10
0
ファイル: trigger_service.py プロジェクト: mfkiwl/lofar-1
def main():

    with RPCService(service_name=TRIGGER_SERVICENAME,
                    handler_type=TriggerServiceMessageHandler,
                    exchange=DEFAULT_BUSNAME,
                    num_threads=4):
        # next to RT events, also (independently) handle vo events
        with ALERTHandler(
                broker_host=ALERT_BROKER_HOST,
                broker_port=ALERT_BROKER_PORT,
                filter_for=ALERT_PACKET_TYPE_FILTER) as alert_handler:
            waitForInterrupt()
コード例 #11
0
ファイル: propagator.py プロジェクト: mfkiwl/LOFAR
def main():
    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the resourceassignment database service')
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option(
        "--otdb_notification_busname",
        dest="otdb_notification_busname",
        type="string",
        default=DEFAULT_OTDB_NOTIFICATION_BUSNAME,
        help=
        "Bus or queue where the OTDB notifications are published. [default: %default]"
    )
    parser.add_option(
        "--otdb_notification_subject",
        dest="otdb_notification_subject",
        type="string",
        default=DEFAULT_OTDB_NOTIFICATION_SUBJECT,
        help=
        "Subject of OTDB notifications on otdb_notification_busname. [default: %default]"
    )
    parser.add_option(
        "--radb_busname",
        dest="radb_busname",
        type="string",
        default=DEFAULT_RADB_BUSNAME,
        help=
        "Name of the radb bus exchange on the qpid broker. [default: %default]"
    )
    parser.add_option("--radb_servicename",
                      dest="radb_servicename",
                      type="string",
                      default=DEFAULT_RADB_SERVICENAME,
                      help="Name of the radb service. [default: %default]")
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO)

    with OTDBtoRATaskStatusPropagator(
            otdb_notification_busname=options.otdb_notification_busname,
            otdb_notification_subject=options.otdb_notification_subject,
            radb_busname=options.radb_busname,
            radb_servicename=options.radb_servicename,
            broker=options.broker):
        waitForInterrupt()
コード例 #12
0
def main():
    logger.warning("!!! This is unfinished work!") # todo: finish, if required: Create proper events that are accepted by the comet broker

    # Check the invocation arguments
    parser = argparse.ArgumentParser("This script will listen to TBB trigger messages via UDP, generate a VO event and send that to a specified VOevent broker.")
    parser.add_argument('-l', '--listening-port', dest='lport', help="Port to listen for UDP messages", required=False, default=DEFAULT_LISTENING_PORT)
    parser.add_argument('-b', '--broker-host', dest='host', help="Host of the VO event broker", required=False, default=DEFAULT_TBB_ALERT_BROKER_HOST)
    parser.add_argument('-p', '--broker-port', dest='port', help="Port of the VO event broker", required=False, default=DEFAULT_TBB_ALERT_BROKER_PORT)

    args = parser.parse_args()
    with VOEventPublisher(args.lport,
                          broker_host=args.host,
                          broker_port=args.port):
        waitForInterrupt()
コード例 #13
0
def main():
    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassignment database service')
    parser.add_option('-b', '--broker', dest='broker', type='string', default=DEFAULT_BROKER,
                      help='Address of the broker, default: %default')
    parser.add_option('-e', "--exchange", dest="exchange", type="string", default=DEFAULT_BUSNAME,
                      help="Exchange where the OTDB notifications are published. "
                           "[default: %default]")
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)

    with TriggerCancellationService(exchange=options.exchange,
                                    broker=options.broker):
        waitForInterrupt()
コード例 #14
0
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the storagequery service')
    parser.add_option(
        '-c',
        '--cache_path',
        dest='cache_path',
        type='string',
        default=os.path.expandvars('$LOFARROOT/etc/storagequery_cache.py'),
        help='path of the cache file, default: %default')
    parser.add_option(
        '-b',
        '--broker',
        dest='broker',
        type='string',
        default=DEFAULT_BROKER,
        help='Address of the messaging broker, default: %default')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the broker, [default: %default]")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with CacheManager(exchange=options.exchange,
                      broker=options.broker,
                      cache_path=options.cache_path) as cache_manager:
        with createService(exchange=options.exchange,
                           broker=options.broker,
                           cache_manager=cache_manager):
            waitForInterrupt()
コード例 #15
0
ファイル: rotspservice.py プロジェクト: mfkiwl/lofar-1
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    from optparse import OptionParser
    from lofar.common.util import waitForInterrupt

    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the RAtoOTDBTaskSpecificationPropagator service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        '-e',
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help=
        "Name of the bus on which messages are published, default: %default")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    logging.getLogger('lofar.sas.resourceassignment.database.radbbuslistener'
                      ).level = logging.WARN
    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with RAtoOTDBPropagator(exchange=options.exchange,
                            broker=options.broker) as propagator:
        with RABusListener(handler_type=RATaskStatusChangedHandler,
                           handler_kwargs={'propagator': propagator},
                           exchange=options.exchange,
                           broker=options.broker):
            waitForInterrupt()
コード例 #16
0
def main():
    from optparse import OptionParser
    from lofar.messaging import setQpidLogLevel
    from lofar.common.util import waitForInterrupt

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassigner service')
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option(
        "-b",
        "--busname",
        dest="busname",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the qpid broker, default: %s" %
        DEFAULT_BUSNAME)
    parser.add_option("-s",
                      "--servicename",
                      dest="servicename",
                      type="string",
                      default=DEFAULT_SERVICENAME,
                      help="Name for this service, default: %s" %
                      DEFAULT_SERVICENAME)
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    setQpidLogLevel(logging.INFO)
    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with createService(busname=options.busname,
                       servicename=options.servicename,
                       broker=options.broker):
        waitForInterrupt()
コード例 #17
0
def main():
    from optparse import OptionParser
    from lofar.messaging import setQpidLogLevel
    from lofar.common.util import waitForInterrupt

    from lofar.sas.resourceassignment.resourceassignmentservice.config import DEFAULT_BUSNAME as RADB_BUSNAME
    from lofar.sas.resourceassignment.resourceassignmentservice.config import DEFAULT_SERVICENAME as RADB_SERVICENAME
    from lofar.sas.otdb.config import DEFAULT_OTDB_SERVICE_BUSNAME, DEFAULT_OTDB_SERVICENAME

    from lofar.mom.momqueryservice.config import DEFAULT_MOMQUERY_BUSNAME, DEFAULT_MOMQUERY_SERVICENAME


    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the RAtoOTDBTaskSpecificationPropagator service')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    parser.add_option("--notification_busname", dest="notification_busname", type="string", default=RA_NOTIFICATION_BUSNAME, help="Name of the notification bus on which messages are published, default: %default")
    parser.add_option("--notification_subject", dest="notification_subject", type="string", default=RA_NOTIFICATION_PREFIX+'TaskUpdated', help="Subject of the published messages to listen for, default: %default")
    parser.add_option("--radb_busname", dest="radb_busname", type="string", default=RADB_BUSNAME, help="Name of the bus on which the RADB service listens, default: %default")
    parser.add_option("--radb_servicename", dest="radb_servicename", type="string", default=RADB_SERVICENAME, help="Name of the RADB service, default: %default")
    parser.add_option("--otdb_busname", dest="otdb_busname", type="string", default=DEFAULT_OTDB_SERVICE_BUSNAME, help="Name of the bus on which the OTDB service listens, default: %default")
    parser.add_option("--otdb_servicename", dest="otdb_servicename", type="string", default=DEFAULT_OTDB_SERVICENAME, help="Name of the OTDB service, default: %default")
    parser.add_option("--mom_busname", dest="mom_busname", type="string", default=DEFAULT_MOMQUERY_BUSNAME, help="Name of the bus on which the MoM service listens, default: %default")
    parser.add_option("--mom_servicename", dest="mom_servicename", type="string", default=DEFAULT_MOMQUERY_SERVICENAME, help="Name of the MoM service, default: %default")
    parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
    (options, args) = parser.parse_args()

    logging.getLogger('lofar.sas.resourceassignment.database.radbbuslistener').level = logging.WARN
    setQpidLogLevel(logging.INFO)
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.DEBUG if options.verbose else logging.INFO)

    with RAtoOTDBPropagator(radb_busname=options.radb_busname,
                            radb_servicename=options.radb_servicename,
                            otdb_busname=options.otdb_busname,
                            otdb_servicename=options.otdb_servicename,
                            mom_busname=options.mom_busname,
                            mom_servicename=options.mom_servicename,
                            broker=options.broker) as propagator:
        with RATaskStatusChangedListener(busname=options.notification_busname,
                                         subject=options.notification_subject,
                                         broker=options.broker,
                                         propagator=propagator) as listener:
            waitForInterrupt()
コード例 #18
0
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the resourceassignment database service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the broker, default: %default")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="RADB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    logging.basicConfig(
        format='%(asctime)s %(thread)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    logger.info("Using dbcreds: %s" % dbcreds.stringWithHiddenPassword())

    with createService(exchange=options.exchange,
                       broker=options.broker,
                       dbcreds=dbcreds):
        waitForInterrupt()
コード例 #19
0
ファイル: service.py プロジェクト: jjdmol/LOFAR
def main():
    from optparse import OptionParser
    from lofar.messaging import setQpidLogLevel
    from lofar.common.util import waitForInterrupt

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassigner service')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    parser.add_option("-b", "--busname", dest="busname", type="string", default=DEFAULT_BUSNAME, help="Name of the bus exchange on the qpid broker, default: %s" % DEFAULT_BUSNAME)
    parser.add_option("-s", "--servicename", dest="servicename", type="string", default=DEFAULT_SERVICENAME, help="Name for this service, default: %s" % DEFAULT_SERVICENAME)
    parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
    (options, args) = parser.parse_args()

    setQpidLogLevel(logging.INFO)
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.DEBUG if options.verbose else logging.INFO)

    with createService(busname=options.busname, servicename=options.servicename, broker=options.broker):
        waitForInterrupt()
コード例 #20
0
ファイル: momqueryservice.py プロジェクト: jjdmol/LOFAR
def main():
    '''Starts the momqueryservice.GetProjectDetails service'''

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the momqueryservice')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    parser.add_option("-b", "--busname", dest="busname", type="string", default=DEFAULT_MOMQUERY_BUSNAME, help="Name of the bus exchange on the qpid broker, [default: %default]")
    parser.add_option("-s", "--servicename", dest="servicename", type="string", default=DEFAULT_MOMQUERY_SERVICENAME, help="Name for this service, [default: %default]")
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="MoM")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    # start the service and listen.
    with createService(busname=options.busname,
                       servicename=options.servicename,
                       broker=options.broker,
                       dbcreds=dbcreds):
        waitForInterrupt()
コード例 #21
0
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the cleanup service')
    parser.add_option(
        '-b',
        '--broker',
        dest='broker',
        type='string',
        default=DEFAULT_BROKER,
        help='Address of the messaging broker, default: %default')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the broker, [default: %default]")
    parser.add_option("--mountpoint",
                      dest="mountpoint",
                      type="string",
                      default=CEP4_DATA_MOUNTPOINT,
                      help="path of local cep4 mount point, default: %default")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with createService(exchange=options.exchange, broker=options.broker):
        waitForInterrupt()
コード例 #22
0
def main():
    from optparse import OptionParser
    from lofar.common.util import waitForInterrupt

    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the task prescheduler service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    parser.add_option('-e',
                      '--exchange',
                      dest='exchange',
                      type='string',
                      default=DEFAULT_BUSNAME,
                      help='exchange for communication. [default: %default]')
    (options, args) = parser.parse_args()

    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with RABusListener(handler_type=TaskPreschedulerEventHandler,
                       exchange=options.exchange,
                       broker=options.broker,
                       num_threads=1):
        waitForInterrupt()
コード例 #23
0
ファイル: qa_service.py プロジェクト: mfkiwl/lofar-1
def main():
    '''
    Run the qa service program with commandline arguments.
    '''

    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description=
        'run the qa_service which listens for observations/pipelines finished events on '
        'the bus and then starts the QA (Quality Assurance) processes to convert MS to '
        'hdf5 files and generate inspection plots.')
    group = OptionGroup(parser, 'QPid Messaging options')
    group.add_option('-b',
                     '--broker',
                     dest='broker',
                     type='string',
                     default='localhost',
                     help='Address of the qpid broker, default: %default')
    group.add_option(
        '-e',
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help=
        "Bus or queue where the OTDB notifications are published. [default: %default]"
    )
    parser.add_option_group(group)
    (options, args) = parser.parse_args()

    #config logging
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO)

    #start the qa service
    with QAService(exchange=options.exchange, broker=options.broker):
        #loop and wait for messages or interrupt.
        waitForInterrupt()
コード例 #24
0
ファイル: TreeService.py プロジェクト: mfkiwl/lofar-1
def main():
    from optparse import OptionParser
    from lofar.common import dbcredentials
    from lofar.common.util import waitForInterrupt

    # Check the invocation arguments
    parser = OptionParser("%prog [options]")
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Bus on which RPC commands are received. [default: %default]")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    # Add options of dbcredentials: --database, --host, ...
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="OTDB")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)
    print("###dbcreds:", dbcreds)

    with create_service(broker=options.broker,
                        exchange=options.exchange,
                        dbcreds=dbcreds):
        waitForInterrupt()

    logger.info("Stopped the OTDB services")
コード例 #25
0
ファイル: raservice.py プロジェクト: mfkiwl/lofar-1
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    from optparse import OptionParser
    from lofar.common.util import waitForInterrupt

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassigner service')
    parser.add_option('-b', '--broker', dest='broker', type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the broker, default: localhost')
    parser.add_option('-e', "--exchange", dest="exchange", type="string",
                      default=DEFAULT_BUSNAME,
                      help="Name of the bus on which communication occurs [default: %default]")
    parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')

    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="RADB")

    (options, args) = parser.parse_args()

    radb_dbcreds = dbcredentials.parse_options(options)

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.DEBUG if options.verbose else logging.INFO)

    with ResourceAssigner(exchange=options.exchange,
                          broker=options.broker,
                          radb_dbcreds=radb_dbcreds) as assigner:
        with RATaskSpecifiedBusListener(handler_type=SpecifiedTaskEventMessageHandler,
                                        handler_kwargs={"assigner": assigner},
                                        exchange=options.exchange,
                                        broker=options.broker):
            with ScheduleChecker(exchange=options.exchange,
                                 broker=options.broker):
                waitForInterrupt()
コード例 #26
0
def main():
    '''Starts the momqueryservice.GetProjectDetails service'''

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the momqueryservice')
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option(
        "-b",
        "--busname",
        dest="busname",
        type="string",
        default=DEFAULT_MOMQUERY_BUSNAME,
        help="Name of the bus exchange on the qpid broker, [default: %default]"
    )
    parser.add_option("-s",
                      "--servicename",
                      dest="servicename",
                      type="string",
                      default=DEFAULT_MOMQUERY_SERVICENAME,
                      help="Name for this service, [default: %default]")
    parser.add_option_group(dbcredentials.options_group(parser))
    parser.set_defaults(dbcredentials="MoM")
    (options, args) = parser.parse_args()

    dbcreds = dbcredentials.parse_options(options)

    # start the service and listen.
    with createService(busname=options.busname,
                       servicename=options.servicename,
                       broker=options.broker,
                       dbcreds=dbcreds):
        waitForInterrupt()
コード例 #27
0
ファイル: taskmanagement.py プロジェクト: mfkiwl/lofar-1
def main():
    from optparse import OptionParser
    from lofar.common.util import waitForInterrupt

    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser(
        "%prog [options]",
        description='runs the resourceassignment database service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the bus exchange on the qpid broker, default: %default")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with createService(exchange=options.exchange, broker=options.broker):
        waitForInterrupt()
コード例 #28
0
def main():
    # make sure we run in UTC timezone
    import os
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the observationcontrol service')
    parser.add_option('-b',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        "-e",
        "--exchange",
        dest="exchange",
        type="string",
        default=DEFAULT_BUSNAME,
        help="Name of the exchange on the qpid broker, default: %default")
    parser.add_option('-V',
                      '--verbose',
                      dest='verbose',
                      action='store_true',
                      help='verbose logging')
    (options, args) = parser.parse_args()

    logging.basicConfig(
        format='%(asctime)s %(levelname)s %(message)s',
        level=logging.DEBUG if options.verbose else logging.INFO)

    with RPCService(
            service_name=config.DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME,
            handler_type=ObservationControlHandler,
            broker=options.broker,
            exchange=options.exchange):
        waitForInterrupt()
コード例 #29
0
ファイル: RATaskSpecified.py プロジェクト: jjdmol/LOFAR
def main():
    import logging
    import sys
    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 [options]",
                          description="run the rataskspecified service")
    parser.add_option("-b", "--notification_bus", dest="notification_bus", type="string",
                      default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_BUSNAME,
                      help="Bus or queue we publish resource requests on. [default: %default]")
    parser.add_option("-s", "--notification_subject", dest="notification_subject", type="string",
                      default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_SUBJECT,
                      help="The subject of the event messages which this service publishes. [default: %default]")
    parser.add_option("--otdb_notification_bus", dest="otdb_notification_bus", type="string",
                      default=DEFAULT_OTDB_NOTIFICATION_BUSNAME,
                      help="Bus or queue where the OTDB notifications are published. [default: %default]")
    parser.add_option("--otdb_notification_subject", dest="otdb_notification_subject", type="string",
                      default=DEFAULT_OTDB_NOTIFICATION_SUBJECT,
                      help="Subject of OTDB notifications on otdb_notification_bus. [default: %default]")
    parser.add_option("--otdb_request_bus", dest="otdb_request_bus", type="string",
                      default=DEFAULT_OTDB_SERVICE_BUSNAME,
                      help="Bus or queue where the OTDB requests are handled. [default: %default]")
    parser.add_option('-q', '--broker', dest='broker', type='string', default=None, help='Address of the qpid broker, default: localhost')
    (options, args) = parser.parse_args()

    with RATaskSpecified(otdb_notification_busname=options.otdb_notification_bus,
                         otdb_notification_subject=options.otdb_notification_subject,
                         otdb_service_busname=options.otdb_request_bus,
                         otdb_service_subject=DEFAULT_OTDB_SERVICENAME, ##TODO parse this from command line
                         notification_busname=options.notification_bus,
                         notification_subject=options.notification_subject,
                         broker=options.broker):
        waitForInterrupt()
コード例 #30
0
ファイル: tbbbuslistener.py プロジェクト: mfkiwl/lofar-1
def main():
    from lofar.common.util import waitForInterrupt
    from optparse import OptionParser
    import os, sys

    # make sure we run in UTC timezone
    os.environ['TZ'] = 'UTC'

    # Check the invocation arguments
    parser = OptionParser('%prog [options]',
                          description='run the ingest job monitor')
    parser.add_option('-q', '--broker', dest='broker', type='string', default=DEFAULT_BROKER, help='Address of the qpid broker, default: %default')
    parser.add_option("-n", "--busname", dest="busname", type="string",
                      default=DEFAULT_BUSNAME,
                      help='Name of the notification exchange where to listen for the published tbb notifications, default: %default')
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO,
                        stream=sys.stdout)

    with TBBBusListener(exchange=options.busname,
                        broker=options.broker):
        waitForInterrupt()
コード例 #31
0
def main():
    with create_service():
        waitForInterrupt()
コード例 #32
0
def main():
    import logging
    import sys
    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 [options]",
                          description="run the rataskspecified service")
    parser.add_option(
        "-b",
        "--notification_bus",
        dest="notification_bus",
        type="string",
        default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_BUSNAME,
        help="Bus or queue we publish resource requests on. [default: %default]"
    )
    parser.add_option(
        "-s",
        "--notification_subject",
        dest="notification_subject",
        type="string",
        default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_SUBJECT,
        help=
        "The subject of the event messages which this service publishes. [default: %default]"
    )
    parser.add_option(
        "--otdb_notification_bus",
        dest="otdb_notification_bus",
        type="string",
        default=DEFAULT_OTDB_NOTIFICATION_BUSNAME,
        help=
        "Bus or queue where the OTDB notifications are published. [default: %default]"
    )
    parser.add_option(
        "--otdb_notification_subject",
        dest="otdb_notification_subject",
        type="string",
        default=DEFAULT_OTDB_NOTIFICATION_SUBJECT,
        help=
        "Subject of OTDB notifications on otdb_notification_bus. [default: %default]"
    )
    parser.add_option(
        "--otdb_request_bus",
        dest="otdb_request_bus",
        type="string",
        default=DEFAULT_OTDB_SERVICE_BUSNAME,
        help=
        "Bus or queue where the OTDB requests are handled. [default: %default]"
    )
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    (options, args) = parser.parse_args()

    with RATaskSpecified(
            otdb_notification_busname=options.otdb_notification_bus,
            otdb_notification_subject=options.otdb_notification_subject,
            otdb_service_busname=options.otdb_request_bus,
            otdb_service_subject=
            DEFAULT_OTDB_SERVICENAME,  ##TODO parse this from command line
            notification_busname=options.notification_bus,
            notification_subject=options.notification_subject,
            broker=options.broker):
        waitForInterrupt()
コード例 #33
0
    def onResourceClaimInserted(self, new_claim):
        '''onResourceClaimInserted is called upon receiving a ResourceClaimInserted message.
        :param new_claim: dictionary with the inserted claim'''
        pass

    def onResourceClaimDeleted(self, old_claim):
        '''onResourceClaimDeleted is called upon receiving a ResourceClaimDeleted message.
        :param old_claim: dictionary with the deleted claim'''
        pass

    def onResourceAvailabilityUpdated(self, old_availability,
                                      new_availability):
        '''onResourceAvailabilityUpdated is called upon receiving a ResourceAvailabilityUpdated message.
        :param old_availability: dictionary with the resource availability before the update
        :param new_availability: dictionary with the updated availability'''
        pass

    def onResourceCapacityUpdated(self, old_capacity, new_capacity):
        '''onResourceCapacityUpdated is called upon receiving a ResourceCapacityUpdated message.
        :param old_capacity: dictionary with the resource capacity before the update
        :param new_capacity: dictionary with the updated capacity'''
        pass


if __name__ == '__main__':
    with RADBBusListener(broker=None) as listener:
        waitForInterrupt()

__all__ = ["RADBBusListener"]
コード例 #34
0
def main():
    from optparse import OptionParser
    from lofar.messaging import setQpidLogLevel
    from lofar.common.util import waitForInterrupt

    from lofar.sas.resourceassignment.resourceassignmentservice.config import DEFAULT_BUSNAME as RADB_BUSNAME
    from lofar.sas.resourceassignment.resourceassignmentservice.config import DEFAULT_SERVICENAME as RADB_SERVICENAME
    from lofar.sas.resourceassignment.resourceassignmentestimator.config import DEFAULT_BUSNAME as RE_BUSNAME
    from lofar.sas.resourceassignment.resourceassignmentestimator.config import DEFAULT_SERVICENAME as RE_SERVICENAME
    from lofar.sas.otdb.config import DEFAULT_OTDB_SERVICE_BUSNAME, DEFAULT_OTDB_SERVICENAME
    from lofar.sas.systemstatus.service.config import DEFAULT_SSDB_BUSNAME
    from lofar.sas.systemstatus.service.config import DEFAULT_SSDB_SERVICENAME

    # Check the invocation arguments
    parser = OptionParser("%prog [options]",
                          description='runs the resourceassigner service')
    parser.add_option('-q', '--broker', dest='broker', type='string',
                      default=None,
                      help='Address of the qpid broker, default: localhost')
    parser.add_option("--notification_busname", dest="notification_busname", type="string",
                      default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_BUSNAME,
                      help="Name of the notification bus on which taskspecified messages are published. [default: %default]")
    parser.add_option("--notification_subject", dest="notification_subject", type="string",
                      default=DEFAULT_RA_TASK_SPECIFIED_NOTIFICATION_SUBJECT,
                      help="Subject of the published taskspecified messages to listen for. [default: %default]")
    parser.add_option("--radb_busname", dest="radb_busname", type="string",
                      default=RADB_BUSNAME,
                      help="Name of the bus on which the radb service listens. [default: %default]")
    parser.add_option("--radb_servicename", dest="radb_servicename", type="string",
                      default=RADB_SERVICENAME,
                      help="Name of the radb service. [default: %default]")
    parser.add_option("--re_busname", dest="re_busname", type="string",
                      default=RE_BUSNAME,
                      help="Name of the bus on which the resource estimator service listens. [default: %default]")
    parser.add_option("--re_servicename", dest="re_servicename", type="string",
                      default=RE_SERVICENAME,
                      help="Name of the resource estimator service. [default: %default]")
    parser.add_option("--otdb_busname", dest="otdb_busname", type="string", default=DEFAULT_OTDB_SERVICE_BUSNAME, help="Name of the bus on which the OTDB service listens, default: %default")
    parser.add_option("--otdb_servicename", dest="otdb_servicename", type="string", default=DEFAULT_OTDB_SERVICENAME, help="Name of the OTDB service, default: %default")
    parser.add_option("--ssdb_busname", dest="ssdb_busname", type="string",
                      default=DEFAULT_SSDB_BUSNAME,
                      help="Name of the bus on which the ssdb service listens. [default: %default]")
    parser.add_option("--ssdb_servicename", dest="ssdb_servicename", type="string",
                      default=DEFAULT_SSDB_SERVICENAME,
                      help="Name of the ssdb service. [default: %default]")
    parser.add_option('-V', '--verbose', dest='verbose', action='store_true', help='verbose logging')
    (options, args) = parser.parse_args()

    logging.getLogger('lofar.messaging.messagebus').setLevel(logging.WARNING)
    setQpidLogLevel(logging.INFO)
    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.DEBUG if options.verbose else logging.INFO)

    with ResourceAssigner(radb_busname=options.radb_busname,
                          radb_servicename=options.radb_servicename,
                          re_busname=options.re_busname,
                          re_servicename=options.re_servicename,
                          otdb_busname=options.otdb_busname,
                          otdb_servicename=options.otdb_servicename,
                          ssdb_busname=options.ssdb_busname,
                          ssdb_servicename=options.ssdb_servicename,
                          broker=options.broker) as assigner:
        with SpecifiedTaskListener(busname=options.notification_busname,
                                   subject=options.notification_subject,
                                   broker=options.broker,
                                   assigner=assigner) as listener:
            waitForInterrupt()
コード例 #35
0
ファイル: radbbuslistener.py プロジェクト: jjdmol/LOFAR
        pass

    def onResourceClaimInserted(self, new_claim):
        '''onResourceClaimInserted is called upon receiving a ResourceClaimInserted message.
        :param new_claim: dictionary with the inserted claim'''
        pass

    def onResourceClaimDeleted(self, old_claim):
        '''onResourceClaimDeleted is called upon receiving a ResourceClaimDeleted message.
        :param old_claim: dictionary with the deleted claim'''
        pass

    def onResourceAvailabilityUpdated(self, old_availability, new_availability):
        '''onResourceAvailabilityUpdated is called upon receiving a ResourceAvailabilityUpdated message.
        :param old_availability: dictionary with the resource availability before the update
        :param new_availability: dictionary with the updated availability'''
        pass

    def onResourceCapacityUpdated(self, old_capacity, new_capacity):
        '''onResourceCapacityUpdated is called upon receiving a ResourceCapacityUpdated message.
        :param old_capacity: dictionary with the resource capacity before the update
        :param new_capacity: dictionary with the updated capacity'''
        pass


if __name__ == '__main__':
    with RADBBusListener(broker=None) as listener:
        waitForInterrupt()

__all__ = ["RADBBusListener"]
コード例 #36
0
ファイル: ingestmomadapter.py プロジェクト: mfkiwl/lofar-1
def main():
    from optparse import OptionParser

    # Check the invocation arguments
    parser = OptionParser(
        '%prog [options]',
        description=
        'run ingest mom adapter, which receives jobs from MoM, and updates ingest statuses to MoM'
    )
    parser.add_option('-q',
                      '--broker',
                      dest='broker',
                      type='string',
                      default=DEFAULT_BROKER,
                      help='Address of the qpid broker, default: %default')
    parser.add_option(
        '--exchange',
        dest='exchange',
        type='string',
        default=DEFAULT_BUSNAME,
        help='Name of the bus on which the services listen, default: %default')
    parser.add_option(
        "-m",
        "--mom_credentials",
        dest="mom_credentials",
        type="string",
        default='MoM_site' if isProductionEnvironment() else 'MoM_site_test',
        help=
        "Name of website credentials for MoM user/pass (see ~/.lofar/dbcredentials) [default=%default]"
    )
    parser.add_option(
        "--host",
        dest="host",
        type="string",
        default=DEFAULT_MOM_XMLRPC_HOST,
        help=
        "address on which the xmlrpc server listens for (mom) jobs [default=%default]"
    )
    parser.add_option(
        "-p",
        "--port",
        dest="port",
        type="int",
        default=DEFAULT_MOM_XMLRPC_PORT,
        help=
        "port on which the xmlrpc server listens for (mom) jobs [default=%default]"
    )
    (options, args) = parser.parse_args()

    logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s',
                        level=logging.INFO)

    mom_creds = DBCredentials().get(options.mom_credentials)
    logger.info("Using username \'%s\' for MoM web client" % mom_creds.user)

    logger.info('*****************************************')
    logger.info('Starting IngestMomAdapter...')
    logger.info('*****************************************')

    with IngestMomAdapter(mom_creds, options.exchange, options.broker,
                          options.host, options.port) as adapter:
        waitForInterrupt()

    logger.info('Stopped IngestMomAdapter')