Ejemplo n.º 1
0

    def __exit__(self, exc_type, exc_val, exc_tb):
        Log.note("clean pulse exit")
        self.please_stop.go()
        try:
            self.target_queue.close()
            Log.note("stop put into queue")
        except:
            pass

        try:
            self.pulse.disconnect()
        except Exception, e:
            Log.warning("Can not disconnect during pulse exit, ignoring", e)
        Thread.__exit__(self, exc_type, exc_val, exc_tb)


class Publisher(object):
    """
    Mimic GenericPublisher https://github.com/bhearsum/mozillapulse/blob/master/mozillapulse/publishers.py
    """

    @use_settings
    def __init__(
        self,
        exchange,  # name of the Pulse exchange
        host='pulse.mozilla.org',  # url to connect,
        port=5671,  # tcp port
        user=None,
        password=None,
Ejemplo n.º 2
0
                        "Pulse had problem (Have you set your Pulse permissions correctly?",
                        e)
        Log.note("pulse listener is done")

    def __exit__(self, exc_type, exc_val, exc_tb):
        Log.note("clean pulse exit")
        self.please_stop.go()
        with suppress_exception:
            self.target_queue.close()
            Log.note("stop put into queue")

        try:
            self.pulse.disconnect()
        except Exception, e:
            Log.warning("Can not disconnect during pulse exit, ignoring", e)
        Thread.__exit__(self, exc_type, exc_val, exc_tb)


class Publisher(object):
    """
    Mimic GenericPublisher https://github.com/bhearsum/mozillapulse/blob/master/mozillapulse/publishers.py
    """
    @use_settings
    def __init__(
            self,
            exchange,  # name of the Pulse exchange
            host='pulse.mozilla.org',  # url to connect,
            port=5671,  # tcp port
            user=None,
            password=None,
            vhost="/",