Miscellaneous utilities that are useful inside many different tasks.
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).
SystemExitexception. 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
RuntimeErrorso that the error is reported but the Celery worker is not killed.
Close figure that are created in a with: statement.
- gwcelery.util.read_json(*args, **kwargs)¶
Load a JSON file from package data.
- gwcelery.util.read_pickle(*args, **kwargs)¶
Load a pickle file using astropy.utils.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.