kedro.extras.decorators.memory_profiler.mem_profile

kedro.extras.decorators.memory_profiler.mem_profile(func)[source]

A function decorator which profiles the memory used when executing the function. The logged memory is collected by using the memory_profiler python module and includes memory used by children processes. The usage is collected by taking memory snapshots every 100ms. This decorator will only work with functions taking at least 0.5s to execute due to a bug in the memory_profiler python module. For more information about the bug, please see https://github.com/pythonprofilers/memory_profiler/issues/216

Parameters

func (Callable) – The function to be profiled.

Return type

Callable

Returns

A wrapped function, which will execute the provided function and log its max memory usage upon completion.