Joblib userwarning while trying to cache results

拟墨画扇 提交于 2020-01-13 08:41:47

问题


I get the foll. userwarning when trying to cache results using joblib:

from tempfile import mkdtemp
cachedir = mkdtemp()
from joblib import Memory
memory = Memory(cachedir=cachedir, verbose=0)

@memory.cache
def get_nc_var3d(path_nc, var, year):
    """
    Get value from netcdf for variable var for year
    :param path_nc:
    :param var:
    :param year:
    :return:
    """
    try:
        hndl_nc = open_or_die(path_nc)
        val = hndl_nc.variables[var][int(year), :, :]
    except:
        val = numpy.nan
        logger.info('Error in getting var ' + var + ' for year ' + str(year) + ' from netcdf ')

    hndl_nc.close()
    return val

I get the foll. warning when calling this function using the foll. parameters:

UserWarning: Persisting input arguments took 0.58s to run.
If this happens often in your code, it can cause performance problems 
(results will be correct in all cases). 
The reason for this is probably some large input arguments for a wrapped
 function (e.g. large strings).
THIS IS A JOBLIB ISSUE. If you can, kindly provide the joblib's team with an
 example so that they can fix the problem.

Input parameters: C:/Users/rit/Documents/PhD/Projects/\GLA/Input/LUWH/\LUWLAN_v1.0h\transit_model.nc range_to_large 1150

How do I get rid of the warning? and why it is happening, since the input parameters are not too long.

来源:https://stackoverflow.com/questions/37129754/joblib-userwarning-while-trying-to-cache-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!