[Twisted-Python] [cpushare at cpushare.com: CPUShare Exception]

glyph at divmod.com glyph at divmod.com
Thu Jul 7 10:42:12 EDT 2005

On Thu, 7 Jul 2005 16:23:13 +0200, Andrea Arcangeli <andrea at cpushare.com> wrote:
>On Thu, Jul 07, 2005 at 08:48:59AM -0400, glyph at divmod.com wrote:
>> It seems like you might want to filter more than just OpenSSL.SSL.Error ;).
>very likely ;), but I guess I can wait until some harmless annoyance
>trigger like in this case.
>The number of emails the server sends me has a maximum of 10, to avoid
>getting the same exception too many times (and the max number of sms is
>1). So even something goes wrong and I'm on vacation I don't risk to
>fill the inbox ;)

Rather than a simple counter, why not hash tracebacks so they are not sent more than once?  For example:

from twisted.python.failure import Failure
import sha

def a(): b()
def b(): c()
def c(): raise RuntimeError()

def fail():
        return Failure()

def fhash(f):
    return sha.new(
        f.getTraceback(elideFrameworkCode=1, detail='brief')).digest()

f1 = fail()
f2 = fail()

print fhash(f1) == fhash(f2)

More information about the Twisted-Python mailing list