2
0
mirror of https://github.com/frappe/bench.git synced 2024-09-28 06:49:06 +00:00

perf: Cache Bench and App instantiation

This commit is contained in:
Gavin D'souza 2021-11-18 00:39:48 +05:30
parent ac07d8dc52
commit cd1f526d09
3 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,5 @@
# imports - standard imports
import functools
import json
import logging
import os
@ -7,6 +8,7 @@ import shutil
import subprocess
import sys
import typing
from datetime import date
# imports - third party imports
import click
@ -127,7 +129,7 @@ class AppMeta:
def get_ssh_url(self):
return f"git@{self.remote_server}:{self.org}/{self.repo}.git"
@functools.lru_cache(maxsize=None)
class App(AppMeta):
def __init__(
self, name: str, branch: str = None, bench: "Bench" = None, *args, **kwargs

View File

@ -1,3 +1,5 @@
# imports - standard imports
import functools
import os
import shutil
import sys
@ -45,6 +47,7 @@ class Validator:
validate_app_installed_on_sites(app, bench_path=self.name)
@functools.lru_cache(maxsize=None)
class Bench(Base, Validator):
def __init__(self, path):
self.name = path

View File

@ -29,6 +29,7 @@ from bench.utils import (
)
from bench.utils.bench import get_env_cmd
fancy = True
from_command_line = False
bench.LOG_BUFFER = []
change_uid_msg = "You should not run this command as root"