HWRF
trunk@4391
|
This module allows querying resource usage and limits, as well as setting resource limits. More...
This module allows querying resource usage and limits, as well as setting resource limits.
It is a wrapper around the Python resource module.
Setting resource limits:
Printing resource limits to a logger:
Classes | |
class | RLimit |
Gets the resource limits set on this process: core, cpu, fsize, data, stack, rss, nproc, nofile, memlock, aspace Each is set to a tuple containing the soft and hard limit. More... | |
class | RUsage |
Contains resource usage (rusage) information that can be used with a Python "with" construct to collect the resources utilized by a block of code, or group of subprocesses executing during that block. More... | |
class | RUsageReport |
Raised when caller makes an RUsage, and tries to generate its report, before calling its enter or exit routines. More... | |
Functions | |
def | setrlimit (logger=None, ignore=False, hard=False, kwargs) |
Sets resource limits. More... | |
def | getrlimit |
Gets the current resource limits. More... | |
Variables | |
tuple | rtypemap |
Maps the name used in this module for each resource class to the name used by the Python resource module. More... | |
tuple | rnamemap |
Maps the name used in this module for each resource class, to a short human-readable string explaining the resource's meaning. More... | |
tuple | rusage_keys |
A tuple containing all rusage keys. More... | |
tuple | rusage_meanings |
A mapping from rusage key to a human-readable explanation of the meaning. More... | |
rusage = RUsage | |
Alias for produtil.rusage.RUsage. | |
def produtil.rusage.getrlimit | ( | logger = None | ) |
Gets the current resource limits.
If logger is not None, sends the limits to the logger at level INFO.
Definition at line 132 of file rusage.py.
Referenced by hwrf.init.HWRFInit.run_init_after_anl(), pom.init.fbtr.setrun(), pom.init.g3.setrun(), and pom.init.na.setrun().
def produtil.rusage.setrlimit | ( | logger = None , |
|
ignore = False , |
|||
hard = False , |
|||
kwargs | |||
) |
Sets resource limits.
ignore | If ignore=True, ignores any errors from getrlimit or setrlimit. |
hard | If hard=True, attempts to set hard limits, which generally requires administrator privileges. |
logger | The logger argument sets the logger (default: produtil.setrlimit logging domain). |
kwargs | The kwargs should be a list of resource limits. Accepted resource limits:
|
Definition at line 60 of file rusage.py.
Referenced by pom.init.fbtr.setrun(), pom.init.g3.setrun(), and pom.init.na.setrun().
produtil.rusage.rnamemap |
Maps the name used in this module for each resource class, to a short human-readable string explaining the resource's meaning.
produtil.rusage.rtypemap |
Maps the name used in this module for each resource class to the name used by the Python resource module.
produtil.rusage.rusage_keys |
produtil.rusage.rusage_meanings |
A mapping from rusage key to a human-readable explanation of the meaning.