mirror of
https://github.com/FoundationAgents/MetaGPT.git
synced 2026-05-24 14:15:17 +02:00
feat: +retry
This commit is contained in:
parent
a36c58c0df
commit
5bef244a1a
2 changed files with 6 additions and 1 deletions
|
|
@ -17,6 +17,7 @@ from typing import Dict, List
|
|||
from git.repo import Repo
|
||||
from git.repo.fun import is_git_dir
|
||||
from gitignore_parser import parse_gitignore
|
||||
from tenacity import retry, stop_after_attempt, wait_random_exponential
|
||||
|
||||
from metagpt.logs import logger
|
||||
from metagpt.tools.libs.shell import shell_execute
|
||||
|
|
@ -287,11 +288,15 @@ class GitRepository:
|
|||
return files
|
||||
|
||||
@classmethod
|
||||
@retry(wait=wait_random_exponential(min=1, max=15), stop=stop_after_attempt(3))
|
||||
async def clone_from(cls, url: str | Path, output_dir: str | Path = None) -> "GitRepository":
|
||||
from metagpt.context import Context
|
||||
|
||||
to_path = Path(output_dir or Path(__file__).parent / f"../../workspace/downloads/{uuid.uuid4().hex}").resolve()
|
||||
to_path.mkdir(parents=True, exist_ok=True)
|
||||
repo_dir = to_path / Path(url).stem
|
||||
if repo_dir.exists():
|
||||
shutil.rmtree(repo_dir, ignore_errors=True)
|
||||
ctx = Context()
|
||||
env = ctx.new_environ()
|
||||
proxy = ["-c", f"http.proxy={ctx.config.proxy}"] if ctx.config.proxy else []
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ gitignore-parser==0.1.9
|
|||
# connexion[uvicorn]~=3.0.5 # Used by metagpt/tools/openapi_v3_hello.py
|
||||
websockets~=11.0
|
||||
networkx~=3.2.1
|
||||
google-generativeai==0.3.2
|
||||
google-generativeai==0.4.1
|
||||
playwright>=1.26 # used at metagpt/tools/libs/web_scraping.py
|
||||
anytree
|
||||
ipywidgets==8.1.1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue