diff --git a/rida/scheduler/handlers/modules.py b/rida/scheduler/handlers/modules.py index 8a1e1bf2..14e496df 100644 --- a/rida/scheduler/handlers/modules.py +++ b/rida/scheduler/handlers/modules.py @@ -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. diff --git a/rida/scheduler/main.py b/rida/scheduler/main.py index 70078a1a..8c3316da 100644 --- a/rida/scheduler/main.py +++ b/rida/scheduler/main.py @@ -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...