direct transition to ready from done

As of now we don't do anything useful in between done (read: module
build is done) and ready (read: module is ready for consumption).

Thus I recommend direct transition and return to it back
when we have automatic dependency rebuild done.

Signed-off-by: Lubos Kocman <lkocman@redhat.com>
Signed-off-by: Nils Philippsen <nils@redhat.com>
This commit is contained in:
Lubos Kocman
2016-08-25 14:16:07 +02:00
committed by Nils Philippsen
parent 4bb5227aec
commit a53f37ecff
2 changed files with 19 additions and 1 deletions

View File

@@ -43,6 +43,24 @@ def get_rpm_release_from_tag(tag):
def get_artifact_from_srpm(srpm_path):
return os.path.basename(srpm_path).replace(".src.rpm", "")
def done(config, session, msg):
"""Called whenever a module enters the 'done' state.
We currently don't do anything useful, so moving to ready.
Otherwise the done -> ready state should happen when all
dependent modules were re-built, at least that's the current plan.
"""
build = models.ModuleBuild.from_module_event(db.session, msg)
module_info = build.json()
if module_info['state'] != msg['msg']['state']:
log.warn("Note that retrieved module state %r "
"doesn't match message module state %r" % (
module_info['state'], msg['msg']['state']))
# This is ok.. it's a race condition we can ignore.
pass
build.transition(config, state="ready")
session.commit()
def wait(config, session, msg):
""" Called whenever a module enters the 'wait' state.

View File

@@ -100,7 +100,7 @@ class MessageWorker(threading.Thread):
models.BUILD_STATES["wait"]: rida.scheduler.handlers.modules.wait,
models.BUILD_STATES["build"]: NO_OP,
models.BUILD_STATES["failed"]: NO_OP,
models.BUILD_STATES["done"]: NO_OP,
models.BUILD_STATES["done"]: rida.scheduler.handlers.modules.done, # XXX: DIRECT TRANSITION TO READY
models.BUILD_STATES["ready"]: NO_OP,
}
# Only one kind of repo change event, though...