mirror of
https://github.com/frappe/bench.git
synced 2025-01-10 17:24:41 +00:00
perf: Cache Bench and App instantiation
This commit is contained in:
parent
ac07d8dc52
commit
cd1f526d09
@ -1,4 +1,5 @@
|
|||||||
# imports - standard imports
|
# imports - standard imports
|
||||||
|
import functools
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@ -7,6 +8,7 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import typing
|
import typing
|
||||||
|
from datetime import date
|
||||||
|
|
||||||
# imports - third party imports
|
# imports - third party imports
|
||||||
import click
|
import click
|
||||||
@ -127,7 +129,7 @@ class AppMeta:
|
|||||||
def get_ssh_url(self):
|
def get_ssh_url(self):
|
||||||
return f"git@{self.remote_server}:{self.org}/{self.repo}.git"
|
return f"git@{self.remote_server}:{self.org}/{self.repo}.git"
|
||||||
|
|
||||||
|
@functools.lru_cache(maxsize=None)
|
||||||
class App(AppMeta):
|
class App(AppMeta):
|
||||||
def __init__(
|
def __init__(
|
||||||
self, name: str, branch: str = None, bench: "Bench" = None, *args, **kwargs
|
self, name: str, branch: str = None, bench: "Bench" = None, *args, **kwargs
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
# imports - standard imports
|
||||||
|
import functools
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
@ -45,6 +47,7 @@ class Validator:
|
|||||||
validate_app_installed_on_sites(app, bench_path=self.name)
|
validate_app_installed_on_sites(app, bench_path=self.name)
|
||||||
|
|
||||||
|
|
||||||
|
@functools.lru_cache(maxsize=None)
|
||||||
class Bench(Base, Validator):
|
class Bench(Base, Validator):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.name = path
|
self.name = path
|
||||||
|
@ -29,6 +29,7 @@ from bench.utils import (
|
|||||||
)
|
)
|
||||||
from bench.utils.bench import get_env_cmd
|
from bench.utils.bench import get_env_cmd
|
||||||
|
|
||||||
|
fancy = True
|
||||||
from_command_line = False
|
from_command_line = False
|
||||||
bench.LOG_BUFFER = []
|
bench.LOG_BUFFER = []
|
||||||
change_uid_msg = "You should not run this command as root"
|
change_uid_msg = "You should not run this command as root"
|
||||||
|
Loading…
Reference in New Issue
Block a user