gwcelery.util module

Miscellaneous utilities that are useful inside many different tasks.

gwcelery.util.handling_system_exit()

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.

gwcelery.util.closing_figures()

Close figure that are created in a with: statement.

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

Bases: object

gwcelery.util.read_binary(pkg, filename)

Load a binary file from package data.

gwcelery.util.read_json(pkg, filename)

Load a JSON file from package data.

gwcelery.util.read_text(pkg, filename)

Load a binary 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.

Parameters: