def METHOD_NAME(self):
    try:
        # select the build environment and the request to build
        br = self._selectBuildRequest()
        if br:
            br.state = BuildRequest.REQ_INPROGRESS
            br.save()
        else:
            return
        try:
            bec = self._selectBuildEnvironment()
        except IndexError as e:
            # we could not find a BEC; postpone the BR
            br.state = BuildRequest.REQ_QUEUED
            br.save()
            logger.debug("runbuilds: No build env (%s)" % e)
            return
        logger.info("runbuilds: starting build %s, environment %s" %
                    (br, bec.be))
        # let the build request know where it is being executed
        br.environment = bec.be
        br.save()
        # this triggers an async build
        bec.triggerBuild(br.brbitbake, br.brlayer_set.all(),
                         br.brvariable_set.all(), br.brtarget_set.all(),
                         "%d:%d" % (br.pk, bec.be.pk))
    except Exception as e:
        logger.error("runbuilds: Error launching build %s" % e)
        traceback.print_exc()
        if "[Errno 111] Connection refused" in str(e):
            # Connection refused, read toaster_server.out
            errmsg = bec.readServerLogFile()
        else:
            errmsg = str(e)
        BRError.objects.create(req=br, errtype=str(type(e)), errmsg=errmsg,
                               traceback=traceback.format_exc())
        br.state = BuildRequest.REQ_FAILED
        br.save()
        bec.be.lock = BuildEnvironment.LOCK_FREE
        bec.be.save()
        # Cancel the pending build and report the exception to the UI
        log_object = LogMessage.objects.create(
                        build = br.build,
                        level = LogMessage.EXCEPTION,
                        message = errmsg)
        log_object.save()
        br.build.outcome = Build.FAILED
        br.build.save()