mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-05 11:48:33 +08:00
Some summary logging from ridad.
This commit is contained in:
@@ -199,6 +199,10 @@ class KojiModuleBuilder(GenericBuilder):
|
||||
self.module_build_tag = "%s-build" % tag_name
|
||||
self.module_target = tag_name
|
||||
|
||||
def __repr__(self):
|
||||
return "<KojiModuleBuilder module: %s, tag: %s>" % (
|
||||
self.module_str, self.module_tag)
|
||||
|
||||
def buildroot_resume(self): # XXX: experimental
|
||||
"""
|
||||
Resume existing buildroot. Sets __prep=True
|
||||
|
||||
@@ -70,6 +70,8 @@ BUILD_STATES = {
|
||||
"ready": 5,
|
||||
}
|
||||
|
||||
INVERSE_BUILD_STATES = {v: k for k, v in BUILD_STATES.items()}
|
||||
|
||||
|
||||
class RidaBase(object):
|
||||
# TODO -- we can implement functionality here common to all our model
|
||||
@@ -218,8 +220,9 @@ class ModuleBuild(Base):
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return "<ModuleBuild %s-%s-%s>" % (
|
||||
self.name, self.version, self.release)
|
||||
return "<ModuleBuild %s-%s-%s, state %r>" % (
|
||||
self.name, self.version, self.release,
|
||||
INVERSE_BUILD_STATES[self.state])
|
||||
|
||||
|
||||
class ComponentBuild(Base):
|
||||
@@ -253,4 +256,5 @@ class ComponentBuild(Base):
|
||||
}
|
||||
|
||||
def __repr__(self):
|
||||
return "<ComponentBuild %s of %r>" % (self.package, self.module_id)
|
||||
return "<ComponentBuild %s of %r, state: %r>" % (
|
||||
self.package, self.module_id, self.state)
|
||||
|
||||
@@ -32,6 +32,7 @@ proper scheduling component builds in the supported build systems.
|
||||
|
||||
import inspect
|
||||
import logging
|
||||
import operator
|
||||
import os
|
||||
import pprint
|
||||
import threading
|
||||
@@ -146,6 +147,8 @@ class Messaging(threading.Thread):
|
||||
class Polling(threading.Thread):
|
||||
def run(self):
|
||||
while True:
|
||||
with rida.database.Database(config) as session:
|
||||
self.log_summary(session)
|
||||
with rida.database.Database(config) as session:
|
||||
self.process_waiting_module_builds(session)
|
||||
with rida.database.Database(config) as session:
|
||||
@@ -155,6 +158,21 @@ class Polling(threading.Thread):
|
||||
log.info("Polling thread sleeping, %rs" % config.polling_interval)
|
||||
time.sleep(config.polling_interval)
|
||||
|
||||
def log_summary(self, session):
|
||||
log.info("Current status:")
|
||||
states = sorted(rida.BUILD_STATES.items(), key=operator.itemgetter(1))
|
||||
for name, code in states:
|
||||
query = session.query(rida.database.ModuleBuild)
|
||||
count = query.filter_by(state=code).count()
|
||||
if count:
|
||||
log.info(" * %i module builds in the %s state." % (count, name))
|
||||
if name == 'build':
|
||||
for module_build in query.all():
|
||||
log.info(" * %r" % module_build)
|
||||
for component_build in module_build.component_builds:
|
||||
log.info(" * %r" % component_build)
|
||||
|
||||
|
||||
def process_waiting_module_builds(self, session):
|
||||
log.info("Looking for module builds stuck in the wait state.")
|
||||
builds = rida.database.ModuleBuild.by_state(session, "wait")
|
||||
|
||||
Reference in New Issue
Block a user