update the buildArch task weight based on the average duration of a build of the package
This commit is contained in:
parent
c48620edc8
commit
f100121dda
2 changed files with 23 additions and 5 deletions
|
|
@ -1917,10 +1917,23 @@ class BuildArchTask(BaseTaskHandler):
|
|||
Methods = ['buildArch']
|
||||
|
||||
def weight(self):
|
||||
# XXX - this one needs to figure the weight from the package to be
|
||||
# built
|
||||
return 1.5
|
||||
|
||||
def updateWeight(self, name):
|
||||
"""
|
||||
Update the weight of this task based on the package we're building.
|
||||
weight is scaled from a minimum of 1.5 to a maximum of 6, based on
|
||||
the average duration of a build of this package.
|
||||
"""
|
||||
avg = session.getAverageBuildDuration(name)
|
||||
if not avg:
|
||||
return
|
||||
# increase the task weight by 0.75 for every hour of build duration
|
||||
adj = (avg / 4800.0)
|
||||
# cap the adjustment at +4.5
|
||||
weight = self.weight() + min(4.5, adj)
|
||||
session.host.setTaskWeight(self.id, weight)
|
||||
|
||||
def srpm_sanity_checks(self, filename):
|
||||
header = koji.get_rpm_header(filename)
|
||||
|
||||
|
|
@ -1962,6 +1975,8 @@ class BuildArchTask(BaseTaskHandler):
|
|||
# if not h[rpm.RPMTAG_DISTRIBUTION]:
|
||||
# raise koji.BuildError, "the distribution tag is not set in the original srpm"
|
||||
|
||||
self.updateWeight(name)
|
||||
|
||||
rootopts = {
|
||||
'repo_id': repo_id
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue