Merge branch 'lkocman/ready_state'

This commit is contained in:
Nils Philippsen
2016-08-25 14:27:46 +02:00
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...