gwcelery.util module

Miscellaneous utilities that are useful inside many different tasks.


Catch any SystemExit and re-raise it as RuntimeError.

Some Celery tasks in this package call main functions of command-line tools from other packages. Those main functions may try to exit the Python interpreter (if, for example, the command-line arguments are not understood).

Catch any SystemExit exception. If the exit code is zero (signifying a normal exit status), then ignore the exception. If the exit code is nonzero (signifying an error exit status), then re-raise it as a RuntimeError so that the error is reported but the Celery worker is not killed.

class gwcelery.util.PromiseProxy(*args, **kwargs)

Bases: object

gwcelery.util.read_json(*args, **kwargs)

Load a JSON file from package data.

gwcelery.util.read_pickle(*args, **kwargs)

Load a JSON file from package data.

gwcelery.util.NamedTemporaryFile(content=None, **kwargs)

Convenience wrapper for tempfile.NamedTemporaryFile() that writes some data to the file before handing it to the calling code.