ATLAS Offline Software
Functions | Variables
python.ResourceLimits Namespace Reference

Functions

def _maxout (what, descr)
 private helper --------------------------------------------------------— More...
 
def _max_32bit_address_space (soft, descr)
 
def SetMaxLimits ()
 max out soft resource limits to hard ones -----------------------------— More...
 

Variables

string __version__ = '1.2.1'
 data ------------------------------------------------------------------— More...
 
string __author__ = 'Grigori Rybkine (Grigori.Rybkine@cern.ch)'
 
list __all__ = [ 'SetMaxLimits' ]
 
 log = logging.getLogger( 'ResourceLimits' )
 

Function Documentation

◆ _max_32bit_address_space()

def python.ResourceLimits._max_32bit_address_space (   soft,
  descr 
)
private

Definition at line 38 of file ResourceLimits.py.

38 def _max_32bit_address_space( soft, descr ):
39  MAX_AS = 2**32
40  _64MB = 64*1024*1024
41  hard = MAX_AS
42  while hard > soft:
43  try:
44  log.debug( 'setting soft %s limit to %s (was: %s)', descr,
45  str(hard),
46  str(soft), )
47  resource.setrlimit( resource.RLIMIT_AS, (hard,hard) )
48  except ValueError:
49  hard -= _64MB
50  else:
51  log.debug( 'set soft %s limit to %s (was: %s)', descr,
52  str(hard),
53  str(soft), )
54  return
55 

◆ _maxout()

def python.ResourceLimits._maxout (   what,
  descr 
)
private

private helper --------------------------------------------------------—

Definition at line 23 of file ResourceLimits.py.

23 def _maxout( what, descr ):
24  soft, hard = resource.getrlimit( what )
25  if soft < hard or ( hard == -1 and soft != hard ):
26  log.debug( 'setting soft %s limit to %s (was: %s)', descr,
27  hard == -1 and 'unlimited' or str(hard),
28  soft == -1 and 'unlimited' or str(soft), )
29  try:
30  resource.setrlimit( what, (hard,hard) )
31  except ValueError:
32  if what != resource.RLIMIT_AS or hard != -1: raise
33  import platform
34  if platform.architecture()[0] != '32bit': raise
35  if platform.machine() in ['i386', 'i486', 'i586', 'i686']: raise
36  _max_32bit_address_space( soft, descr )
37 

◆ SetMaxLimits()

def python.ResourceLimits.SetMaxLimits ( )

max out soft resource limits to hard ones -----------------------------—

Definition at line 57 of file ResourceLimits.py.

57 def SetMaxLimits():
58  try:
59  _maxout( resource.RLIMIT_AS, 'address space' )
60  _maxout( resource.RLIMIT_RSS, 'resident state' )
61  except (ValueError,resource.error) as e:
62  log.warning( 'failed to set max resource limits (%s)', str(e) )
63 

Variable Documentation

◆ __all__

list python.ResourceLimits.__all__ = [ 'SetMaxLimits' ]
private

Definition at line 17 of file ResourceLimits.py.

◆ __author__

string python.ResourceLimits.__author__ = 'Grigori Rybkine (Grigori.Rybkine@cern.ch)'
private

Definition at line 15 of file ResourceLimits.py.

◆ __version__

string python.ResourceLimits.__version__ = '1.2.1'
private

data ------------------------------------------------------------------—

Definition at line 14 of file ResourceLimits.py.

◆ log

python.ResourceLimits.log = logging.getLogger( 'ResourceLimits' )

Definition at line 19 of file ResourceLimits.py.

python.ResourceLimits.SetMaxLimits
def SetMaxLimits()
max out soft resource limits to hard ones -----------------------------—
Definition: ResourceLimits.py:57
python.ResourceLimits._maxout
def _maxout(what, descr)
private helper --------------------------------------------------------—
Definition: ResourceLimits.py:23
str
Definition: BTagTrackIpAccessor.cxx:11
python.ResourceLimits._max_32bit_address_space
def _max_32bit_address_space(soft, descr)
Definition: ResourceLimits.py:38