def wait_for_build()

in source/services/lex-bot/lambda_function.py [0:0]


def wait_for_build(bot_id, locale_id):
    response = client.describe_bot_locale(
        botId=bot_id, localeId=locale_id, botVersion="DRAFT"
    )
    bot_locale_status = response["botLocaleStatus"]
    while bot_locale_status == "Building":
        sleep(1)
        response = client.describe_bot_locale(
            botId=bot_id, localeId=locale_id, botVersion="DRAFT"
        )
        bot_locale_status = response["botLocaleStatus"]
    if bot_locale_status == "Failed":
        logger.error(response)
        raise RuntimeError("Failed to create Lex bot locale")