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']
|
Methods = ['buildArch']
|
||||||
|
|
||||||
def weight(self):
|
def weight(self):
|
||||||
# XXX - this one needs to figure the weight from the package to be
|
|
||||||
# built
|
|
||||||
return 1.5
|
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):
|
def srpm_sanity_checks(self, filename):
|
||||||
header = koji.get_rpm_header(filename)
|
header = koji.get_rpm_header(filename)
|
||||||
|
|
||||||
|
|
@ -1962,6 +1975,8 @@ class BuildArchTask(BaseTaskHandler):
|
||||||
# if not h[rpm.RPMTAG_DISTRIBUTION]:
|
# if not h[rpm.RPMTAG_DISTRIBUTION]:
|
||||||
# raise koji.BuildError, "the distribution tag is not set in the original srpm"
|
# raise koji.BuildError, "the distribution tag is not set in the original srpm"
|
||||||
|
|
||||||
|
self.updateWeight(name)
|
||||||
|
|
||||||
rootopts = {
|
rootopts = {
|
||||||
'repo_id': repo_id
|
'repo_id': repo_id
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5366,11 +5366,14 @@ class RootExports(object):
|
||||||
tag = get_tag_id(tag,strict=True)
|
tag = get_tag_id(tag,strict=True)
|
||||||
return readTaggedRPMS(tag, package=package, arch=arch, event=event,inherit=True,latest=True, rpmsigs=rpmsigs)
|
return readTaggedRPMS(tag, package=package, arch=arch, event=event,inherit=True,latest=True, rpmsigs=rpmsigs)
|
||||||
|
|
||||||
def getAverageBuildDuration(self, packageID):
|
def getAverageBuildDuration(self, package):
|
||||||
"""Get the average duration of a build of a package with
|
"""Get the average duration of a build of the given package.
|
||||||
the given ID. Returns a floating-point value indicating the
|
Returns a floating-point value indicating the
|
||||||
average number of seconds the package took to build. If the package
|
average number of seconds the package took to build. If the package
|
||||||
has never been built, return None."""
|
has never been built, return None."""
|
||||||
|
packageID = get_package_id(package)
|
||||||
|
if not packageID:
|
||||||
|
return None
|
||||||
st_complete = koji.BUILD_STATES['COMPLETE']
|
st_complete = koji.BUILD_STATES['COMPLETE']
|
||||||
query = """SELECT EXTRACT(epoch FROM avg(build.completion_time - events.time))
|
query = """SELECT EXTRACT(epoch FROM avg(build.completion_time - events.time))
|
||||||
FROM build
|
FROM build
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue