wrap_function¶
- sofia_redux.toolkit.utilities.multiprocessing.wrap_function(func, args, kwargs=None, logger=None, log_directory=None)[source]¶
Wrap a function for use with
multitask()
.- Parameters:
- funcfunction
The function to wrap.
- argstuple
The function arguments.
- kwargsdict, optional
Any function keyword arguments.
- loggerlogging.Logger or str, optional
A logger used to output any log messages once complete. If supplied, a valid
log_directory
must also be supplied. A path to a pickle file containing the logger may also be supplied.- log_directorystr, optional
If supplied together with a
logger
, will store all log records to a pickle file in the given directory.
- Returns:
- wrapped_function, log_pickle_filefunction, str
The wrapped function and the file location of the pickle file for any supplied logger. If no logger was supplied, this value will be
None
.