cctools
|
Resource monitoring tool for complex applications - Python interface. More...
Data Structures | |
class | ResourceExhaustion |
Exception raised when a function goes over the resources limits. More... | |
class | ResourceInternalError |
class | Categories |
Class to encapsule all the categories in a workflow. More... | |
class | Category |
Functions | |
def | monitored |
Create a monitored version of a function. More... | |
Resource monitoring tool for complex applications - Python interface.
The resource_monitor provides an unprivileged way for systems to monitor the consumption of key resources (cores, memory, disk) of applications ranging from simple Python functions up to complex multi-process trees. It provides measurement, logging, enforcement, and triggers upon various conditions. The objects and methods provided by this package correspond to the native C API in category.h, rmonitor_poll.h, and rmsummary.h
The SWIG-based Python bindings provide a higher-level interface that revolves around the following function/decorator and objects:
def ndcctools.resource_monitor.monitored | ( | limits = None , |
|
callback = None , |
|||
interval = 1 , |
|||
return_resources = True |
|||
) |
Create a monitored version of a function.
It can be used as a decorator, or called by itself.
limits | Dictionary of resource limits to set. Available limits are:
|
callback | Function to call every time a measurement is done. The arguments given to the function are
|
interval | Maximum time in seconds between measurements. |
return_resources | Whether to modify the return value of the function to a tuple of the original result and a dictionary with the final measurements. |