зеркало из https://github.com/mozilla/bugbug.git
Merge check_models script functionality into download_models
This commit is contained in:
Родитель
97f4545d22
Коммит
4087175249
|
@ -1,37 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from bugbug_http.models import MODELS_NAMES, get_model
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
LOGGER = logging.getLogger()
|
||||
|
||||
|
||||
def check_models():
|
||||
for model_name in MODELS_NAMES:
|
||||
# Try loading the model
|
||||
get_model(model_name)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
should_check_models = os.environ.get("CHECK_MODELS", "1")
|
||||
|
||||
if should_check_models == "0":
|
||||
LOGGER.info("Skipping checking models as instructed by env var $CHECK_MODELS")
|
||||
sys.exit(0)
|
||||
|
||||
try:
|
||||
check_models()
|
||||
except Exception:
|
||||
LOGGER.warning(
|
||||
"Failed to validate the models, please run `python download_models.py`",
|
||||
exc_info=True,
|
||||
)
|
||||
sys.exit(1)
|
|
@ -4,12 +4,14 @@
|
|||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from bugbug import db, repository, test_scheduling, utils
|
||||
from bugbug_http.models import MODELS_NAMES
|
||||
from bugbug_http.models import MODELS_NAMES, get_model
|
||||
|
||||
|
||||
def preload_models():
|
||||
for model_name in MODELS_NAMES:
|
||||
utils.download_model(model_name)
|
||||
# Try loading the model
|
||||
get_model(model_name)
|
||||
|
||||
db.download_support_file(
|
||||
test_scheduling.TEST_LABEL_SCHEDULING_DB,
|
||||
|
|
|
@ -14,5 +14,3 @@ if [ "$CHECK_MODELS" == "0" ]; then
|
|||
fi
|
||||
|
||||
python -m bugbug_http.download_models
|
||||
|
||||
python -m bugbug_http.check_models
|
||||
|
|
Загрузка…
Ссылка в новой задаче