GraceDB client software.

Forked from lscsoft / gracedb-client

  • Leo Pound Singer's avatar
    Make HTTPError pickleable · dd107fa3
    Leo Pound Singer authored
    According to the [Celery manual]:
    
    > A rarely known Python fact is that exceptions must conform to
    > some simple rules to support being serialized by the pickle
    > module.
    >
    > Tasks that raise exceptions that aren’t pickleable won’t work
    > properly when Pickle is used as the serializer.
    >
    > To make sure that your exceptions are pickleable the exception
    > MUST provide the original arguments it was instantiated with in
    > its .args attribute. The simplest way to ensure this is to have
    > the exception call Exception.__init__.
    
    The class `ligo.gracedb.exceptions.HTTPError` does not follow
    these rules, so it is not pickleable. Here is a demonstration of
    that:
    
        >>> import pickle
        >>> from ligo.gracedb.exceptions import HTTPError
        >>> pickle.loads(pickle.dumps(HTTPError(404, 'foo', 'bar')))
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        TypeError: __init__() missing 2 required positional arguments:
        'reason' and 'message'
    
    This patch makes `HTTPError` pickleable so that it can be properly
    represented in Celery task stack traces.
    
    [Celery manual]: http://docs.celeryproject.org/en/latest/userguide/tasks.html#creating-pickleable-exceptions
    dd107fa3
Name
Last commit
Last update
debian Loading commit data...
doc Loading commit data...
etc Loading commit data...
ligo Loading commit data...
.gitignore Loading commit data...
.gitlab-ci.yml Loading commit data...
MANIFEST.in Loading commit data...
README.md Loading commit data...
ligo-gracedb.spec Loading commit data...
setup.cfg Loading commit data...
setup.py Loading commit data...