Merge pull request #419 from cdburkard/patches/rt_failure_output
fix silent failures when rt cannot be assigned - will follow up on this
This commit is contained in:
+17
-8
@@ -535,7 +535,7 @@ class Node( object ):
|
|||||||
value may also be list or dict"""
|
value may also be list or dict"""
|
||||||
name, value = param.items()[ 0 ]
|
name, value = param.items()[ 0 ]
|
||||||
f = getattr( self, method, None )
|
f = getattr( self, method, None )
|
||||||
if not f or value is None:
|
if not f:
|
||||||
return
|
return
|
||||||
if type( value ) is list:
|
if type( value ) is list:
|
||||||
result = f( *value )
|
result = f( *value )
|
||||||
@@ -678,8 +678,14 @@ class CPULimitedHost( Host ):
|
|||||||
# Tell mnexec to execute command in our cgroup
|
# Tell mnexec to execute command in our cgroup
|
||||||
mncmd = [ 'mnexec', '-g', self.name,
|
mncmd = [ 'mnexec', '-g', self.name,
|
||||||
'-da', str( self.pid ) ]
|
'-da', str( self.pid ) ]
|
||||||
if self.sched == 'rt':
|
cpuTime = int( self.cgroupGet( 'rt_runtime_us', 'cpu' ) )
|
||||||
|
# if our cgroup is not given any cpu time,
|
||||||
|
# we cannot assign the RR Scheduler.
|
||||||
|
if self.sched == 'rt' and cpuTime > 0:
|
||||||
mncmd += [ '-r', str( self.rtprio ) ]
|
mncmd += [ '-r', str( self.rtprio ) ]
|
||||||
|
elif self.sched == 'rt' and cpuTime <= 0:
|
||||||
|
debug( '***error: not enough cpu time available for %s.' % self.name,
|
||||||
|
'Using cfs scheduler for subprocess\n' )
|
||||||
return Host.popen( self, *args, mncmd=mncmd, **kwargs )
|
return Host.popen( self, *args, mncmd=mncmd, **kwargs )
|
||||||
|
|
||||||
def cleanup( self ):
|
def cleanup( self ):
|
||||||
@@ -730,8 +736,9 @@ class CPULimitedHost( Host ):
|
|||||||
f: CPU bandwidth limit (fraction)
|
f: CPU bandwidth limit (fraction)
|
||||||
sched: 'rt' or 'cfs'
|
sched: 'rt' or 'cfs'
|
||||||
Note 'cfs' requires CONFIG_CFS_BANDWIDTH"""
|
Note 'cfs' requires CONFIG_CFS_BANDWIDTH"""
|
||||||
|
# if cpu fraction is None, reset to default of 0
|
||||||
if not f:
|
if not f:
|
||||||
return
|
f = -1
|
||||||
if not sched:
|
if not sched:
|
||||||
sched = self.sched
|
sched = self.sched
|
||||||
if sched == 'rt':
|
if sched == 'rt':
|
||||||
@@ -744,15 +751,17 @@ class CPULimitedHost( Host ):
|
|||||||
# Reset to unlimited
|
# Reset to unlimited
|
||||||
quota = -1
|
quota = -1
|
||||||
# Set cgroup's period and quota
|
# Set cgroup's period and quota
|
||||||
self.cgroupSet( pstr, period )
|
setPeriod = self.cgroupSet( pstr, period )
|
||||||
self.cgroupSet( qstr, quota )
|
setQuota = self.cgroupSet( qstr, quota )
|
||||||
if sched == 'rt':
|
if sched == 'rt':
|
||||||
# Set RT priority if necessary
|
# Set RT priority if necessary
|
||||||
self.chrt()
|
sched = self.chrt()
|
||||||
info( '(%s %d/%dus) ' % ( sched, quota, period ) )
|
info( '(%s %d/%dus) ' % ( sched, setQuota, setPeriod ) )
|
||||||
|
|
||||||
def setCPUs( self, cores, mems=0 ):
|
def setCPUs( self, cores, mems=0 ):
|
||||||
"Specify (real) cores that our cgroup can run on"
|
"Specify (real) cores that our cgroup can run on"
|
||||||
|
if not cores:
|
||||||
|
return
|
||||||
if type( cores ) is list:
|
if type( cores ) is list:
|
||||||
cores = ','.join( [ str( c ) for c in cores ] )
|
cores = ','.join( [ str( c ) for c in cores ] )
|
||||||
self.cgroupSet( resource='cpuset', param='cpus',
|
self.cgroupSet( resource='cpuset', param='cpus',
|
||||||
@@ -766,7 +775,7 @@ class CPULimitedHost( Host ):
|
|||||||
errFail( 'cgclassify -g cpuset:/%s %s' % (
|
errFail( 'cgclassify -g cpuset:/%s %s' % (
|
||||||
self.name, self.pid ) )
|
self.name, self.pid ) )
|
||||||
|
|
||||||
def config( self, cpu=None, cores=None, **params ):
|
def config( self, cpu=-1, cores=None, **params ):
|
||||||
"""cpu: desired overall system CPU fraction
|
"""cpu: desired overall system CPU fraction
|
||||||
cores: (real) core(s) this host can run on
|
cores: (real) core(s) this host can run on
|
||||||
params: parameters for Node.config()"""
|
params: parameters for Node.config()"""
|
||||||
|
|||||||
Reference in New Issue
Block a user