Ejemplo n.º 1
0
def run(amqp_uri, exchange, cmdlne_arguments):
    # start a monitor output thread, this does the work, whilst the main thread just acts as a control

    worker = Worker(amqp_uri, exchange, routing_key)
    worker.run()

    # poll for keyboard input to allow the user to quit monitoring
    while True:
        try:
            # just sleep unless we receive an interrupt i.e. CTRL+C
            sleep(1)
        except KeyboardInterrupt:
            sys.exit(1)
Ejemplo n.º 2
0
def run(amqp_uri, exchange, routing_key, params):
    # start a monitor output thread, this does the work, whilst the main thread just acts
    # as a control thread to receive the  keyboard input

    worker = Worker(amqp_uri, exchange, routing_key)
    worker.delay_between_refreshes = params['--delay'] if params[
        '--delay'] is not None else DELAY_BETWEEN_REFRESHES
    worker.limit = params['--updates'] if params[
        '--updates'] is not None else DISPLAY_N_TIMES
    worker.page_size = params['--pagesize'] if params[
        '--pagesize'] is not None else PAGE_SIZE
    worker.run()

    # poll for keyboard input to allow the user to quit monitoring
    while True:
        try:
            # just sleep unless we receive an interrupt i.e. CTRL+C
            sleep(KEYBOARD_INTERRUPT_SLEEP)
        except KeyboardInterrupt:
            worker.stop()
            sys.exit(1)
Ejemplo n.º 3
0
def run(amqp_uri, exchange, routing_key, params):
    # start a monitor output thread, this does the work, whilst the main thread just acts
    # as a control thread to receive the  keyboard input

    worker = Worker(amqp_uri, exchange, routing_key)
    worker.delay_between_refreshes = params["--delay"] if params["--delay"] is not None else DELAY_BETWEEN_REFRESHES
    worker.limit = params["--updates"] if params["--updates"] is not None else DISPLAY_N_TIMES
    worker.page_size = params["--pagesize"] if params["--pagesize"] is not None else PAGE_SIZE
    worker.run()

    # poll for keyboard input to allow the user to quit monitoring
    while True:
        try:
            # just sleep unless we receive an interrupt i.e. CTRL+C
            sleep(KEYBOARD_INTERRUPT_SLEEP)
        except KeyboardInterrupt:
            worker.stop()
            sys.exit(1)
Ejemplo n.º 4
0
def run(amqp_uri, exchange, routing_key, params):
    # start a monitor output thread, this does the work, whilst the main thread just acts
    # as a control thread to receive the  keyboard input
    delay = 5
    num_of_times = -1

    worker = Worker(amqp_uri, exchange, routing_key)
    worker.frequency = -1 # configure the worker for times to run
    worker.machine_filter = None # are we filtering to a machine
    worker.service_filter = None
    worker.run()

    # poll for keyboard input to allow the user to quit monitoring
    while True:
        try:
            # just sleep unless we receive an interrupt i.e. CTRL+C
            sleep(delay)
        except KeyboardInterrupt:
            sys.exit(1)