Entropy:
- introduce preliminary priority management infrastructure git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@1918 cd1c1023-2f26-0410-ae45-c471fc1f0318
This commit is contained in:
@@ -280,6 +280,16 @@ class EquoInterface(TextInterface):
|
||||
else:
|
||||
raise exceptionTools.InvalidData("InvalidData: nothing to backup in etpConst with %s key" % (setting_name,))
|
||||
|
||||
def set_priority(self, low = 0):
|
||||
default_nice = etpConst['default_nice']
|
||||
current_nice = etpConst['current_nice']
|
||||
delta = current_nice - default_nice
|
||||
try:
|
||||
etpConst['current_nice'] = os.nice(delta*-1+low)
|
||||
except OSError:
|
||||
pass
|
||||
return current_nice # aka, the old value
|
||||
|
||||
def switchChroot(self, chroot = ""):
|
||||
# clean caches
|
||||
self.purge_cache()
|
||||
@@ -5895,6 +5905,8 @@ class RepoInterface:
|
||||
)
|
||||
|
||||
if self.Entropy.indexing:
|
||||
# renice a bit, to avoid eating resources
|
||||
old_prio = self.Entropy.set_priority(15)
|
||||
self.Entropy.updateProgress(
|
||||
red("Indexing Repository metadata ..."),
|
||||
importance = 1,
|
||||
@@ -5913,6 +5925,7 @@ class RepoInterface:
|
||||
self.Entropy.clientDbconn.createAllIndexes()
|
||||
except:
|
||||
pass
|
||||
self.Entropy.set_priority(old_prio)
|
||||
# update revision in etpRepositories
|
||||
self.Entropy.update_repository_revision(repo)
|
||||
|
||||
|
||||
@@ -651,6 +651,9 @@ def const_defaultSettings(rootdir):
|
||||
'sysgroup': "entropy",
|
||||
'defaultumask': 022,
|
||||
'storeumask': 002,
|
||||
'gentle_nice': 15,
|
||||
'current_nice': 0,
|
||||
'default_nice': 0,
|
||||
'server_treeupdatescalled': set(),
|
||||
'client_treeupdatescalled': set(),
|
||||
'spm': {
|
||||
@@ -763,6 +766,13 @@ def const_defaultSettings(rootdir):
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
# set current nice level
|
||||
try:
|
||||
myConst['current_nice'] = os.nice(0)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
etpConst.update(myConst)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user