зеркало из https://github.com/mozilla/bugbug.git
Get rid of the load_model utility function
This commit is contained in:
Родитель
bfc1fa3a85
Коммит
a1475fd7cd
|
@ -50,12 +50,3 @@ def get_model_class(model_name):
|
||||||
|
|
||||||
full_qualified_class_name = MODELS[model_name]
|
full_qualified_class_name = MODELS[model_name]
|
||||||
return load_model_class(full_qualified_class_name)
|
return load_model_class(full_qualified_class_name)
|
||||||
|
|
||||||
|
|
||||||
def load_model(model_name):
|
|
||||||
model_class = get_model_class(model_name)
|
|
||||||
|
|
||||||
model_file_path = f"{model_name}model"
|
|
||||||
|
|
||||||
LOGGER.debug(f"Lookup model in {model_file_path}")
|
|
||||||
return model_class.load(model_file_path)
|
|
||||||
|
|
|
@ -17,7 +17,6 @@ from redis import Redis
|
||||||
|
|
||||||
from bugbug import bugzilla, repository
|
from bugbug import bugzilla, repository
|
||||||
from bugbug.model import Model
|
from bugbug.model import Model
|
||||||
from bugbug.models import load_model
|
|
||||||
from bugbug.utils import get_hgmo_stack
|
from bugbug.utils import get_hgmo_stack
|
||||||
from bugbug_http.readthrough_cache import ReadthroughTTLCache
|
from bugbug_http.readthrough_cache import ReadthroughTTLCache
|
||||||
|
|
||||||
|
@ -38,7 +37,7 @@ DEFAULT_EXPIRATION_TTL = 7 * 24 * 3600 # A week
|
||||||
redis = Redis.from_url(os.environ.get("REDIS_URL", "redis://localhost/0"))
|
redis = Redis.from_url(os.environ.get("REDIS_URL", "redis://localhost/0"))
|
||||||
|
|
||||||
MODEL_CACHE: ReadthroughTTLCache[str, Model] = ReadthroughTTLCache(
|
MODEL_CACHE: ReadthroughTTLCache[str, Model] = ReadthroughTTLCache(
|
||||||
timedelta(hours=1), load_model
|
timedelta(hours=1), lambda m: Model.load(f"{m}model")
|
||||||
)
|
)
|
||||||
MODEL_CACHE.start_ttl_thread()
|
MODEL_CACHE.start_ttl_thread()
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,8 @@ import os
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from bugbug import bugzilla
|
from bugbug import bugzilla
|
||||||
from bugbug.models import load_model
|
from bugbug.models.bug import BugModel
|
||||||
|
from bugbug.models.regression import RegressionModel
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -21,9 +22,9 @@ parser.add_argument(
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
if args.goal == "str":
|
if args.goal == "str":
|
||||||
model = load_model("bug")
|
model = BugModel.load("bugmodel")
|
||||||
elif args.goal == "regressionrange":
|
elif args.goal == "regressionrange":
|
||||||
model = load_model("regression")
|
model = RegressionModel.load("regressionmodel")
|
||||||
|
|
||||||
file_path = os.path.join("bugbug", "labels", f"{args.goal}.csv")
|
file_path = os.path.join("bugbug", "labels", f"{args.goal}.csv")
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче