Can we improve the `<lambda>` in timed progress logging?
phargogh opened this issue · comments
Whenever we have a bunch of long-running raster_calculator()
calls, particularly when we're doing some multiprocessing, it's easy to end up with a whole pile of logging messages that look like this:
2023-01-27 16:51:49,702:pid6291:INFO:pygeoprocessing.geoprocessing:<lambda>:35.2% complete
Worse, even though many of these come from raster_calculator
, the timed progress logging could really be coming from almost any one of the geoprocessing functions in the module. With python's ability to walk the call stack at runtime, we have to be able to programmatically and deliberately set the __name__
attribute to the calling function. So instead of seeing <lambda>
, we should see raster_calculator
or maybe even a user-defined string if it's appropriate.