mirror of
https://github.com/archlinux-jerry/buildbot
synced 2024-12-22 02:49:24 +08:00
introduce priority system
This commit is contained in:
parent
9451a8e79e
commit
7bf67bc21f
2 changed files with 7 additions and 3 deletions
|
@ -67,6 +67,8 @@ class Job:
|
|||
ret += f'{myproperty}={getattr(self, myproperty, None)},'
|
||||
ret += ')'
|
||||
return ret
|
||||
def __lt__(self, job2):
|
||||
return self.pkgconfig.priority < job2.pkgconfig.priority
|
||||
class jobsManager:
|
||||
def __init__(self):
|
||||
self.__buildjobs = list()
|
||||
|
@ -186,6 +188,7 @@ class jobsManager:
|
|||
return self.__get_job()
|
||||
jobs = self.__buildjobs
|
||||
if jobs:
|
||||
jobs.sort(reverse=True)
|
||||
self.__curr_job = jobs.pop(0)
|
||||
return self.__curr_job
|
||||
def __finish_job(self, pkgdir, force=False):
|
||||
|
|
|
@ -20,7 +20,7 @@ os.chdir(abspath)
|
|||
REPO_ROOT = Path(PKGBUILD_DIR)
|
||||
|
||||
class pkgConfig:
|
||||
def __init__(self, dirname, pkgtype, cleanbuild, timeout, extra):
|
||||
def __init__(self, dirname, pkgtype, cleanbuild, timeout, priority, extra):
|
||||
self.dirname = dirname
|
||||
|
||||
self.type = pkgtype
|
||||
|
@ -33,6 +33,7 @@ class pkgConfig:
|
|||
|
||||
self.timeout = 30 if timeout is None else int(timeout)
|
||||
# timeout in minutes
|
||||
self.priority = 0 if priority is None else int(priority)
|
||||
|
||||
self.__extra = extra
|
||||
self.__process_extra()
|
||||
|
@ -62,7 +63,7 @@ class pkgConfig:
|
|||
ret = "pkgConfig("
|
||||
for myproperty in \
|
||||
(
|
||||
'dirname', 'type', 'cleanbuild', 'timeout',
|
||||
'dirname', 'type', 'cleanbuild', 'timeout', 'priority',
|
||||
'prebuild', 'postbuild', 'update', 'failure'
|
||||
):
|
||||
ret += f'{myproperty}={getattr(self, myproperty, None)},'
|
||||
|
@ -82,7 +83,7 @@ def load_all():
|
|||
content = load(content, Loader=Loader)
|
||||
assert type(content) is dict
|
||||
args = [content.get(part, None) for part in \
|
||||
('type', 'cleanbuild', 'timeout', 'extra')]
|
||||
('type', 'cleanbuild', 'timeout', 'priority', 'extra')]
|
||||
args = [mydir.name] + args
|
||||
pkgconfigs.append(pkgConfig(*args))
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue